Move MotionVectors pass draw calls sorting to be together with the rest of the sortings

This commit is contained in:
Wojtek Figat
2022-11-24 20:01:28 +01:00
parent 33910eb310
commit 6f95f162d0
2 changed files with 5 additions and 3 deletions

View File

@@ -213,7 +213,7 @@ void MotionBlurPass::RenderMotionVectors(RenderContext& renderContext)
// Render camera motion vectors (background)
if (!data.TemporalAAJitter.IsZero() || data.CurrentVP != data.PreviousVP)
{
PROFILE_GPU_CPU("Camera Motion Vectors");
PROFILE_GPU("Camera Motion Vectors");
context->SetRenderTarget(motionVectors->View());
context->SetState(_psCameraMotionVectors);
context->DrawFullscreenTriangle();
@@ -229,7 +229,6 @@ void MotionBlurPass::RenderMotionVectors(RenderContext& renderContext)
context->SetRenderTarget(depthBuffer->View(), motionVectors->View());
renderContext.View.Pass = DrawPass::MotionVectors;
// TODO: maybe update material PerFrame data because render viewport can be other size than ScreenSize from render buffers
renderContext.List->SortDrawCalls(renderContext, false, DrawCallsListType::MotionVectors);
renderContext.List->ExecuteDrawCalls(renderContext, DrawCallsListType::MotionVectors);
// Cleanup

View File

@@ -323,11 +323,12 @@ void RenderInner(SceneRenderTask* task, RenderContext& renderContext, RenderCont
// Build batch of render contexts (main view and shadow projections)
const bool isGBufferDebug = GBufferPass::IsDebugView(renderContext.View.Mode);
const bool needMotionVectors = Renderer::NeedMotionVectors(renderContext);
{
PROFILE_CPU_NAMED("Collect Draw Calls");
view.Pass = DrawPass::GBuffer | DrawPass::Forward | DrawPass::Distortion;
if (Renderer::NeedMotionVectors(renderContext))
if (needMotionVectors)
view.Pass |= DrawPass::MotionVectors;
renderContextBatch.GetMainContext() = renderContext; // Sync render context in batch with the current value
@@ -369,6 +370,8 @@ void RenderInner(SceneRenderTask* task, RenderContext& renderContext, RenderCont
renderContext.List->SortDrawCalls(renderContext, false, DrawCallsListType::GBufferNoDecals);
renderContext.List->SortDrawCalls(renderContext, true, DrawCallsListType::Forward);
renderContext.List->SortDrawCalls(renderContext, false, DrawCallsListType::Distortion);
if (needMotionVectors)
renderContext.List->SortDrawCalls(renderContext, false, DrawCallsListType::MotionVectors);
for (int32 i = 1; i < renderContextBatch.Contexts.Count(); i++)
{
auto& shadowContext = renderContextBatch.Contexts[i];