1 Reply Latest reply on May 28, 2013 1:18 PM by yousry

    Catalyst 13.1 Legacy: possible ubo/struct bug

    yousry

      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).