i965/fs: Don't renumber UNIFORM registers.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 11 Mar 2014 21:35:27 +0000 (14:35 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 18 Mar 2014 17:11:29 +0000 (10:11 -0700)
commit542f2e47f2f22522b963a7ab1f8b485d1c9985ba
tree0988b9e78716005fe436d8b0136d9ea2d85b1ac1
parentd9f339eccd87413d9f6bf6dd6217db01630f12f8
i965/fs: Don't renumber UNIFORM registers.

Previously, remove_dead_constants() would renumber the UNIFORM registers
to be sequential starting from zero, and the resulting register number
would be used directly as an index into the params[] array.

This renumbering made it difficult to collect and save information about
pull constant locations, since setup_pull_constants() and
move_uniform_array_access_to_pull_constants() used different names.

This patch generalizes setup_pull_constants() to decide whether each
uniform register should be a pull constant, push constant, or neither
(because it's unused).  Then, it stores mappings from UNIFORM register
numbers to params[] or pull_params[] indices in the push_constant_loc
and pull_constant_loc arrays.  (We already did this for pull constants.)

Then, assign_curb_setup() just needs to consult the push_constant_loc
array to get the real index into the params[] array.

This effectively folds all the remove_dead_constants() functionality
into assign_constant_locations(), while being less irritable to work
with.

v2: Add assert(remapped <= i), requested by Topi.

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
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp