Yeah but it doesn&#39;t eliminate array elements. For example:<br><br>   uniform vec4 a[1024];<br>   [snip]<br>   gl_FragColor = a[567];<br><br>In this case, the r300 compiler transforms the shader to:<br><br>   uniform vec4 a;<br>

   [snip]<br>
   gl_FragColor = a;<br><br>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.<br>

<br>To my knowledge, the GLSL compiler can&#39;t do this.<br><br>Marek<br><br>
<br><div class="gmail_quote">On Sun, Mar 13, 2011 at 6:46 AM, Kenneth Graunke <span dir="ltr">&lt;<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im">On Saturday, March 12, 2011 06:44:37 PM Marek Olšák wrote:<br>
&gt; The r300 compiler can eliminate unused uniforms and remap uniform locations<br>
&gt; if their number surpasses hardware limits, so the limit is actually<br>
&gt; NumParameters + NumUnusedParameters. This is important for some apps<br>
&gt; under Wine to run.<br>
<br>
</div>[snip]<br>
<br>
I thought that the GLSL compiler itself eliminated unused uniforms at link<br>
time...at least, if I try and run the following shader_runner test on either<br>
i965 or swrast:<br>
<br>
[require]<br>
GLSL &gt;= 1.10<br>
<br>
[vertex shader]<br>
void main() { gl_Position = gl_Vertex; }<br>
<br>
[fragment shader]<br>
uniform float foo;<br>
void main() { gl_FragColor = vec4(1.0); }<br>
<br>
[test]<br>
uniform float foo 1.0<br>
draw rect -1 -1 2 2<br>
<br>
...it tells me:<br>
cannot get location of uniform &quot;foo&quot;<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br>