[Mesa-dev] [PATCH 01/23] i965/fs: fix subreg_offset overflow in byte_offset()

Samuel Iglesias Gonsálvez siglesias at igalia.com
Tue May 3 12:21:50 UTC 2016


From: Iago Toral Quiroga <itoral at igalia.com>

This can happen if the register already has a non-zero subreg_offset
when byte_offset() is called.
---
 src/mesa/drivers/dri/i965/brw_ir_fs.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index 2f72326..8faca08 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -109,6 +109,10 @@ byte_offset(fs_reg reg, unsigned delta)
       assert(delta == 0);
    }
    reg.subreg_offset += delta % 32;
+   if (reg.subreg_offset >= 32) {
+      reg.reg_offset += reg.subreg_offset / 32;
+      reg.subreg_offset %= 32;
+   }
    return reg;
 }
 
-- 
2.5.0



More information about the mesa-dev mailing list