[Mesa-dev] [PATCH 05/24] i965/fs: Fix horiz_offset() to handle ARF and HW GRF register files.

Francisco Jerez currojerez at riseup.net
Fri May 27 03:46:10 UTC 2016


We'll hit these in some cases during SIMD lowering in 32-wide
programs.
---
 src/mesa/drivers/dri/i965/brw_ir_fs.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index 7c9c933..c604c9a 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -113,7 +113,7 @@ byte_offset(fs_reg reg, unsigned delta)
 }
 
 static inline fs_reg
-horiz_offset(fs_reg reg, unsigned delta)
+horiz_offset(const fs_reg &reg, unsigned delta)
 {
    switch (reg.file) {
    case BAD_FILE:
@@ -121,17 +121,23 @@ horiz_offset(fs_reg reg, unsigned delta)
    case IMM:
       /* These only have a single component that is implicitly splatted.  A
        * horizontal offset should be a harmless no-op.
+       * XXX - Handle vector immediates correctly.
        */
-      break;
+      return reg;
    case VGRF:
    case MRF:
    case ATTR:
       return byte_offset(reg, delta * reg.stride * type_sz(reg.type));
    case ARF:
    case FIXED_GRF:
-      assert(delta == 0);
+      if (reg.is_null()) {
+         return reg;
+      } else {
+         const unsigned stride = reg.hstride ? 1 << (reg.hstride - 1) : 0;
+         return byte_offset(reg, delta * stride * type_sz(reg.type));
+      }
    }
-   return reg;
+   unreachable("Invalid register file");
 }
 
 /**
-- 
2.7.3



More information about the mesa-dev mailing list