Optimize GPU textures and buffers uploads with a batched memory barrier

This commit is contained in:
Wojtek Figat
2025-09-03 22:11:26 +02:00
parent 212b0de29b
commit f1c4fd464a
4 changed files with 14 additions and 2 deletions

View File

@@ -15,6 +15,7 @@
#include "Engine/Content/Content.h"
#include "Engine/Graphics/GPUContext.h"
#include "Engine/Graphics/GPUDevice.h"
#include "Engine/Graphics/GPUPass.h"
#include "Engine/Graphics/RenderTask.h"
#include "Engine/Graphics/RenderBuffers.h"
#include "Engine/Graphics/RenderTargetPool.h"
@@ -939,6 +940,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
// Send objects data to the GPU
{
PROFILE_GPU_CPU_NAMED("Update Objects");
GPUMemoryPass pass(context);
surfaceAtlasData.ObjectsBuffer.Flush(context);
surfaceAtlasData.ObjectsListBuffer.Flush(context);
}

View File

@@ -2,6 +2,7 @@
#include "Renderer.h"
#include "Engine/Graphics/GPUContext.h"
#include "Engine/Graphics/GPUPass.h"
#include "Engine/Graphics/RenderTargetPool.h"
#include "Engine/Graphics/RenderBuffers.h"
#include "Engine/Graphics/RenderTask.h"
@@ -523,6 +524,7 @@ void RenderInner(SceneRenderTask* task, RenderContext& renderContext, RenderCont
JobSystem::Wait(buildObjectsBufferJob);
{
PROFILE_CPU_NAMED("FlushObjectsBuffer");
GPUMemoryPass pass(context);
for (auto& e : renderContextBatch.Contexts)
e.List->ObjectBuffer.Flush(context);
}