diff --git a/GPU/Vulkan/StencilBufferVulkan.cpp b/GPU/Vulkan/StencilBufferVulkan.cpp index 3e9cc7e0aa..a025763d54 100644 --- a/GPU/Vulkan/StencilBufferVulkan.cpp +++ b/GPU/Vulkan/StencilBufferVulkan.cpp @@ -29,6 +29,8 @@ // This shader references gl_FragDepth to prevent early fragment tests. // They shouldn't happen since it uses discard, but Adreno detects that incorrectly - see #10634. +// This only affected the 5xx generation and was fixed sometime before driver version 512.384.0.0 (whatever that means). +// Strangely, this same code appears to fix a different issue on Exynos instead so now it's enabled on Mali as well. static const char *stencil_fs_adreno = R"(#version 450 #extension GL_ARB_separate_shader_objects : enable #extension GL_ARB_shading_language_420pack : enable @@ -146,7 +148,8 @@ bool FramebufferManagerVulkan::NotifyStencilUpload(u32 addr, int size, StencilUp if (!stencilVs_) { const char *stencil_fs_source = stencil_fs; // See comment above the stencil_fs_adreno definition. - if (vulkan_->GetPhysicalDeviceProperties().properties.vendorID == VULKAN_VENDOR_QUALCOMM) + u32 vendorID = vulkan_->GetPhysicalDeviceProperties().properties.vendorID; + if (vendorID == VULKAN_VENDOR_QUALCOMM || vendorID == VULKAN_VENDOR_ARM) stencil_fs_source = stencil_fs_adreno; stencilVs_ = CompileShaderModule(vulkan_, VK_SHADER_STAGE_VERTEX_BIT, stencil_vs, &error); @@ -168,7 +171,7 @@ bool FramebufferManagerVulkan::NotifyStencilUpload(u32 addr, int size, StencilUp return false; if (dstBuffer->fbo) { - // Typically, STENCIL_IS_ZERO means it's already bound. + // Typically, STENCIL_IS_ZERO means it's already bound, so this bind will be optimized away. Draw::RPAction stencilAction = flags == StencilUpload::STENCIL_IS_ZERO ? Draw::RPAction::KEEP : Draw::RPAction::CLEAR; draw_->BindFramebufferAsRenderTarget(dstBuffer->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP, stencilAction }); } else { diff --git a/UI/GPUDriverTestScreen.cpp b/UI/GPUDriverTestScreen.cpp index dfad8aecb4..87018d8399 100644 --- a/UI/GPUDriverTestScreen.cpp +++ b/UI/GPUDriverTestScreen.cpp @@ -24,7 +24,7 @@ static const std::vector fsDiscard = { })" }, {Draw::ShaderLanguage::GLSL_VULKAN, - R"(#version 140 + R"(#version 450 #extension GL_ARB_separate_shader_objects : enable #extension GL_ARB_shading_language_420pack : enable layout(location = 0) in vec4 oColor0;