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

@@ -95,6 +95,7 @@ GPUTexture* RenderBuffers::RequestHalfResDepth(GPUContext* context)
auto tempDesc = GPUTextureDescription::New2D(halfDepthWidth, halfDepthHeight, halfDepthFormat);
tempDesc.Flags = GPUTextureFlags::ShaderResource | GPUTextureFlags::DepthStencil;
HalfResDepth = RenderTargetPool::Get(tempDesc);
RENDER_TARGET_POOL_SET_NAME(HalfResDepth, "HalfResDepth");
}
else if (HalfResDepth->Width() != halfDepthWidth || HalfResDepth->Height() != halfDepthHeight || HalfResDepth->Format() != halfDepthFormat)
{
@@ -103,6 +104,7 @@ GPUTexture* RenderBuffers::RequestHalfResDepth(GPUContext* context)
auto tempDesc = GPUTextureDescription::New2D(halfDepthWidth, halfDepthHeight, halfDepthFormat);
tempDesc.Flags = GPUTextureFlags::ShaderResource | GPUTextureFlags::DepthStencil;
HalfResDepth = RenderTargetPool::Get(tempDesc);
RENDER_TARGET_POOL_SET_NAME(HalfResDepth, "HalfResDepth");
}
// Generate depth

View File

@@ -30,3 +30,10 @@ public:
/// <param name="rt">The reference to temporary target to release.</param>
API_FUNCTION() static void Release(GPUTexture* rt);
};
// Utility to set name to the pooled render target (compiled-put in Release builds)
#if GPU_ENABLE_RESOURCE_NAMING
#define RENDER_TARGET_POOL_SET_NAME(rt, name) rt->SetName(TEXT(name));
#else
#define RENDER_TARGET_POOL_SET_NAME(rt, name)
#endif