[Mesa-dev] [PATCH 06/24] i965/fs: Fix half() to handle more exotic register files.

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


horiz_offset() is able to deal with a superset of the register files
currently special-cased in half().  Just call horiz_offset() in all
cases.
---
 src/mesa/drivers/dri/i965/brw_ir_fs.h | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index c604c9a..e9a85ab 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -186,31 +186,14 @@ is_uniform(const fs_reg &reg)
 }
 
 /**
- * Get either of the 8-component halves of a 16-component register.
- *
- * Note: this also works if \c reg represents a SIMD16 pair of registers.
+ * Get the specified 8-component quarter of a register.
+ * XXX - Maybe come up with a less misleading name for this (e.g. quarter())?
  */
 static inline fs_reg
-half(fs_reg reg, unsigned idx)
+half(const fs_reg &reg, unsigned idx)
 {
    assert(idx < 2);
-
-   switch (reg.file) {
-   case BAD_FILE:
-   case UNIFORM:
-   case IMM:
-      return reg;
-
-   case VGRF:
-   case MRF:
-      return horiz_offset(reg, 8 * idx);
-
-   case ARF:
-   case FIXED_GRF:
-   case ATTR:
-      unreachable("Cannot take half of this register type");
-   }
-   return reg;
+   return horiz_offset(reg, 8 * idx);
 }
 
 /**
-- 
2.7.3



More information about the mesa-dev mailing list