cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

valeriog_crytek
Journeyman III

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

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.

0 Likes
2 Replies
pinform
Staff

Hi Valerio,

Welcome!

I have white-listed you, so you should be able to post directly in the forum of choice. This question seems to be related to the GPU Developer Tools   forum, so I am moving it there.

--Prasad

0 Likes

Hi Prasad,

My question is not about GPU Developer Tools, but rather OpenGL & Vulkan

0 Likes