PDA

View Full Version : Render failing when green color is set (might be AMD issue)



mixedcase
11-16-2015, 11:35 AM
I have an application that is using the OGL4+ 64-bit mode for vertex data (not sure if this is part of the issue or not). Data is rendered in 2D orthographic mode from vertex buffers. It runs fine on nVidia hardware but on AMD nothing renders if the green color component is above 55 (ubyte). It's really weird. Maybe I'm doing something wrong in my code or maybe it's a driver issue.

Hardware is R9 280X running Linux Ubuntu 15.10 with fglrx-updates 2:15.201-0ubuntu proprietary AMD driver.

The problem is showing up in a very large application but I have created a small example which shows the issue. Note this is not clean code, it's a bunch of pasted together and ripped out ad-hoc ugly code. It's just the minimum I could do to show the issue. The example is using SDL2 but I know that isn't the issue because the large app is not using SDL.

Source code is here:
https://github.com/c---/opengl-test

Am I doing something wrong in the code here?

GClements
11-16-2015, 02:56 PM
I'm wondering whether you might be triggering a driver bug relating to locations with vertex attributes larger than 128 bits.

The GLSL 4.5 specification says


If a vertex shader input is any scalar or vector type, it will consume a single location. If a non-vertex shader input is a scalar or vector type other than dvec3 or dvec4, it will consume a single location, while types dvec3 or dvec4 will consume two consecutive locations. Inputs of type double and dvec2 will consume only a single location, in all stages.


It's possible that the driver is applying the "non-vertex shader" rules to vertex shader inputs, resulting in the "color" attribute overlapping the "vertex" attribute. Another possibility is a bug in promoting 2-component data to a 3-component vector when using double precision.

Things which I would test include:
- Use location=2 for the "color" attribute
- Swap the attribute locations so that "color" is 0 and "vertex" is 1
- Allow the compiler to choose the locations and query them with glGetAttribLocation()
- Change "vertex" to dvec2.

mixedcase
11-16-2015, 03:57 PM
Excellent ideas, thanks!


Things which I would test include:
- Use location=2 for the "color" attribute
- Swap the attribute locations so that "color" is 0 and "vertex" is 1
- Allow the compiler to choose the locations and query them with glGetAttribLocation()
- Change "vertex" to dvec2.

I tested all of these and they all fix it. So is it a bug in the driver? I have a thread open over at AMD, maybe they can answer.

At least I can make it work now. Thanks again!

GClements
11-17-2015, 03:58 AM
I tested all of these and they all fix it. So is it a bug in the driver?

I think it has to be.