[Mesa-dev] [PATCH 35/41] i966/fs: Add a function for getting a component of a 8 or 16-wide register

Jason Ekstrand jason at jlekstrand.net
Sat Sep 20 10:23:24 PDT 2014


---
 src/mesa/drivers/dri/i965/brw_fs.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 491fc4d..fe450a8 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -161,6 +161,16 @@ offset(fs_reg reg, unsigned delta)
    return reg;
 }
 
+static inline fs_reg
+component(fs_reg reg, unsigned idx)
+{
+   assert(reg.subreg_offset == 0);
+   assert(idx < reg.width);
+   reg.subreg_offset = idx * type_sz(reg.type);
+   reg.width = 1;
+   return reg;
+}
+
 /**
  * Get either of the 8-component halves of a 16-component register.
  *
-- 
2.1.0



More information about the mesa-dev mailing list