drean

Catalyst 10.3 OpenGL GLSL glGetProgramiv returns invalid value

Discussion created by drean on May 3, 2010
Latest reply on May 5, 2010 by frali

Hello,

When I'm compiling the GLSL shaders:

Vertex Shader:


struct ViewportClass {
float _from;
float _range;
float _max_range;
vec2 _fov_tan;
vec2 _clamp_min;
vec2 _clamp_max;
vec2 _size;
vec2 _center;
vec4 _FracToPosXY;
vec4 _ScreenToPosXY;
vec4 _PosToScreen;
};

attribute vec4 ATTR0;
attribute vec4 ATTR4;
uniform ViewportClass _Viewport;
void main()
{
vec4 _outVtx;
vec2 _outTex;
vec2 _outPosXY;
_outTex = ATTR4.xy;
_outPosXY = ATTR4.xy*_Viewport._ScreenToPosXY.xy + _Viewport._ScreenToPosXY.zw;
_outVtx = vec4(ATTR0.x, ATTR0.y, 1.00000000E+000, 1.00000000E+000);
gl_TexCoord[1].xy = _outPosXY;
gl_Position = _outVtx;
gl_TexCoord[0].xy = ATTR4.xy;
} // main end

 


 

Pixel Shader:

struct LIGHT_CONE {
float _length;
float _scale1;
float _angle;
float _angle_range;
float _vol3;
float _vol_max2;
vec3 _pos2;
vec3 _color6;
vec3 _mtrx[3]; // <- HERE IS _mtrx
};
vec4 _ret_0;
uniform LIGHT_CONE _Light_cone;
void main()
{
_ret_0 = vec4(_Light_cone._mtrx[0].x, _Light_cone._mtrx[1].x, _Light_cone._mtrx[2].x, 1.00000000E+000); // HERE I USE _mtrx
gl_FragColor = _ret_0;
return;
} // main end


I get following error:

 Int  params=0; glGetProgramiv(program,GL_ACTIVE_UNIFORMS,& params);

after calling the function params is still zero, while it shouldn't

it is not detecting "_Light_cone._mtrx" in the pixel shader.

it worked only if I moved the "_mtrx" to start of the struct

struct LIGHT_CONE {
vec3 _mtrx[3]; // <- to here
float _length;
float _scale1;
float _angle;
float _angle_range;
float _vol3;
float _vol_max2;
vec3 _pos2;
vec3 _color6;
};

 

There must be some kind of bug in detecting wheter this struct member is used.

Outcomes