refactor(srp): scope managed pass collection to active stage
This commit is contained in:
@@ -12,6 +12,9 @@ namespace XCEngine.Rendering.Universal
|
||||
new List<ScriptableRenderPass>();
|
||||
private readonly RendererBlocks m_rendererBlocks =
|
||||
new RendererBlocks();
|
||||
private bool m_isBuildingPassQueue;
|
||||
private CameraFrameStage m_passQueueStage =
|
||||
CameraFrameStage.MainScene;
|
||||
private bool m_disposed;
|
||||
|
||||
protected ScriptableRenderer()
|
||||
@@ -50,6 +53,19 @@ namespace XCEngine.Rendering.Universal
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_isBuildingPassQueue &&
|
||||
!renderPass.SupportsStage(m_passQueueStage))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InsertActivePass(
|
||||
renderPass);
|
||||
}
|
||||
|
||||
private void InsertActivePass(
|
||||
ScriptableRenderPass renderPass)
|
||||
{
|
||||
int insertIndex = m_activePassQueue.Count;
|
||||
while (insertIndex > 0 &&
|
||||
m_activePassQueue[insertIndex - 1].renderPassEvent >
|
||||
@@ -331,22 +347,37 @@ namespace XCEngine.Rendering.Universal
|
||||
RenderingData renderingData)
|
||||
{
|
||||
m_activePassQueue.Clear();
|
||||
m_rendererBlocks.Clear();
|
||||
m_isBuildingPassQueue = true;
|
||||
m_passQueueStage =
|
||||
renderingData != null
|
||||
? renderingData.stage
|
||||
: CameraFrameStage.MainScene;
|
||||
|
||||
for (int i = 0; i < m_features.Count; ++i)
|
||||
try
|
||||
{
|
||||
ScriptableRendererFeature feature = m_features[i];
|
||||
if (feature == null || !feature.isActive)
|
||||
for (int i = 0; i < m_features.Count; ++i)
|
||||
{
|
||||
continue;
|
||||
ScriptableRendererFeature feature = m_features[i];
|
||||
if (feature == null || !feature.isActive)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
feature.AddRenderPasses(
|
||||
this,
|
||||
renderingData);
|
||||
}
|
||||
|
||||
feature.AddRenderPasses(
|
||||
this,
|
||||
renderingData);
|
||||
AddRenderPasses(renderingData);
|
||||
m_rendererBlocks.Build(m_activePassQueue);
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_isBuildingPassQueue = false;
|
||||
m_passQueueStage =
|
||||
CameraFrameStage.MainScene;
|
||||
}
|
||||
|
||||
AddRenderPasses(renderingData);
|
||||
m_rendererBlocks.Build(m_activePassQueue);
|
||||
}
|
||||
|
||||
protected virtual void ReleaseRuntimeResources()
|
||||
|
||||
Reference in New Issue
Block a user