i965: Make convert_attr_sources_to_hw_regs handle stride == 0.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 12 Nov 2015 06:37:53 +0000 (22:37 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 13 Nov 2015 23:17:58 +0000 (15:17 -0800)
This makes expressions like component(fs_reg(ATTR, n), 7) get a proper
<0,1,0> region instead of the invalid <0,8,0>.

Nobody uses this today, but I plan to.

v2: Rebase on Matt's changes; simplify.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com> [v1]
src/mesa/drivers/dri/i965/brw_fs.cpp

index b8c88f73dfab8d50c81fdedff1b566edbfaa4e3c..b8d48dadde9fe723b7d07618096aaa23693db888 100644 (file)
@@ -1614,11 +1614,12 @@ fs_visitor::convert_attr_sources_to_hw_regs(fs_inst *inst)
                    inst->src[i].nr +
                    inst->src[i].reg_offset;
 
+         unsigned width = inst->src[i].stride == 0 ? 1 : inst->exec_size;
          struct brw_reg reg =
             stride(byte_offset(retype(brw_vec8_grf(grf, 0), inst->src[i].type),
                                inst->src[i].subreg_offset),
                    inst->exec_size * inst->src[i].stride,
-                   inst->exec_size, inst->src[i].stride);
+                   width, inst->src[i].stride);
          reg.abs = inst->src[i].abs;
          reg.negate = inst->src[i].negate;