From 3330225de44abda937d00d96f13e7a5bf67fd410 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Fri, 2 May 2025 15:37:29 +0200 Subject: [PATCH] vk: (mali) add subpass dependency from subpass 2 to external Add subpass dependency from the last subpass to external/top of pipe. Fix glitches in upper left corner when using OIT on Mali GPUs. Issue #1014 Issue #1234 Issue #1356 Issue #1497 Issue #1852 --- core/rend/vulkan/oit/oit_renderpass.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/rend/vulkan/oit/oit_renderpass.cpp b/core/rend/vulkan/oit/oit_renderpass.cpp index 484ace4ff..61c79cdbb 100644 --- a/core/rend/vulkan/oit/oit_renderpass.cpp +++ b/core/rend/vulkan/oit/oit_renderpass.cpp @@ -97,6 +97,13 @@ vk::UniqueRenderPass RenderPasses::MakeRenderPass(bool initial, bool last, bool vk::AccessFlagBits::eShaderRead | vk::AccessFlagBits::eShaderWrite, vk::AccessFlagBits::eShaderRead | vk::AccessFlagBits::eShaderWrite, vk::DependencyFlagBits::eByRegion); + if (GetContext()->GetVendorID() == VulkanContext::VENDOR_ARM) { + // Avoid glitches in upper left corner with Mali GPUs. + // Using eTopOfPipe as destination since eFragmentShader/eInputAttachmentRead|eShaderRead fails to fix the problem, which is odd. + // Also, vulkan defines an implicit dependency from 2 to VK_SUBPASS_EXTERNAL, so this one shouldn't be needed. + dependencies.emplace_back(2, VK_SUBPASS_EXTERNAL, vk::PipelineStageFlagBits::eColorAttachmentOutput, vk::PipelineStageFlagBits::eTopOfPipe, + vk::AccessFlagBits::eColorAttachmentWrite, vk::AccessFlagBits::eNone); + } return GetContext()->GetDevice().createRenderPassUnique(vk::RenderPassCreateInfo(vk::RenderPassCreateFlags(), attachmentDescriptions,