OSDN Git Service

i965/fs: Refactor sampler message header to duplicate less code.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 18 Jan 2014 20:48:18 +0000 (12:48 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 23 Jan 2014 01:18:42 +0000 (17:18 -0800)
commitebfe43d5ad3b00a5ee1b760392a5275bc801c47e
tree90cd0dfe8c4c71ba645ce56e66db49817c6bd685
parent87e732673598ef3fd08a3432c7975b421b14c8c4
i965/fs: Refactor sampler message header to duplicate less code.

Previously, the code to copy g0 to the message header existed in two
places - one for the texture offset case, and one for any other case.

By treating texture_offset as a special case of header_present, we can
remove this duplication and shorten the code.  Future patches which add
new header fields also won't have to add additional duplication.

This also clarifies a confusing construct.  The old code contained:

   } else if (inst->header_present) {
      if (brw->gen >= 7) {
         ...explicit copy from g0 to the message header...
      } else {
         /* Set up an implied move from g0 to the MRF. */
      }
   }

This looks like it might set up an implied move on Sandybridge, which
doesn't support those.  However, Sandybridge only uses a message header
for texture offsets, so it would never hit this code path.  The new code
avoids this implicit knowledge by only setting up an implied move on
Gen4-5.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
src/mesa/drivers/dri/i965/brw_fs_generator.cpp