My program use QtOpenGL to draw a sphere and color it by sampling a texture in a single draw call. It works on Nvdia cards, but when I switch to AMD cards (my laptop and other laptops), it show a black screen. (Note: it only failed with AMD Catalyst Software Suite driver, but works with the AMD Radeon Software Crimson Edition Beta driver at this link).
Here is the normal picture on Nvdia cards, and the black bug picture on AMD cards.
It seems to be a texture sampling bug (not framebuffer bug) because OpenGL draws normally when I use a simple shading method (color = dot(vertexPixelNormal, lightDirection)) as the following picture.
I use CodeXL from AMD for debugging, and when I click on the texture ID from the CodeXL explorer view, it show exactly my image (Does it mean that my image is updated to GPU successfully?). Here is the OpenGL calls log.
Note: You can't see the function glTextureStorage2DEXT before glTextureSubImage2D in the log because CodeXL doesn't log glTextureStorage2DEXT, which is used by QtOpenGL. I debug step by step and ensure that this function is called.
Here is the texture property from CodeXL property view
Here is the fragment shader
#version 150 core
uniform sampler2D matcapTexture;
vec3 matcapColor(vec3 eye, vec3 normal)
vec3 reflected = reflect(eye, normal);
float m = 2.0 * sqrt(
pow(reflected.x, 2.0) +
pow(reflected.y, 2.0) +
pow(reflected.z + 1.0, 2.0)
vec2 uv = reflected.xy / m + 0.5;
uv.y = 1.0 - uv.y;
return texture(matcapTexture, uv).xyz;
in vec4 fragInput; //vec4(eyePosition, depth)
vec3 n = normalize(cross(dFdx(fragInput.xyz), dFdy(fragInput.xyz))); //calculate vertex pixel normal by dfdx,dfdy
const vec3 LightDirection = vec3(0.0f, 0.0f, -1.0f);
vec3 fragColor = matcapColor(LightDirection, n);
gl_FragData = vec4(fragColor.x, fragColor.y, fragColor.z, 1.0f);
I spent several days for this bug but can't find any clues. Hope you guys could help me show what's incorrect here. Did I do something that AMD didn't expect?
Hello, thanks for replay. You can download the demo software called Unyk at here by registering your account, and then the website will send a download link to your email. Note that the bug only happen in the AMD Catalyst Software Suite driver, not the Crimson version. Hope to see your answer. I post the problem on a lot of forums, and most people don't see anything wrong with the OpenGL logs from CodeXL.
I tested on several devices, and It happen both on desktop and laptop with AMD graphics cards with Radeaon driver installed. Now I am using the laptop HP 8570W with AMD Firepro 4000M
As far as the HP8570W laptop is considered, you are going to need to contact your vendor directly to request for an updated driver. The hardware requires OEM-certified drivers, which is the reason you cannot install Crimson drivers, as shared on our web-site, on that specific hardware.