Forums - GL_ACTIVE_UNIFORM_MAX_LENGTH returning random values

2 posts / 0 new
Last post
GL_ACTIVE_UNIFORM_MAX_LENGTH returning random values
RelativeGames
Profile picture
Join Date: 16 Apr 13
Posts: 56
Posted: Tue, 2014-05-13 19:44

 

I was testing a new feature on my Nexus 4/Adreno 320, driver version CL@3776187

 and noticed that calling this

glGetProgramiv( ProgramHandle, GL_ACTIVE_UNIFORM_MAX_LENGTH, &MaxLength );

kind of returns me (probably) the length of one of the uniforms from a uniform block, but not the maximum of them so I kind of have to hardcode a max length in which is rather annoying.

I will add that calls to glBindBufferRange works as expected ( in multiples of GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT which is really small on Adreno, like 4 )

One more weird thing I found is that putting a structure inside a uniform block sometimes fails compilation. Got this

 

struct Light
{
    vec3 Position;
    int LightType;
    
    vec3 Direction;
    vec3 Attenuation;
    
    vec3 Ambient;
    vec3 Diffuse;
    vec3 Specular;
    float Intensity;
};


uniform PerFrameBuffer
{

    uniform mat4 ProjectionMatrix;
    uniform mat4 ViewMatrix;
    
    uniform mat4 WorldMatrix;
    uniform mat4 InverseWorldMatrix;
    uniform mat4 ShadowViewMatrix;
    uniform vec4 MaterialColor;
    
    uniform Light Light0;

};
 

void ComputeLight( Light LightProperties, vec3 WorldPosition, vec3 Normal, vec3 WorldViewVector,
                  inout vec3 TotalAmbient, inout vec3 TotalDiffuse, inout vec3 TotalSpecular)

{

....

}

And then it says

ERROR: 0:258: 'ComputeLight' : no matching overloaded function found

As if the type is wrong or something. I'll add that the structure has some problems on Apple's reference driver too, it says the uniform types are mismatching, so I don't know what it wants cause it's the final variable and it doesn't even matter what other alignment comes in play. On desktop AMD hardware works flawless though.

  • Up0
  • Down0
mhfeldma Moderator
Join Date: 29 Nov 12
Posts: 310
Posted: Wed, 2014-05-14 07:47

Some interesting observations

We haven't seen problems reported with GL_ACTIVE_UNIFORM_MAX_LENGTH.

Can you put together a sample app with a shader that has the uniforms for which the length is incorrectly reported?

Also include the ComputeLight example.  Structures should be able to passed as parameters, so likely something else could be affecting the compiler.

 

 

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.