i965/fs: Use a single instance of the pull_constant_loc[] array.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 12 Mar 2014 05:24:39 +0000 (22:24 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 18 Mar 2014 17:11:32 +0000 (10:11 -0700)
commit229319e0f0f872cfb19de3eb0ab620ca611d65d8
tree1c872f42124fd29a30cbfa1cbf197132aff1c9b0
parent542f2e47f2f22522b963a7ab1f8b485d1c9985ba
i965/fs: Use a single instance of the pull_constant_loc[] array.

Now that we don't renumber uniform registers, assign_constant_locations
and move_uniform_array_access_to_pull_constants use the same names.
So, they can share a single copy of the pull_constant_loc[] array.

This simplifies the code considerably.  assign_constant_locations()
doesn't need to walk through pull_params[] to rediscover reladdr
demotions; it just has that information in pull_constant_loc[].  We also
only need to rewrite the instruction stream once, instead of twice.

Even better, we now have a single array describing the layout of
all pull parameters, which we can pass to the SIMD16 program.

This actually hurts a few shaders in Serious Sam 3, and one in KWin:
total instructions in shared programs: 1841957 -> 1842035 (0.00%)
instructions in affected programs:     1165 -> 1243 (6.70%)
Comparing dump_instructions() before and after the pull constant
transformations with and without this patch, it appears that there is
a uniform array with variable indexing (reladdr) and constant indexing
(of array element 0).  Previously, we uploaded array element 0 as both
a pull constant (for reladdr) /and/ a push constant.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h