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

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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 };

View File

@@ -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,6 +140,7 @@ 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);

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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();

View File

@@ -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()

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);

View File

@@ -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)

View File

@@ -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

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;

View File

@@ -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;

View File

@@ -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.");

View File

@@ -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);