Yeah but it doesn't eliminate array elements. For example: uniform vec4 a[1024]; [snip] gl_FragColor = a[567];
In this case, the r300 compiler transforms the shader to: uniform vec4 a; [snip] gl_FragColor = a; Then there is an indirection table that maps addresses of constants in the constant buffer to their final locations in the shader. Everytime a new constant buffer is set, the driver goes through the table and copies each constant to the expected location in hardware. To my knowledge, the GLSL compiler can't do this. Marek On Sun, Mar 13, 2011 at 6:46 AM, Kenneth Graunke <kenn...@whitecape.org>wrote: > On Saturday, March 12, 2011 06:44:37 PM Marek Olšák wrote: > > The r300 compiler can eliminate unused uniforms and remap uniform > locations > > if their number surpasses hardware limits, so the limit is actually > > NumParameters + NumUnusedParameters. This is important for some apps > > under Wine to run. > > [snip] > > I thought that the GLSL compiler itself eliminated unused uniforms at link > time...at least, if I try and run the following shader_runner test on > either > i965 or swrast: > > [require] > GLSL >= 1.10 > > [vertex shader] > void main() { gl_Position = gl_Vertex; } > > [fragment shader] > uniform float foo; > void main() { gl_FragColor = vec4(1.0); } > > [test] > uniform float foo 1.0 > draw rect -1 -1 2 2 > > ...it tells me: > cannot get location of uniform "foo" > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev