[Mesa-dev] [PATCH 11/78] i965/vec4: Add auxiliary func to build a writemask from a component size

Eduardo Lima Mitev elima at igalia.com
Fri Jun 26 01:06:27 PDT 2015


New method brw_writemask_for_size() will return a writemask with the first 'size'
components activated.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89580
---
 src/mesa/drivers/dri/i965/brw_reg.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h
index c8b1341..83fe488 100644
--- a/src/mesa/drivers/dri/i965/brw_reg.h
+++ b/src/mesa/drivers/dri/i965/brw_reg.h
@@ -950,6 +950,15 @@ brw_set_writemask(struct brw_reg reg, unsigned mask)
    return reg;
 }
 
+static inline unsigned
+brw_writemask_for_size(unsigned n)
+{
+  unsigned writemask = 0;
+  for (unsigned i = 0; i < n; i++)
+     writemask |= 1 << i;
+  return writemask;
+}
+
 static inline struct brw_reg
 negate(struct brw_reg reg)
 {
-- 
2.1.4



More information about the mesa-dev mailing list