From 73cdbe204ea6c489362dade87a00d43383da53ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 10 Apr 2025 21:33:05 +0200 Subject: [PATCH] Fix Star Ocean with MSAA enabled: don't use the blit optimization, can't blit to multisampled images. --- Common/GPU/Vulkan/VulkanQueueRunner.cpp | 4 ++++ GPU/Common/StencilCommon.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/Common/GPU/Vulkan/VulkanQueueRunner.cpp b/Common/GPU/Vulkan/VulkanQueueRunner.cpp index b8c6e5895de0..890744fbe5f3 100644 --- a/Common/GPU/Vulkan/VulkanQueueRunner.cpp +++ b/Common/GPU/Vulkan/VulkanQueueRunner.cpp @@ -1525,6 +1525,10 @@ void VulkanQueueRunner::PerformBlit(const VKRStep &step, VkCommandBuffer cmd) { int layerCount = std::min(step.blit.src->numLayers, step.blit.dst->numLayers); _dbg_assert_(step.blit.src->numLayers >= step.blit.dst->numLayers); + // Blitting is not allowed for multisample images. You're suppose to use vkCmdResolveImage but it only goes in one direction (multi to single). + _dbg_assert_(step.blit.src->sampleCount == VkSampleCountFlagBits::VK_SAMPLE_COUNT_1_BIT); + _dbg_assert_(step.blit.dst->sampleCount == VkSampleCountFlagBits::VK_SAMPLE_COUNT_1_BIT); + VKRFramebuffer *src = step.blit.src; VKRFramebuffer *dst = step.blit.dst; diff --git a/GPU/Common/StencilCommon.cpp b/GPU/Common/StencilCommon.cpp index 592bb42eb82c..c0a2ce97da1b 100644 --- a/GPU/Common/StencilCommon.cpp +++ b/GPU/Common/StencilCommon.cpp @@ -290,6 +290,11 @@ bool FramebufferManagerCommon::PerformWriteStencilFromMemory(u32 addr, int size, useBlit = false; } + // Blitting to (or from) multisampled images is not allowed. + if (dstBuffer->fbo && dstBuffer->fbo->MultiSampleLevel() != 0) { + useBlit = false; + } + u16 w = useBlit ? dstBuffer->width : dstBuffer->renderWidth; u16 h = useBlit ? dstBuffer->height : dstBuffer->renderHeight;