[Mesa-dev] [PATCH 32/57] i965/fs: Simplify byte_offset().

Francisco Jerez currojerez at riseup.net
Thu Sep 8 01:48:59 UTC 2016


In the most common case this can now be implemented as a simple
addition because the offset is already encoded as a single scalar
value in bytes.
---
 src/mesa/drivers/dri/i965/brw_ir_fs.h | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index 721c2eb..e8e25b9 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -79,17 +79,13 @@ byte_offset(fs_reg reg, unsigned delta)
       break;
    case VGRF:
    case ATTR:
-   case UNIFORM: {
-      const unsigned reg_size = (reg.file == UNIFORM ? 4 : REG_SIZE);
-      const unsigned suboffset = reg.offset % reg_size + delta;
-      reg.offset += ROUND_DOWN_TO(suboffset, reg_size);
-      reg.offset = ROUND_DOWN_TO(reg.offset, reg_size) + suboffset % reg_size;
+   case UNIFORM:
+      reg.offset += delta;
       break;
-   }
    case MRF: {
-      const unsigned suboffset = reg.offset % REG_SIZE + delta;
+      const unsigned suboffset = reg.offset + delta;
       reg.nr += suboffset / REG_SIZE;
-      reg.offset = ROUND_DOWN_TO(reg.offset, REG_SIZE) + suboffset % REG_SIZE;
+      reg.offset = suboffset % REG_SIZE;
       break;
    }
    case ARF:
-- 
2.9.0



More information about the mesa-dev mailing list