On Sun, 13 Mar 2011 07:59:46 +0100, Marek Olšák <[email protected]> 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
driver.

Yes, rework of how we tie uniforms into glUniform is strongly desired.

Attachment: pgptzCvXnDn0P.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to