Vulkan: Stencil initialization: Use the adreno path for Mali as well.

Appears to fix the Star Ocean issue and maybe more reported in #12890.

Strange though...
This commit is contained in:
Henrik Rydgård 2020-05-19 23:26:22 +02:00
parent b001ca1e06
commit 3a5e07ad4f
2 changed files with 6 additions and 3 deletions

View File

@ -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 {

View File

@ -24,7 +24,7 @@ static const std::vector<Draw::ShaderSource> 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;