ATI Catalyst 8.6 help needed

Hello everyone,

I’m having some problems (again) with ATI drivers (at least) on Radeon X1600 and HD 2600 on XP32.

I have some shaders that compile & link fine (according to the GL compiler diagnostics), but the problem comes when I try to enumerate the active uniforms of the shader.

At this step, the ‘get’ call for GL_OBJECT_ACTIVE_UNIFORMS returns me the good value (7 in my simple test case) - but while looping to enumerate, the 7th ‘glGetActiveUniform’ call gives me GL_INVALID_VALUE - without any good reason I could perceive.

It also happens, on other shaders, that I have multiple GL_INVALID_VALUE errors in an enumeration.

The shader code is somewhat ugly as it’s generated, but it works fine on NVidia systems, and it used to work fine on ATI systems back in the Catalyst 7 era (last time I checked).

I have a Python (using PyOpenGL) unit test available here.

The correct output should be (modulo uniform order)


num_attributes =  2
num_uniforms =  7
('glos_mtl_intensity', 1, 5126)
('mg_ModelMatrix', 1, 35676)
('mg_mtl_transparency', 1, 5126)
('mg_ws_mainLight', 1, 35666)
('mg_ws_viewPosition', 1, 35666)
('spec_mtl_intensity', 1, 5126)
('gl_ModelViewProjectionMatrixTranspose', 1, 35676)

Could anyone give it a try - or just compile, link & enumerate uniforms on the following shader code ? And let me know if this is reproductible on any other system out there ? I had it on 2 different machines with 2 different ATI boards.

Or maybe I make some terrible mistake somewhere ?

Thanks in advance,
cheers,

Nicolas.

================================

vertex shader code


void init_material_uvs() {
}

attribute vec3 mg_Tangent;
attribute vec3 mg_Binormal;

varying vec3 ws_eyevec;
varying vec3 ws_normal;
varying vec3 ws_tangent;
varying vec3 ws_binormal;
varying vec3 ws_ldir;

uniform mat4 mg_ModelMatrix;
uniform vec4 mg_ws_viewPosition;

void init_material_uvs();

void main() {
  init_material_uvs();
  
  vec4 ws_camera = mg_ws_viewPosition;
  ws_eyevec = normalize( vec3((mg_ModelMatrix * gl_Vertex) - ws_camera) );
  ws_normal = normalize( vec3(mg_ModelMatrix * vec4(gl_Normal,0.0)) );
  ws_tangent = normalize( vec3(mg_ModelMatrix * vec4(mg_Tangent,0.0)) );
  ws_binormal = normalize( vec3(mg_ModelMatrix * vec4(mg_Binormal,0.0)) );
  
  vec4 position = ftransform();
  gl_Position = position;
}

fragment shader code


uniform vec3 mtl_color;
uniform float glos_mtl_intensity;
uniform float mg_mtl_transparency;
uniform float refl_mtl_intensity;
uniform float spec_mtl_intensity;

vec3 bump_channel() {
  vec3 result = vec3(0.0,0.0,1.0);
  return result;
}

vec3 colr_channel() {
  vec4 result = vec4(mtl_color,1.0);
  return result.xyz;
}

float diff_channel() {
  vec4 result = vec4(0.000000);
  return dot(vec3(0.33,0.34,0.33),result.xyz);
}

float glos_channel() {
  return glos_mtl_intensity;
}

float lumi_channel() {
  return 0.0;
}

float refl_channel() {
  return refl_mtl_intensity;
}

vec3 sample_envmap(vec3 normalized_vector) {
  return vec3(0.0);
}

float spec_channel() {
  return spec_mtl_intensity;
}

float transparency_channel() {
  return mg_mtl_transparency;
}

vec3 eval_bump() {
  vec3 channel_ev = bump_channel();
  return channel_ev;
}

vec3 eval_color() {
  vec3 color_channel_ev = colr_channel();
  return color_channel_ev;
}

float eval_diffuse() {
  float channel_ev = diff_channel();
  return channel_ev;
}

float eval_glossiness() {
  float channel_ev = glos_channel();
  return channel_ev;
}

float eval_luminosity() {
  float channel_ev = lumi_channel();
  return channel_ev;
}

float eval_opacity() {
  float channel_ev = transparency_channel();
  return 1.0-channel_ev;
}

float eval_reflection() {
  float channel_ev = refl_channel();
  return channel_ev;
}

float eval_specular() {
  float channel_ev = spec_channel();
  return channel_ev;
}

vec3 sample_bumpmap(vec3 n, vec3 t, vec3 b) {
  vec3 bump = eval_bump();
  vec3 x = bump.x * t;
  vec3 y = bump.y * b;
  vec3 z = bump.z * n;
  return normalize(x+y+z);
}

varying vec3 ws_eyevec;
varying vec3 ws_normal;
varying vec3 ws_tangent;
varying vec3 ws_binormal;
varying vec3 ws_ldir;

float g_incidence_angle;
float g_light_incidence_angle;

float eval_diffuse();
float eval_glossiness();
float eval_luminosity();
float eval_opacity();
float eval_reflection();
float eval_specular();
vec3 eval_bump();
vec3 eval_color();
vec3 sample_bumpmap(vec3 n, vec3 t, vec3 b);
vec3 sample_envmap(vec3 normalized_vector);

uniform vec4 mg_ws_mainLight;

void main()
{
  /* reflection */
  vec3 ws_n = sample_bumpmap(ws_normal, ws_tangent, ws_binormal);
  vec3 ws_neyevec = normalize(ws_eyevec);
  vec3 ws_reflect = reflect(ws_neyevec, ws_n);
  
  g_incidence_angle = -dot(ws_n, ws_neyevec);
  g_light_incidence_angle = g_incidence_angle;
  
  vec3 envmap = sample_envmap( ws_reflect );
  float reflection = eval_reflection();
  vec3 refl_contrib = reflection * envmap;

  /* light */
  float ambient_intensity = 1.0;
  float light_intensity = 0.7;
  
  /* specular */  
  vec3 L = mg_ws_mainLight.xyz;
  vec3 H = normalize( -0.5 * (L + ws_neyevec) );

  float glossiness = pow(2.0, 2.0+10.0*eval_glossiness());
  float specular = light_intensity * eval_specular();
  vec3 specular_contrib = vec3( specular * pow( max(dot(ws_n, H),0.0), glossiness ) );
  
  /* luminosity */
  float luminosity = eval_luminosity();
  
  /* diffuse */
  float d = light_intensity * max(dot(ws_n, -L), 0.0);
  d += ambient_intensity;
  d *= eval_diffuse();
  d += luminosity;
  
  vec3 color = d * eval_color();
  color += specular_contrib;
  color += refl_contrib;
    
  /**/
  gl_FragColor = vec4( color, eval_opacity() );
}

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.