[Mesa-dev] [PATCH 2/5] i965/fs: fix stride and type for hw_reg's in regs_read()

Connor Abbott cwabbott0 at gmail.com
Wed Jul 1 11:51:36 PDT 2015


sources with file == HW_REG get all their information from the
fixed_hw_reg field, so we need to get the stride and type from there
when computing the size.

Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 38b9095..64f093b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -696,24 +696,36 @@ fs_inst::regs_read(int arg) const
       break;
    }
 
+   unsigned stride;
+   enum brw_reg_type type;
+
    switch (src[arg].file) {
    case BAD_FILE:
    case UNIFORM:
    case IMM:
       return 1;
+
    case GRF:
+      stride = src[arg].stride;
+      type = src[arg].type;
+      break;
+
    case HW_REG:
-      if (src[arg].stride == 0) {
-         return 1;
-      } else {
-         int size = components * this->exec_size * type_sz(src[arg].type);
-         return DIV_ROUND_UP(size * src[arg].stride, 32);
-      }
+      stride = src[arg].fixed_hw_reg.hstride;
+      type = src[arg].fixed_hw_reg.type;
+      break;
+
    case MRF:
       unreachable("MRF registers are not allowed as sources");
    default:
       unreachable("Invalid register file");
    }
+
+   if (stride == 0)
+      return 1;
+
+   int size = components * this->exec_size * type_sz(type);
+   return DIV_ROUND_UP(size * stride, 32);
 }
 
 bool
-- 
2.4.3



More information about the mesa-dev mailing list