[Mesa-dev] [PATCH] i965: Make convert_attr_sources_to_hw_regs handle stride == 0.

Kenneth Graunke kenneth at whitecape.org
Thu Nov 12 12:18:44 PST 2015


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.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index be712e5..c2dc8a9 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1618,11 +1618,17 @@ fs_visitor::convert_attr_sources_to_hw_regs(fs_inst *inst)
                    inst->src[i].reg_offset;
 
          inst->src[i].file = HW_REG;
-         inst->src[i].fixed_hw_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);
+         if (inst->src[i].stride == 0) {
+            inst->src[i].fixed_hw_reg =
+               byte_offset(retype(brw_vec1_grf(grf, 0), inst->src[i].type),
+                           inst->src[i].subreg_offset);
+         } else {
+            inst->src[i].fixed_hw_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);
+         }
       }
    }
 }
-- 
2.6.2



More information about the mesa-dev mailing list