AnsweredAssumed Answered

GLSL "#version 440" breaks std140 layout [Catalyst 15.7.1]

Question asked by valeriog_crytek on Aug 5, 2015
Latest reply on Aug 6, 2015 by valeriog_crytek

We have found a consistent issue with uniform buffer layout on our GLSL shaders on Catalyst drivers.

The GPU tested is a Radeon HD 7950 with Catalyst 15.7.1.

 

The effect is that a shader like this will have an unpredictable UBO layout for any member after the first one:

 

#version 440

out gl_PerVertex

{

  vec4 gl_Position;

};

layout(std140) uniform;

uniform a

{

  vec4 a0;

  vec4 a1;

};

void main()

{

  gl_Position  = vec4(0, 0, 0, 0);

  gl_Position  += a0;

  gl_Position  += a1;

}

 

Both shader reflection (GL_OFFSET) and my experiments show that the offset of 'a1' inside 'a' is not the expected 16, but rather a random value, usually between 1200 and 1400.

 

This incidentally does not happen if we replace the the first line with:


#version 430

 

Currently we use this as a workaround but it would be nice if the compiler did not have this kind of behavior with version 4.4 shaders, or at least issued an error on compilation.

 

Thanks,

Valerio.

Outcomes