[Mesa-dev] [PATCH V3] glsl: lower constant arrays to uniform arrays before optimisation loop

Timothy Arceri timothy.arceri at collabora.com
Tue Jan 24 21:43:32 UTC 2017


On Tue, 2017-01-24 at 09:57 -0800, Eric Anholt wrote:
> Timothy Arceri <t_arceri at yahoo.com.au> writes:
> 
> > From: Timothy Arceri <timothy.arceri at collabora.com>
> > 
> > Previously the constant array would not get copy propagated until
> > the backend
> > did its GLSL IR opt loop. I plan on removing that from i965 shortly
> > which
> > caused huge regressions in Deus-ex and Tomb Raider which have large
> > constant arrays. Moving lowering before the opt loop in the GLSL
> > linker
> > fixes this and unexpectedly improves some compute shaders also.
> 
> It seems like we should figure out what's missing in NIR that the
> lack
> of GLSL copy propagation hurt, but this is a pretty easy fix for now:
> 
> Reviewed-by: Eric Anholt <eric at anholt.net>

Thanks.

The problem in NIR is that we end up with IR that looks like this.

vec4 32 ssa_496 = intrinsic load_var () (constarray_0_4[264]) ()
intrinsic store_var (ssa_496) (icb[264]) (15) /* wrmask=xyzw */

But NIRs variable-based copy propagation pass needs there to be a
copy_var in order to progress. We certainly need to improve this but
there are so many bits that need to be improved I'm trying not to get
sidetracked, for now my goal is to remove all GLSL IR opts from the
i965 linker.

Also since this actually improved some shaders it makes sense to make
the change now so that we can try to carry over the improvement when
fixing the NIR pass.


More information about the mesa-dev mailing list