[Mesa-dev] [PATCH v2] glsl: Fix handling of array dereferences of vectors in opt_dead_code_local

Eric Anholt eric at anholt.net
Mon Feb 11 16:31:04 PST 2013


Ian Romanick <idr at freedesktop.org> writes:

> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Three parts to the fix:
>
> 1. If the array dereference is a constant index, figure out the real
> write mask.
>
> 2. If the array dereference not is a constant index, assume the
> assignment may generate any component.
>
> 3. If the array dereference not is a constant index, assume the
> assigment will not kill any previous component write.
>
> v2: Fix accidental setting of debug flag (noticed by Aras
> Pranckevičius).  Fix idiotic typo added after last build.

OK, here's the testcase I came up with today:

vec4 v;
v.xyzw = vec4(1, 2, 3, 4);
   entry.ir.writemask == xyzw
   entry.available = xyzw
gl_FragColor = vec4(v.xyz, 1);
   entry.ir.writemask = xyzw,
   entry.available = w
v.zw = vec2(2.0);
   entry.ir.writemask = xy;
   entry.available = 0;
   So now we delete it!

Yeah, this code could have used more comments.
-------------- 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/20130211/654c96f7/attachment.pgp>


More information about the mesa-dev mailing list