Shading Language Compiler Quality

[edit - oops, this is be in glsl forum - sorry!]

Just having a play around with gl shading language, and noticed that the compiler seems to optimize out dead uniforms OK, but not always dead attributes.

Example vertex shader:

attribute vec3 dummy;

void main(){
   vec3 t=dummy;
   gl_Position=gl_ModelViewProjectionMatrix * gl_Vertex;  
}

GL reports 2 active attributes (gl_Vertex and dummy) and 1 active uniform (gl_ModelViewProjectionMatrix). However, the ‘dummy’ attribute is dead so should really have been stripped.

If I change dummy to a uniform it is successfully stripped. Also, if I leave it as an attribute and remove the ‘t=dummy’ assignment.

I am currently doing this sort of dead code analysis on GL ASM code very successfully. I was hoping I could move to high level code and get it done for me, but this kind of inconsistency makes me nervous!

Yep, it should be done by the compiler. Only speaks for low-quality implementation. What card and driver is it?

Hi,

What card and driver is it?

GeForce 6600 with ForceWare 91.31 (I assume this is ‘driver version’ - it’s recent anyway).