Permalink
Browse files

Vulkan: Workaround stencil upload bug on Adreno.

We write a static depth value, which will be ignored, to force the driver
to support discard.
  • Loading branch information...
unknownbrackets committed Jun 18, 2018
1 parent 9f4cd3f commit bd13f6b9066c0f3ee0cd4dbaa9940f7c6787a5c0
Showing with 4 additions and 0 deletions.
  1. +4 −0 GPU/Vulkan/StencilBufferVulkan.cpp
@@ -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 {

0 comments on commit bd13f6b

Please sign in to comment.