GLSL Input Layout Qualifier Bug on AMD Hardware

An issue was brought up yesterday concerning a bug in Chapter 2. If you change the layout input layout qualifiers in your GLSL shaders from that chapter to the following:

layout(location=18) in vec4 in_Position;
layout(location=1) in vec4 in_Color;

And update the calls to glVertexAttribPointer and glEnableVertexAttribArray accordingly, you will see nothing but a black screen on AMD hardware.

It turns out that this is a known bug, and someone on the OpenGL forums encountered this last year, so this bug has existed for a while.

After contacting OpenGL bug-basher extraordinaire Christophe Riccio (who runs a great site at G-Truc.net), he informed me that the only way to get this to work on AMD is to assign location 0, meaning that the following works:

layout(location=18) in vec4 in_Position;
layout(location=0) in vec4 in_Color;

So keep in mind when writing your programs to always occupy location 0 for something.

This entry was posted in Information and tagged , , , . Bookmark the permalink.
  • przemo_li

    Well I can see why AMD do not rush to fix this bug. However it is very annoying bug. Thx for this info.

    • http://openglbook.com/ E. Luten

      Agreed, it’s very annoying, and it makes binaries and code less portable.