From ce2163eb9352b6d980662e5fd97ab894fa7cc5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 17 Jan 2024 21:41:04 +0100 Subject: [PATCH] Vulkan MSAA: Avoid creating backbuffer renderpasses with the wrong sample count, oops --- Common/GPU/Vulkan/VulkanFramebuffer.h | 2 +- Common/GPU/Vulkan/VulkanQueueRunner.cpp | 2 +- Common/GPU/Vulkan/VulkanRenderManager.cpp | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Common/GPU/Vulkan/VulkanFramebuffer.h b/Common/GPU/Vulkan/VulkanFramebuffer.h index b807de8803..7f968833cf 100644 --- a/Common/GPU/Vulkan/VulkanFramebuffer.h +++ b/Common/GPU/Vulkan/VulkanFramebuffer.h @@ -155,7 +155,7 @@ public: private: // TODO: Might be better off with a hashmap once the render pass type count grows really large.. VkRenderPass pass[(size_t)RenderPassType::TYPE_COUNT]{}; - VkSampleCountFlagBits sampleCounts[(size_t)RenderPassType::TYPE_COUNT]; + VkSampleCountFlagBits sampleCounts[(size_t)RenderPassType::TYPE_COUNT]{}; RPKey key_; }; diff --git a/Common/GPU/Vulkan/VulkanQueueRunner.cpp b/Common/GPU/Vulkan/VulkanQueueRunner.cpp index 29c4350bdb..327bdf332e 100644 --- a/Common/GPU/Vulkan/VulkanQueueRunner.cpp +++ b/Common/GPU/Vulkan/VulkanQueueRunner.cpp @@ -374,7 +374,7 @@ void VulkanQueueRunner::RunSteps(std::vector &steps, int curFrame, Fr // When stepping in the GE debugger, we can end up here multiple times in a "frame". // So only acquire once. if (!frameData.hasAcquired) { - frameData.AcquireNextImage(vulkan_, frameDataShared); + frameData.AcquireNextImage(vulkan_); SetBackbuffer(framebuffers_[frameData.curSwapchainImage], swapchainImages_[frameData.curSwapchainImage].image); } diff --git a/Common/GPU/Vulkan/VulkanRenderManager.cpp b/Common/GPU/Vulkan/VulkanRenderManager.cpp index 905b3263a5..ff79212835 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.cpp +++ b/Common/GPU/Vulkan/VulkanRenderManager.cpp @@ -800,6 +800,10 @@ VKRGraphicsPipeline *VulkanRenderManager::CreateGraphicsPipeline(VKRGraphicsPipe continue; } + if (rpType == RenderPassType::BACKBUFFER) { + sampleCount = VK_SAMPLE_COUNT_1_BIT; + } + pipeline->pipeline[i] = Promise::CreateEmpty(); compileQueue_.push_back(CompileQueueEntry(pipeline, compatibleRenderPass->Get(vulkan_, rpType, sampleCount), rpType, sampleCount)); needsCompile = true;