i965/fs: Fix stride for immediate registers.
authorFrancisco Jerez <currojerez@riseup.net>
Mon, 13 Jul 2015 11:50:24 +0000 (14:50 +0300)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 21 Jul 2015 14:54:00 +0000 (17:54 +0300)
commit5f8d9ae5a54961deb02eb52e924a84b99b60f035
tree2d02f3e02a270afd7b1073a23cbc7306a9471f7e
parentb298311d517017834841e53b7e641738e6067cdc
i965/fs: Fix stride for immediate registers.

When the width field was removed from fs_reg the BROADCAST handling
code in opt_algebraic() started to miss a number of trivial
optimization cases resulting in the ugly indirect-addressing sequence
to be emitted unnecessarily for some variable-indexed texturing and
UBO loads regardless of one of the sources of BROADCAST being
immediate.  Apparently the reason was that we were setting the stride
field to one for immediates even though they are typically uniform.
Width used to be set to one too which is why this optimization used to
work previously until the "reg.width == 1" check was removed.

The stride field of vector immediates is intentionally left equal to
one, because they are strictly speaking not uniform.  The assertion in
fs_generator makes sure that immediates have the expected stride as
consistency check.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs_generator.cpp