[Mesa-dev] [PATCH] ir_to_mesa: do not check the number of uniforms against hw limits

Eric Anholt eric at anholt.net
Sun Mar 13 11:36:17 PDT 2011

On Sun, 13 Mar 2011 07:59:46 +0100, Marek Olšák <maraeo at gmail.com> wrote:
> 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.

Yeah, it doesn't do this right now because of the way we generate Mesa's
information about the uniforms for the purposes of the GL API.
Unfortunately, because you accessed a[567] in the shader, a[0] to a[566]
also need to be accessible with glUniform, so we need to have some sort
of plan.  If it wasn't for this, we'd probably just be assigning names
to scalars/vectors up front and eliminating them on behalf of the

Yes, rework of how we tie uniforms into glUniform is strongly desired.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110313/9d298aeb/attachment.pgp>

More information about the mesa-dev mailing list