cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

yousry
Adept I

Catalyst 13.1 Legacy: possible ubo/struct bug

Create a shader, for example:

#version 330 core

...

struct Something {

...

    float a;

    float b;

    float c;

...

};

uniform wonderful { 

  layout(...) mat4 has;

  layout(...) mat4 happend;

  Somethig dontPanik;

};

...

If you try to retrieve the offsets with:

glGetActiveUniformsiv(programId, UBO_SIZE, uboIndices, GL_UNIFORM_OFFSET, uboOffsets);

All floats are assigned to the same offset.

if you change the struct(alternate floats with other types of  length >1):

struct SomethingElse {

...

    float a;

    vec3 we;

    float b;

    vec3 dontSink;

    float c;

    vec3 atlantisWest;

...

};

the floats are accessible.

Also glBufferSubData is  slow in this context (compared to a competing product).

0 Likes
1 Reply
yousry
Adept I

With std140 as layout qualifier it is also possible to get unique indices. But now the query (get*ACTIVE*Uniforms) is redundant since unused uniforms are no longer distinguishable

0 Likes