From 2337820d49149126991d0814b225db7b57789016 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Wed, 19 Feb 2014 15:19:10 +0100 Subject: [PATCH] i965: Add non-mutating helper functions to modify the register offset. Yes, we could avoid having four copies of essentially the same code by using templates here. Reviewed-by: Paul Berry --- src/mesa/drivers/dri/i965/brw_fs.h | 8 ++++++++ src/mesa/drivers/dri/i965/brw_vec4.h | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 914ace67ce9..ce5050bd41a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -129,6 +129,14 @@ public: fs_reg *reladdr; }; +static inline fs_reg +offset(fs_reg reg, unsigned delta) +{ + assert(delta == 0 || (reg.file != HW_REG && reg.file != IMM)); + reg.reg_offset += delta; + return reg; +} + static inline fs_reg byte_offset(fs_reg reg, unsigned delta) { diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h index ecb16497fdb..3be17d890cf 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.h +++ b/src/mesa/drivers/dri/i965/brw_vec4.h @@ -140,6 +140,14 @@ public: src_reg *reladdr; }; +static inline src_reg +offset(src_reg reg, unsigned delta) +{ + assert(delta == 0 || (reg.file != HW_REG && reg.file != IMM)); + reg.reg_offset += delta; + return reg; +} + class dst_reg : public reg { public: @@ -160,6 +168,14 @@ public: src_reg *reladdr; }; +static inline dst_reg +offset(dst_reg reg, unsigned delta) +{ + assert(delta == 0 || (reg.file != HW_REG && reg.file != IMM)); + reg.reg_offset += delta; + return reg; +} + dst_reg with_writemask(dst_reg const &r, int mask); -- 2.30.2