Add pooled render targets naming for easier GPU memory usage debugging

This commit is contained in:
Wojciech Figat
2022-12-09 11:26:35 +01:00
parent d544c43744
commit b33ce8d264
25 changed files with 69 additions and 4 deletions

View File

@@ -304,6 +304,7 @@ void MotionBlurPass::Render(RenderContext& renderContext, GPUTexture*& input, GP
// Downscale motion vectors texture down to 1/2 (with max velocity calculation 2x2 kernel)
auto rtDesc = GPUTextureDescription::New2D(motionVectorsWidth / 2, motionVectorsHeight / 2, _motionVectorsFormat);
const auto vMaxBuffer2 = RenderTargetPool::Get(rtDesc);
RENDER_TARGET_POOL_SET_NAME(vMaxBuffer2, "MotionBlur.VMax2");
context->SetRenderTarget(vMaxBuffer2->View());
context->SetViewportAndScissors((float)rtDesc.Width, (float)rtDesc.Height);
context->BindSR(0, motionVectors->View());
@@ -314,6 +315,7 @@ void MotionBlurPass::Render(RenderContext& renderContext, GPUTexture*& input, GP
rtDesc.Width /= 2;
rtDesc.Height /= 2;
const auto vMaxBuffer4 = RenderTargetPool::Get(rtDesc);
RENDER_TARGET_POOL_SET_NAME(vMaxBuffer4, "MotionBlur.VMax4");
context->ResetRenderTarget();
context->SetRenderTarget(vMaxBuffer4->View());
context->SetViewportAndScissors((float)rtDesc.Width, (float)rtDesc.Height);
@@ -328,6 +330,7 @@ void MotionBlurPass::Render(RenderContext& renderContext, GPUTexture*& input, GP
rtDesc.Width /= 2;
rtDesc.Height /= 2;
const auto vMaxBuffer8 = RenderTargetPool::Get(rtDesc);
RENDER_TARGET_POOL_SET_NAME(vMaxBuffer8, "MotionBlur.VMax8");
context->ResetRenderTarget();
context->SetRenderTarget(vMaxBuffer8->View());
context->SetViewportAndScissors((float)rtDesc.Width, (float)rtDesc.Height);
@@ -342,6 +345,7 @@ void MotionBlurPass::Render(RenderContext& renderContext, GPUTexture*& input, GP
rtDesc.Width = Math::Max(motionVectorsWidth / tileSize, 1);
rtDesc.Height = Math::Max(motionVectorsHeight / tileSize, 1);
auto vMaxBuffer = RenderTargetPool::Get(rtDesc);
RENDER_TARGET_POOL_SET_NAME(vMaxBuffer, "MotionBlur.VMax");
context->ResetRenderTarget();
context->SetRenderTarget(vMaxBuffer->View());
context->SetViewportAndScissors((float)rtDesc.Width, (float)rtDesc.Height);
@@ -355,6 +359,7 @@ void MotionBlurPass::Render(RenderContext& renderContext, GPUTexture*& input, GP
// Extract maximum velocities for the tiles based on their neighbors
context->ResetRenderTarget();
auto vMaxNeighborBuffer = RenderTargetPool::Get(rtDesc);
RENDER_TARGET_POOL_SET_NAME(vMaxBuffer, "MotionBlur.VMaxNeighbor");
context->SetRenderTarget(vMaxNeighborBuffer->View());
context->BindSR(0, vMaxBuffer->View());
context->SetState(_psNeighborMax);