diff --git a/Source/Engine/Graphics/RenderBuffers.cpp b/Source/Engine/Graphics/RenderBuffers.cpp index 6edceab8e..345b666cf 100644 --- a/Source/Engine/Graphics/RenderBuffers.cpp +++ b/Source/Engine/Graphics/RenderBuffers.cpp @@ -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 diff --git a/Source/Engine/Graphics/RenderTargetPool.h b/Source/Engine/Graphics/RenderTargetPool.h index cba7a325d..aeb9766a8 100644 --- a/Source/Engine/Graphics/RenderTargetPool.h +++ b/Source/Engine/Graphics/RenderTargetPool.h @@ -30,3 +30,10 @@ public: /// The reference to temporary target to release. 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 diff --git a/Source/Engine/Render2D/Render2D.cpp b/Source/Engine/Render2D/Render2D.cpp index 200a77121..80087eaec 100644 --- a/Source/Engine/Render2D/Render2D.cpp +++ b/Source/Engine/Render2D/Render2D.cpp @@ -1070,6 +1070,8 @@ void DrawBatch(int32 startIndex, int32 count) auto desc = GPUTextureDescription::New2D(renderTargetWidth, renderTargetHeight, PS_Blur_Format); auto blurA = RenderTargetPool::Get(desc); auto blurB = RenderTargetPool::Get(desc); + RENDER_TARGET_POOL_SET_NAME(blurA, "Render2D.BlurA"); + RENDER_TARGET_POOL_SET_NAME(blurB, "Render2D.BlurB"); // Prepare blur data BlurData data; diff --git a/Source/Engine/Renderer/AmbientOcclusionPass.cpp b/Source/Engine/Renderer/AmbientOcclusionPass.cpp index 6be56e534..a6c5d1062 100644 --- a/Source/Engine/Renderer/AmbientOcclusionPass.cpp +++ b/Source/Engine/Renderer/AmbientOcclusionPass.cpp @@ -307,13 +307,17 @@ void AmbientOcclusionPass::InitRTs(const RenderContext& renderContext) // TODO: maybe instead of using whole mip chain request only SSAO_DEPTH_MIP_LEVELS? tempDesc = GPUTextureDescription::New2D((int32)m_halfSizeX, (int32)m_halfSizeY, 0, SSAO_DEPTH_FORMAT, GPUTextureFlags::ShaderResource | GPUTextureFlags::RenderTarget | GPUTextureFlags::PerMipViews); m_halfDepths[i] = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(m_halfDepths[i], "SSAO.HalfDepth"); } tempDesc = GPUTextureDescription::New2D((int32)m_halfSizeX, (int32)m_halfSizeY, SSAO_AO_RESULT_FORMAT); m_pingPongHalfResultA = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(m_pingPongHalfResultA, "SSAO.ResultsHalfA"); tempDesc = GPUTextureDescription::New2D((int32)m_halfSizeX, (int32)m_halfSizeY, SSAO_AO_RESULT_FORMAT); m_pingPongHalfResultB = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(m_pingPongHalfResultA, "SSAO.ResultsHalfB"); tempDesc = GPUTextureDescription::New2D((int32)m_halfSizeX, (int32)m_halfSizeY, SSAO_AO_RESULT_FORMAT, GPUTextureFlags::ShaderResource | GPUTextureFlags::RenderTarget, 4); m_finalResults = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(m_finalResults, "SSAO.Results"); } void AmbientOcclusionPass::ReleaseRTs(const RenderContext& renderContext) diff --git a/Source/Engine/Renderer/AntiAliasing/SMAA.cpp b/Source/Engine/Renderer/AntiAliasing/SMAA.cpp index 4eafc89ee..95ad564c8 100644 --- a/Source/Engine/Renderer/AntiAliasing/SMAA.cpp +++ b/Source/Engine/Renderer/AntiAliasing/SMAA.cpp @@ -112,6 +112,8 @@ void SMAA::Render(RenderContext& renderContext, GPUTexture* input, GPUTextureVie const auto tempDesc = GPUTextureDescription::New2D((int32)renderContext.View.ScreenSize.X, (int32)renderContext.View.ScreenSize.Y, PixelFormat::R8G8B8A8_UNorm); auto edges = RenderTargetPool::Get(tempDesc); auto weights = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(edges, "SMAA.Edges"); + RENDER_TARGET_POOL_SET_NAME(weights,"SMAA.Weights"); // Bind constants Data data; diff --git a/Source/Engine/Renderer/AntiAliasing/TAA.cpp b/Source/Engine/Renderer/AntiAliasing/TAA.cpp index 08ca199f2..63038ae27 100644 --- a/Source/Engine/Renderer/AntiAliasing/TAA.cpp +++ b/Source/Engine/Renderer/AntiAliasing/TAA.cpp @@ -92,6 +92,7 @@ void TAA::Render(const RenderContext& renderContext, GPUTexture* input, GPUTextu { // Missing temporal buffer renderContext.Buffers->TemporalAA = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(renderContext.Buffers->TemporalAA, "TemporalAA"); resetHistory = true; } else if (renderContext.Buffers->TemporalAA->Width() != tempDesc.Width || renderContext.Buffers->TemporalAA->Height() != tempDesc.Height) @@ -99,10 +100,12 @@ void TAA::Render(const RenderContext& renderContext, GPUTexture* input, GPUTextu // Wrong size temporal buffer RenderTargetPool::Release(renderContext.Buffers->TemporalAA); renderContext.Buffers->TemporalAA = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(renderContext.Buffers->TemporalAA, "TemporalAA"); resetHistory = true; } auto inputHistory = renderContext.Buffers->TemporalAA; const auto outputHistory = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(outputHistory, "TemporalAA"); // Duplicate the current frame to the history buffer if need to reset the temporal history float blendStrength = 1.0f; diff --git a/Source/Engine/Renderer/ColorGradingPass.cpp b/Source/Engine/Renderer/ColorGradingPass.cpp index 64a6ed631..d9fb645de 100644 --- a/Source/Engine/Renderer/ColorGradingPass.cpp +++ b/Source/Engine/Renderer/ColorGradingPass.cpp @@ -148,6 +148,7 @@ GPUTexture* ColorGradingPass::RenderLUT(RenderContext& renderContext) lutDesc = GPUTextureDescription::New2D(LutSize * LutSize, LutSize, 1, _lutFormat); } const auto lut = RenderTargetPool::Get(lutDesc); + RENDER_TARGET_POOL_SET_NAME(lut, "ColorGrading.LUT"); // Prepare the parameters Data data; diff --git a/Source/Engine/Renderer/DepthOfFieldPass.cpp b/Source/Engine/Renderer/DepthOfFieldPass.cpp index f80441d00..e3a76ad84 100644 --- a/Source/Engine/Renderer/DepthOfFieldPass.cpp +++ b/Source/Engine/Renderer/DepthOfFieldPass.cpp @@ -288,6 +288,7 @@ GPUTexture* DepthOfFieldPass::Render(RenderContext& renderContext, GPUTexture* i // Depth/blur generation pass auto tempDesc = GPUTextureDescription::New2D(cocWidth, cocHeight, DOF_DEPTH_BLUR_FORMAT, GPUTextureFlags::ShaderResource | GPUTextureFlags::RenderTarget | GPUTextureFlags::UnorderedAccess); GPUTexture* depthBlurTarget = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(depthBlurTarget, "DOF.Blur"); context->SetViewportAndScissors((float)cocWidth, (float)cocHeight); context->SetRenderTarget(*depthBlurTarget); context->BindSR(0, depthBuffer); @@ -299,6 +300,7 @@ GPUTexture* DepthOfFieldPass::Render(RenderContext& renderContext, GPUTexture* i auto dofFormat = renderContext.Buffers->GetOutputFormat(); tempDesc = GPUTextureDescription::New2D(dofWidth, dofHeight, dofFormat); GPUTexture* dofInput = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(dofInput, "DOF.Output"); // Do the bokeh point generation, or just do a copy if disabled bool isBokehGenerationEnabled = dofSettings.BokehEnabled && _platformSupportsBokeh && dofSettings.BokehBrightness > 0.0f && dofSettings.BokehSize > 0.0f; @@ -354,6 +356,8 @@ GPUTexture* DepthOfFieldPass::Render(RenderContext& renderContext, GPUTexture* i tempDesc = GPUTextureDescription::New2D(dofWidth, dofHeight, dofFormat, GPUTextureFlags::ShaderResource | GPUTextureFlags::RenderTarget | GPUTextureFlags::UnorderedAccess); auto dofTargetH = RenderTargetPool::Get(tempDesc); auto dofTargetV = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(dofTargetH, "DOF.TargetH"); + RENDER_TARGET_POOL_SET_NAME(dofTargetV, "DOF.TargetV"); // Horizontal pass context->BindSR(0, dofInput); @@ -400,6 +404,7 @@ GPUTexture* DepthOfFieldPass::Render(RenderContext& renderContext, GPUTexture* i { tempDesc = GPUTextureDescription::New2D(bokehTargetWidth, bokehTargetHeight, dofFormat); auto bokehTarget = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(depthBlurTarget, "DOF.Bokeh"); context->Clear(*bokehTarget, Color::Black); { @@ -423,6 +428,7 @@ GPUTexture* DepthOfFieldPass::Render(RenderContext& renderContext, GPUTexture* i // Composite the bokeh rendering results with the depth of field result tempDesc = GPUTextureDescription::New2D(dofWidth, dofHeight, dofFormat); auto compositeTarget = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(depthBlurTarget, "DOF.Composite"); context->BindSR(0, bokehTarget); context->BindSR(1, dofOutput); context->SetRenderTarget(*compositeTarget); diff --git a/Source/Engine/Renderer/Editor/QuadOverdrawPass.cpp b/Source/Engine/Renderer/Editor/QuadOverdrawPass.cpp index 3033e4afe..6b8af8ea3 100644 --- a/Source/Engine/Renderer/Editor/QuadOverdrawPass.cpp +++ b/Source/Engine/Renderer/Editor/QuadOverdrawPass.cpp @@ -31,6 +31,9 @@ void QuadOverdrawPass::Render(RenderContext& renderContext, GPUContext* context, auto lockTexture = RenderTargetPool::Get(tempDesc); auto overdrawTexture = RenderTargetPool::Get(tempDesc); auto liveCountTexture = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(lockTexture, "QuadOverdraw.Lock"); + RENDER_TARGET_POOL_SET_NAME(overdrawTexture, "QuadOverdraw.Overdraw"); + RENDER_TARGET_POOL_SET_NAME(liveCountTexture, "QuadOverdraw.LiveCount"); // Clear buffers uint32 clearValueUINT[4] = { 0 }; diff --git a/Source/Engine/Renderer/EyeAdaptationPass.cpp b/Source/Engine/Renderer/EyeAdaptationPass.cpp index ea5013a3d..1cbf46e35 100644 --- a/Source/Engine/Renderer/EyeAdaptationPass.cpp +++ b/Source/Engine/Renderer/EyeAdaptationPass.cpp @@ -118,6 +118,7 @@ void EyeAdaptationPass::Render(RenderContext& renderContext, GPUTexture* colorBu previousLuminanceMap = nullptr; } GPUTexture* currentLuminanceMap = RenderTargetPool::Get(GPUTextureDescription::New2D(1, 1, PixelFormat::R16_Float)); + RENDER_TARGET_POOL_SET_NAME(currentLuminanceMap, "EyeAdaptation.LuminanceMap"); switch (mode) { @@ -139,7 +140,8 @@ void EyeAdaptationPass::Render(RenderContext& renderContext, GPUTexture* colorBu { const Int2 luminanceMapSize(colorBuffer->Width() / 2, colorBuffer->Height() / 2); GPUTexture* luminanceMap = RenderTargetPool::Get(GPUTextureDescription::New2D(luminanceMapSize.X, luminanceMapSize.Y, 0, PixelFormat::R16_Float, GPUTextureFlags::ShaderResource | GPUTextureFlags::RenderTarget | GPUTextureFlags::PerMipViews)); - + RENDER_TARGET_POOL_SET_NAME(luminanceMap, "EyeAdaptation.LuminanceMap"); + // Calculate the luminance for the scene color context->BindSR(0, *colorBuffer); context->SetRenderTarget(luminanceMap->View(0, 0)); diff --git a/Source/Engine/Renderer/ForwardPass.cpp b/Source/Engine/Renderer/ForwardPass.cpp index 214d725d9..fd48ef64e 100644 --- a/Source/Engine/Renderer/ForwardPass.cpp +++ b/Source/Engine/Renderer/ForwardPass.cpp @@ -109,6 +109,7 @@ void ForwardPass::Render(RenderContext& renderContext, GPUTexture* input, GPUTex const int32 distortionHeight = height; const auto tempDesc = GPUTextureDescription::New2D(distortionWidth, distortionHeight, Distortion_Pass_Output_Format); auto distortionRT = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(distortionRT, "Forward.Distortion"); // Clear distortion vectors context->Clear(distortionRT->View(), Color::Transparent); diff --git a/Source/Engine/Renderer/GBufferPass.cpp b/Source/Engine/Renderer/GBufferPass.cpp index 2d5f6eadf..3aa4c97d5 100644 --- a/Source/Engine/Renderer/GBufferPass.cpp +++ b/Source/Engine/Renderer/GBufferPass.cpp @@ -292,6 +292,7 @@ GPUTextureView* GBufferPass::RenderSkybox(RenderContext& renderContext, GPUConte skyboxData.Skybox = RenderTargetPool::Get(desc); if (!skyboxData.Skybox) return nullptr; + RENDER_TARGET_POOL_SET_NAME(skyboxData.Skybox, "GBuffer.Skybox"); dirty = true; } diff --git a/Source/Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.cpp b/Source/Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.cpp index ecd104bd4..25c98678d 100644 --- a/Source/Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.cpp +++ b/Source/Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.cpp @@ -370,7 +370,7 @@ bool DynamicDiffuseGlobalIlluminationPass::RenderInner(RenderContext& renderCont // Allocate probes textures uint64 memUsage = 0; auto desc = GPUTextureDescription::New2D(probesCountTotalX, probesCountTotalY, PixelFormat::Unknown); -#define INIT_TEXTURE(texture, format, width, height) desc.Format = format; desc.Width = width; desc.Height = height; ddgiData.texture = RenderTargetPool::Get(desc); if (!ddgiData.texture) return true; memUsage += ddgiData.texture->GetMemoryUsage() +#define INIT_TEXTURE(texture, format, width, height) desc.Format = format; desc.Width = width; desc.Height = height; ddgiData.texture = RenderTargetPool::Get(desc); if (!ddgiData.texture) return true; memUsage += ddgiData.texture->GetMemoryUsage(); RENDER_TARGET_POOL_SET_NAME(ddgiData.texture, "DDGI." #texture) desc.Flags = GPUTextureFlags::ShaderResource | GPUTextureFlags::UnorderedAccess; INIT_TEXTURE(ProbesTrace, PixelFormat::R16G16B16A16_Float, probeRaysCount, Math::Min(probesCountCascade, DDGI_TRACE_RAYS_PROBES_COUNT_LIMIT)); INIT_TEXTURE(ProbesState, PixelFormat::R8G8B8A8_SNorm, probesCountTotalX, probesCountTotalY); diff --git a/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp b/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp index d6901b7ee..68c9878e5 100644 --- a/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp +++ b/Source/Engine/Renderer/GI/GlobalSurfaceAtlasPass.cpp @@ -398,7 +398,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co auto desc = GPUTextureDescription::New2D(resolution, resolution, PixelFormat::Unknown); uint64 memUsage = 0; // TODO: try using BC4/BC5/BC7 block compression for Surface Atlas (eg. for Tiles material properties) -#define INIT_ATLAS_TEXTURE(texture, format) desc.Format = format; surfaceAtlasData.texture = RenderTargetPool::Get(desc); if (!surfaceAtlasData.texture) return true; memUsage += surfaceAtlasData.texture->GetMemoryUsage() +#define INIT_ATLAS_TEXTURE(texture, format) desc.Format = format; surfaceAtlasData.texture = RenderTargetPool::Get(desc); if (!surfaceAtlasData.texture) return true; memUsage += surfaceAtlasData.texture->GetMemoryUsage(); RENDER_TARGET_POOL_SET_NAME(surfaceAtlasData.texture, "GlobalSurfaceAtlas." #texture); INIT_ATLAS_TEXTURE(AtlasEmissive, PixelFormat::R11G11B10_Float); INIT_ATLAS_TEXTURE(AtlasGBuffer0, GBUFFER0_FORMAT); INIT_ATLAS_TEXTURE(AtlasGBuffer1, GBUFFER1_FORMAT); diff --git a/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp b/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp index 48427b8ed..6e0802bd6 100644 --- a/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp +++ b/Source/Engine/Renderer/GlobalSignDistanceFieldPass.cpp @@ -435,6 +435,7 @@ bool GlobalSignDistanceFieldPass::Render(RenderContext& renderContext, GPUContex texture = RenderTargetPool::Get(desc); if (!texture) return true; + RENDER_TARGET_POOL_SET_NAME(texture, "GlobalSDF.Cascade"); } } desc.Width = resolutionMip * cascadesCount; @@ -451,6 +452,7 @@ bool GlobalSignDistanceFieldPass::Render(RenderContext& renderContext, GPUContex texture = RenderTargetPool::Get(desc); if (!texture) return true; + RENDER_TARGET_POOL_SET_NAME(texture, "GlobalSDF.Cascade"); } } uint64 memoryUsage = sdfData.Texture->GetMemoryUsage() + sdfData.TextureMip->GetMemoryUsage(); @@ -840,6 +842,7 @@ bool GlobalSignDistanceFieldPass::Render(RenderContext& renderContext, GPUContex tmpMip = RenderTargetPool::Get(desc); if (!tmpMip) return true; + RENDER_TARGET_POOL_SET_NAME(tmpMip, "GlobalSDF.Mip"); } GPUTextureView* tmpMipView = tmpMip->ViewVolume(); diff --git a/Source/Engine/Renderer/LightPass.cpp b/Source/Engine/Renderer/LightPass.cpp index 0d7fccb47..f55cc115b 100644 --- a/Source/Engine/Renderer/LightPass.cpp +++ b/Source/Engine/Renderer/LightPass.cpp @@ -234,6 +234,7 @@ void LightPass::RenderLight(RenderContextBatch& renderContextBatch, GPUTextureVi if (!shadowMask) { \ auto rtDesc = GPUTextureDescription::New2D(renderContext.Buffers->GetWidth(), renderContext.Buffers->GetHeight(), _shadowMaskFormat); \ shadowMask = RenderTargetPool::Get(rtDesc); \ + RENDER_TARGET_POOL_SET_NAME(shadowMask, "ShadowMask"); \ } \ auto shadowMaskView = shadowMask->View() diff --git a/Source/Engine/Renderer/MotionBlurPass.cpp b/Source/Engine/Renderer/MotionBlurPass.cpp index 168d35e73..301d0a3eb 100644 --- a/Source/Engine/Renderer/MotionBlurPass.cpp +++ b/Source/Engine/Renderer/MotionBlurPass.cpp @@ -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); diff --git a/Source/Engine/Renderer/PostProcessingPass.cpp b/Source/Engine/Renderer/PostProcessingPass.cpp index 99d1ccd0e..4e75e21fd 100644 --- a/Source/Engine/Renderer/PostProcessingPass.cpp +++ b/Source/Engine/Renderer/PostProcessingPass.cpp @@ -310,8 +310,10 @@ void PostProcessingPass::Render(RenderContext& renderContext, GPUTexture* input, auto tempDesc = GPUTextureDescription::New2D(w2, h2, 0, output->Format(), GPUTextureFlags::ShaderResource | GPUTextureFlags::RenderTarget | GPUTextureFlags::PerMipViews); auto bloomTmp1 = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(bloomTmp1, "PostProcessing.Bloom"); // TODO: bloomTmp2 could be quarter res because we don't use it's first mip auto bloomTmp2 = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(bloomTmp2, "PostProcessing.Bloom"); // Check if use bloom if (useBloom) diff --git a/Source/Engine/Renderer/ReflectionsPass.cpp b/Source/Engine/Renderer/ReflectionsPass.cpp index 952f45e54..959145962 100644 --- a/Source/Engine/Renderer/ReflectionsPass.cpp +++ b/Source/Engine/Renderer/ReflectionsPass.cpp @@ -393,7 +393,7 @@ void ReflectionsPass::Render(RenderContext& renderContext, GPUTextureView* light auto tempDesc = GPUTextureDescription::New2D(renderContext.Buffers->GetWidth(), renderContext.Buffers->GetHeight(), PixelFormat::R11G11B10_Float); auto reflectionsBuffer = RenderTargetPool::Get(tempDesc); - + RENDER_TARGET_POOL_SET_NAME(reflectionsBuffer, "Reflections"); context->Clear(*reflectionsBuffer, Color::Black); // Reflection Probes pass diff --git a/Source/Engine/Renderer/RenderList.cpp b/Source/Engine/Renderer/RenderList.cpp index 95abc11be..53a5d4dc1 100644 --- a/Source/Engine/Renderer/RenderList.cpp +++ b/Source/Engine/Renderer/RenderList.cpp @@ -234,6 +234,10 @@ void RenderList::RunPostFxPass(GPUContext* context, RenderContext& renderContext auto tempDesc = inputOutput->GetDescription(); auto temp = needTempTarget ? RenderTargetPool::Get(tempDesc) : nullptr; + if (needTempTarget) + { + RENDER_TARGET_POOL_SET_NAME(temp, "RenderList.RunPostFxPassTemp"); + } auto input = inputOutput; auto output = temp; diff --git a/Source/Engine/Renderer/Renderer.cpp b/Source/Engine/Renderer/Renderer.cpp index 0a2aefab5..34c32479e 100644 --- a/Source/Engine/Renderer/Renderer.cpp +++ b/Source/Engine/Renderer/Renderer.cpp @@ -388,6 +388,7 @@ void RenderInner(SceneRenderTask* task, RenderContext& renderContext, RenderCont auto outputFormat = renderContext.Buffers->GetOutputFormat(); auto tempDesc = GPUTextureDescription::New2D(renderContext.Buffers->GetWidth(), renderContext.Buffers->GetHeight(), outputFormat); auto lightBuffer = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(lightBuffer, "Lighting"); #if USE_EDITOR if (renderContext.View.Mode == ViewMode::QuadOverdraw) diff --git a/Source/Engine/Renderer/ScreenSpaceReflectionsPass.cpp b/Source/Engine/Renderer/ScreenSpaceReflectionsPass.cpp index 4464ce599..ce7e6e3f3 100644 --- a/Source/Engine/Renderer/ScreenSpaceReflectionsPass.cpp +++ b/Source/Engine/Renderer/ScreenSpaceReflectionsPass.cpp @@ -195,12 +195,16 @@ void ScreenSpaceReflectionsPass::Render(RenderContext& renderContext, GPUTexture // Prepare buffers auto tempDesc = GPUTextureDescription::New2D(width / 2, height / 2, 0, PixelFormat::R11G11B10_Float, GPUTextureFlags::ShaderResource | GPUTextureFlags::RenderTarget | GPUTextureFlags::PerMipViews); auto colorBuffer0 = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(colorBuffer0, "SSR.ColorBuffer0"); // TODO: maybe allocate colorBuffer1 smaller because mip0 is not used (the same as PostProcessingPass for Bloom), keep in sync to use the same buffer in frame auto colorBuffer1 = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(colorBuffer1, "SSR.ColorBuffer1"); tempDesc = GPUTextureDescription::New2D(traceWidth, traceHeight, PixelFormat::R16G16B16A16_Float); auto traceBuffer = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(traceBuffer, "SSR.TraceBuffer"); tempDesc = GPUTextureDescription::New2D(resolveWidth, resolveHeight, RESOLVE_PASS_OUTPUT_FORMAT); auto resolveBuffer = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(resolveBuffer, "SSR.ResolveBuffer"); // Pick effect settings int32 maxTraceSamples = 60; @@ -262,6 +266,7 @@ void ScreenSpaceReflectionsPass::Render(RenderContext& renderContext, GPUTexture RenderTargetPool::Release(buffers->TemporalSSR); tempDesc = GPUTextureDescription::New2D(temporalWidth, temporalHeight, RESOLVE_PASS_OUTPUT_FORMAT); buffers->TemporalSSR = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(buffers->TemporalSSR, "SSR.TemporalSSR"); } } else @@ -386,6 +391,7 @@ void ScreenSpaceReflectionsPass::Render(RenderContext& renderContext, GPUTexture { tempDesc = GPUTextureDescription::New2D(temporalWidth, temporalHeight, RESOLVE_PASS_OUTPUT_FORMAT); auto newTemporal = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(newTemporal, "SSR.TemporalSSR"); const auto oldTemporal = buffers->TemporalSSR; const auto motionVectors = buffers->MotionVectors; diff --git a/Source/Engine/Renderer/VolumetricFogPass.cpp b/Source/Engine/Renderer/VolumetricFogPass.cpp index 552103b14..44cad992b 100644 --- a/Source/Engine/Renderer/VolumetricFogPass.cpp +++ b/Source/Engine/Renderer/VolumetricFogPass.cpp @@ -254,6 +254,7 @@ GPUTextureView* VolumetricFogPass::GetLocalShadowedLightScattering(RenderContext ASSERT(renderContext.Buffers->LastFrameVolumetricFog == Engine::FrameCount); const GPUTextureDescription volumeDescRGB = GPUTextureDescription::New3D(_cache.GridSize, PixelFormat::R11G11B10_Float, GPUTextureFlags::RenderTarget | GPUTextureFlags::ShaderResource | GPUTextureFlags::UnorderedAccess); const auto texture = RenderTargetPool::Get(volumeDescRGB); + RENDER_TARGET_POOL_SET_NAME(texture, "VolumetricFog.LocalShadowedLightScattering"); renderContext.Buffers->LocalShadowedLightScattering = texture; context->Clear(texture->ViewVolume(), Color::Transparent); } @@ -496,8 +497,11 @@ void VolumetricFogPass::Render(RenderContext& renderContext) const GPUTextureDescription volumeDesc = GPUTextureDescription::New3D(cache.GridSize, PixelFormat::R16G16B16A16_Float, GPUTextureFlags::RenderTarget | GPUTextureFlags::ShaderResource | GPUTextureFlags::UnorderedAccess); const GPUTextureDescription volumeDescRGB = GPUTextureDescription::New3D(cache.GridSize, PixelFormat::R11G11B10_Float, GPUTextureFlags::RenderTarget | GPUTextureFlags::ShaderResource | GPUTextureFlags::UnorderedAccess); auto vBufferA = RenderTargetPool::Get(volumeDesc); + RENDER_TARGET_POOL_SET_NAME(vBufferA, "VolumetricFog.VBufferA"); auto vBufferB = RenderTargetPool::Get(volumeDescRGB); + RENDER_TARGET_POOL_SET_NAME(vBufferB, "VolumetricFog.VBufferB"); const auto lightScattering = RenderTargetPool::Get(volumeDesc); + RENDER_TARGET_POOL_SET_NAME(lightScattering, "VolumetricFog.LightScattering"); int32 groupCountX = Math::DivideAndRoundUp((int32)cache.GridSize.X, VolumetricFogGridInjectionGroupSize); int32 groupCountY = Math::DivideAndRoundUp((int32)cache.GridSize.Y, VolumetricFogGridInjectionGroupSize); @@ -703,6 +707,7 @@ void VolumetricFogPass::Render(RenderContext& renderContext) RenderTargetPool::Release(integratedLightScattering); } integratedLightScattering = RenderTargetPool::Get(volumeDesc); + RENDER_TARGET_POOL_SET_NAME(integratedLightScattering, "VolumetricFog.Integrated"); renderContext.Buffers->VolumetricFog = integratedLightScattering; } renderContext.Buffers->LastFrameVolumetricFog = Engine::FrameCount; diff --git a/Source/Engine/ShadowsOfMordor/Builder.DoWork.cpp b/Source/Engine/ShadowsOfMordor/Builder.DoWork.cpp index 1a04c6fa5..a14e5d9f3 100644 --- a/Source/Engine/ShadowsOfMordor/Builder.DoWork.cpp +++ b/Source/Engine/ShadowsOfMordor/Builder.DoWork.cpp @@ -186,8 +186,10 @@ bool ShadowsOfMordor::Builder::doWorkInner(DateTime buildStart) const int32 atlasSize = (int32)_scenes[_workerActiveSceneIndex]->GetSettings().AtlasSize; auto tempDesc = GPUTextureDescription::New2D(atlasSize, atlasSize, HemispheresFormatToPixelFormat[CACHE_POSITIONS_FORMAT]); _cachePositions = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(_cachePositions, "ShadowsOfMordor.Positions"); tempDesc.Format = HemispheresFormatToPixelFormat[CACHE_NORMALS_FORMAT]; _cacheNormals = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(_cachePositions, "ShadowsOfMordor.Normals"); if (_cachePositions == nullptr || _cacheNormals == nullptr) { LOG(Warning, "Failed to get textures for cache."); diff --git a/Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp b/Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp index ab210a451..b7ab9134f 100644 --- a/Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp +++ b/Source/Engine/ShadowsOfMordor/Builder.Jobs.cpp @@ -222,8 +222,10 @@ void ShadowsOfMordor::Builder::onJobRender(GPUContext* context) auto tempDesc = GPUTextureDescription::New2D(atlasSize, atlasSize, HemispheresFormatToPixelFormat[CACHE_POSITIONS_FORMAT]); auto resultPositions = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(_cachePositions, "ShadowsOfMordor.Positions"); tempDesc.Format = HemispheresFormatToPixelFormat[CACHE_NORMALS_FORMAT]; auto resultNormals = RenderTargetPool::Get(tempDesc); + RENDER_TARGET_POOL_SET_NAME(_cachePositions, "ShadowsOfMordor.Normals"); if (resultPositions == nullptr || resultNormals == nullptr) { RenderTargetPool::Release(resultPositions);