[Mesa-dev] [PATCH] ir_to_mesa: do not check the number of uniforms against hw limits
Marek Olšák
maraeo at gmail.com
Sat Mar 12 22:59:46 PST 2011
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 <kenneth at 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 at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110313/f277b03e/attachment.html>
More information about the mesa-dev
mailing list