i965/fs: Add a function for getting a component of a 8 or 16-wide register
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 11 Sep 2014 23:15:10 +0000 (16:15 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 30 Sep 2014 17:29:15 +0000 (10:29 -0700)
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_fs.h

index e5202f0850bd5b2a8ba4bbae762e3371cca450a4..57c5dc3fe47721191c44d39d331f1bc575ae514d 100644 (file)
@@ -162,6 +162,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.
  *