Forums - VK driver bug with conditionals and discard

3 posts / 0 new
Last post
VK driver bug with conditionals and discard
hrydgard
Join Date: 13 Feb 13
Location: Stockholm
Posts: 2
Posted: Thu, 2021-02-11 10:28

There is a bug in the Vulkan driver for Android devices with the 6xx series Adreno GPUs. I have not found a device yet with a 6xx series Adreno that it does not reproduce on.

Basically, the following fragment shader code miscompiles  (SPIR-V compiled with glslang):

#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
layout(location = 0) in vec4 oColor0;
layout(location = 1) in highp vec2 oTexCoord0;
layout(location = 0) out vec4 fragColor0;
layout(set = 0, binding = 1) uniform sampler2D Sampler0;
void main() {
vec4 v = texture(Sampler0, oTexCoord0).aaaa * oColor0;
if (v.r < 0.2 && v.g < 0.2 && v.b < 0.2) discard;
fragColor0 = vec4(0.0, 1.0, 0.0, 1.0);
}
 
The Adreno driver turns this into something that does not discard the pixel, no matter the value sampled from the texture.
 
I have a very easy repro. Download the latest APK of PPSSPP from https://buildbot.orphis.net/ppsspp/  (or just download from the Play Store).  Launch the app, then go into Settings, Tools, Developer Tools, GPU Driver Test. Select the second tab, "Shader".
 
Now look next to "Adreno logic".  If you see some filled bright green rectangles on a dark green rectangle, you have the driver bug. If you see the text "TEST OK", everything is fine.
 
This has been around for a long time, would be nice to see it fixed.
  • Up0
  • Down0
AndreyVK_D3D
Profile picture
Join Date: 10 Jun 13
Location: Moscow
Posts: 36
Posted: Wed, 2021-02-24 01:20

hrydgard, hi!

Yes, I can reproduce bug.

https://photos.app.goo.gl/UkwbZUCS3FhRnyWN9

 
  • Up0
  • Down0
AndreyVK_D3D
Profile picture
Join Date: 10 Jun 13
Location: Moscow
Posts: 36
Posted: Mon, 2021-03-01 05:59
  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.