From bdabcd5e43e71fab5c99fdadbef3a81c57414b6b Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 7 May 2026 09:03:22 +0200 Subject: [PATCH] Fix regression to properly resume render pass when flushing barriers mid-pass 141a8de0da21202d09c16c020988992c5bb1f2c1 --- Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp | 6 ++++-- Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp index b1c901786..277272181 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp @@ -446,7 +446,7 @@ void GPUContextVulkan::BeginRenderPass() if (_drawPass && _drawPass->RenderTargetsActions) { GPUDrawPassAction action = _drawPass->RenderTargetsActions[i]; - if ((uint32)action & (uint32)GPUDrawPassAction::Clear) + if ((uint32)action & (uint32)GPUDrawPassAction::Clear && _drawPassCanClear) layout.LoadClear |= mask; else if (((uint32)action & (uint32)GPUDrawPassAction::LoadMask) == 0) layout.LoadDontCare |= mask; @@ -480,7 +480,7 @@ void GPUContextVulkan::BeginRenderPass() if (_drawPass) { GPUDrawPassAction action = _drawPass->DepthAction; - if ((uint32)action & (uint32)GPUDrawPassAction::Clear) + if ((uint32)action & (uint32)GPUDrawPassAction::Clear && _drawPassCanClear) layout.LoadClear |= mask; else if (((uint32)action & (uint32)GPUDrawPassAction::LoadMask) == 0) layout.LoadDontCare |= mask; @@ -516,6 +516,7 @@ void GPUContextVulkan::BeginRenderPass() framebufferKey.RenderPass = renderPass; auto framebuffer = _device->GetOrCreateFramebuffer(framebufferKey, layout.Extent, layout.Layers); _renderPass = renderPass; + _drawPassCanClear = false; FlushBarriers(); @@ -2009,6 +2010,7 @@ void GPUContextVulkan::BeginDrawPass(GPUDrawPass& pass) _drawPass = &pass; _rtDirtyFlag = true; _psDirtyFlag = true; + _drawPassCanClear = true; _rtCount = pass.RenderTargetsCount; _rtDepth = (GPUTextureViewVulkan*)pass.DepthBuffer; Platform::MemoryCopy(_rtHandles, pass.RenderTargets, pass.RenderTargetsCount * sizeof(void*)); diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h index 2276b0a3f..2a1847098 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.h @@ -84,6 +84,7 @@ private: int32 _psDirtyFlag : 1; int32 _rtDirtyFlag : 1; int32 _cbDirtyFlag : 1; + int32 _drawPassCanClear : 1; int32 _depthBoundsEnable : 1; int32 _rtCount;