Vulkan: Workaround stencil upload bug on Adreno.

We write a static depth value, which will be ignored, to force the driver
to support discard.
This commit is contained in:
Unknown W. Brackets 2018-06-17 17:45:20 -07:00
parent 9f4cd3fcdb
commit bd13f6b906

View File

@ -27,6 +27,8 @@
#include "GPU/Vulkan/TextureCacheVulkan.h"
#include "GPU/Vulkan/VulkanUtil.h"
// 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.
static const char *stencil_fs = R"(#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
@ -38,6 +40,8 @@ layout (location = 0) in vec2 v_texcoord0;
layout (location = 0) out vec4 fragColor0;
void main() {
gl_FragDepth = 0.0;
if (u_stencilValue == 0) {
fragColor0 = vec4(0.0);
} else {