Fix crash when MultiScaler shader is not yet loaded on first frame

This commit is contained in:
Wojtek Figat
2026-02-11 13:32:41 +01:00
parent 885ee15767
commit a1096aaf92
2 changed files with 12 additions and 0 deletions

View File

@@ -84,6 +84,8 @@ GPUTexture* RenderBuffers::RequestHalfResDepth(GPUContext* context)
const auto currentFrame = Engine::FrameCount;
if (LastFrameHalfResDepth == currentFrame)
return HalfResDepth;
if (!MultiScaler::Instance()->IsReady())
return DepthBuffer;
const int32 halfDepthWidth = RenderTools::GetResolution(_width, ResolutionMode::Half);
const int32 halfDepthHeight = RenderTools::GetResolution(_height, ResolutionMode::Half);
@@ -119,6 +121,8 @@ GPUTexture* RenderBuffers::RequestHiZ(GPUContext* context, bool fullRes, int32 m
const auto currentFrame = Engine::FrameCount;
if (LastFrameHiZ == currentFrame)
return HiZ;
if (!MultiScaler::Instance()->IsReady())
return nullptr;
LastFrameHiZ = currentFrame;
// Allocate or resize buffer (with full mip-chain)

View File

@@ -262,6 +262,14 @@ GPUTexture* ScreenSpaceReflectionsPass::Render(RenderContext& renderContext, GPU
GPUTexture* depthBufferTrace = settings.DepthResolution == ResolutionMode::Half ? buffers->RequestHalfResDepth(context) : buffers->DepthBuffer;
data.DepthMips = 1;
#endif
if (depthBufferTrace == nullptr)
{
RenderTargetPool::Release(colorBuffer0);
RenderTargetPool::Release(colorBuffer1);
RenderTargetPool::Release(traceBuffer);
RenderTargetPool::Release(resolveBuffer);
return nullptr;
}
// Prepare constants
context->UpdateCB(cb, &data);