From f41e7f044a84efd01467211b3916d1071483bd77 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 8 Sep 2024 23:15:48 +0200 Subject: [PATCH] Fix SceneLinearDepth texture using wrong size --- src/common/rendering/vulkan/textures/vk_renderbuffers.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/rendering/vulkan/textures/vk_renderbuffers.cpp b/src/common/rendering/vulkan/textures/vk_renderbuffers.cpp index 45005cb5a..c9c602006 100644 --- a/src/common/rendering/vulkan/textures/vk_renderbuffers.cpp +++ b/src/common/rendering/vulkan/textures/vk_renderbuffers.cpp @@ -78,6 +78,12 @@ void VkRenderBuffers::BeginFrame(int width, int height, int sceneWidth, int scen if (width != mWidth || height != mHeight || mSamples != samples) CreateScene(width, height, samples); + if (sceneWidth != mSceneWidth || sceneHeight != mSceneHeight) + { + SceneLinearDepth.Reset(fb); + CreateSceneLinearDepth(std::max(sceneWidth, 1), std::max(sceneHeight, 1)); + } + mWidth = width; mHeight = height; mSamples = samples; @@ -174,13 +180,11 @@ void VkRenderBuffers::CreateScene(int width, int height, VkSampleCountFlagBits s SceneDepthStencil.Reset(fb); SceneNormal.Reset(fb); SceneFog.Reset(fb); - SceneLinearDepth.Reset(fb); CreateSceneColor(width, height, samples); CreateSceneDepthStencil(width, height, samples); CreateSceneNormal(width, height, samples); CreateSceneFog(width, height, samples); - CreateSceneLinearDepth(width, height); VkImageTransition() .AddImage(&SceneColor, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, true)