[Mesa-dev] [PATCH 10/17] i965: add helper for creating packing writemask

Timothy Arceri timothy.arceri at collabora.com
Thu Jul 7 01:58:52 UTC 2016


For example where n=3 first_component=1 this will give us
0xE (WRITEMASK_YZW).
---
 src/mesa/drivers/dri/i965/brw_reg.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h
index 8e6fcd5..792015b 100644
--- a/src/mesa/drivers/dri/i965/brw_reg.h
+++ b/src/mesa/drivers/dri/i965/brw_reg.h
@@ -972,6 +972,12 @@ brw_writemask_for_size(unsigned n)
    return (1 << n) - 1;
 }
 
+static inline unsigned
+brw_writemask_for_component_packing(unsigned n, unsigned first_component)
+{
+   return (((1 << n) - 1) << first_component);
+}
+
 static inline struct brw_reg
 negate(struct brw_reg reg)
 {
-- 
2.7.4



More information about the mesa-dev mailing list