i965/fs: Factor out source components calculation to a separate method.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 21 Jul 2015 14:28:39 +0000 (17:28 +0300)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 29 Jul 2015 11:12:46 +0000 (14:12 +0300)
commitfb7eba97d7235d49ac712a21fb51009c86f3bc64
tree3cb037fbfb1936bdfbd9ecf87f9db3b46b59df4b
parent24d74b66883da1955f8c2223367d41470d99df6d
i965/fs: Factor out source components calculation to a separate method.

This cleans up fs_inst::regs_read() slightly by disentangling the
calculation of "components" from the handling of message payload
arguments.  This will also simplify the SIMD lowering and logical send
message lowering passes, because it will avoid expressions like
'regs_read * REG_SIZE / component_size' which are not only ugly, they
may be inaccurate because regs_read rounds up the result to the
closest register multiple so they could give incorrect results when
the component size is lower than one register (e.g. uniforms).  This
didn't seem to be a problem right now because all such expressions
happen to be dealing with per-channel GRFs only currently, but that's
by no means obvious so better be safe than sorry.

v2: Split PIXEL_X/Y and LINTERP into separate case blocks.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_ir_fs.h