Optimize SDF model buffer flushing to be used only if needed

This commit is contained in:
Wojciech Figat
2022-04-21 12:10:22 +02:00
parent 0b6d3a313e
commit e44c09aa6e

View File

@@ -460,12 +460,6 @@ bool GlobalSignDistanceFieldPass::Render(RenderContext& renderContext, GPUContex
}
}
// Send models data to the GPU
{
PROFILE_GPU_CPU("Update Models");
_modelsBuffer->Flush(context);
}
// Perform batched chunks rasterization
if (!anyDraw)
{
@@ -533,6 +527,13 @@ bool GlobalSignDistanceFieldPass::Render(RenderContext& renderContext, GPUContex
}
}
// Send models data to the GPU
if (chunks.Count() != 0)
{
PROFILE_GPU_CPU("Update Models");
_modelsBuffer->Flush(context);
}
// Rasterize non-empty chunk (first layer so can override existing chunk data)
for (const auto& e : chunks)
{