Mesa (master): i965: add helper for creating packing writemask
Timothy Arceri
tarceri at kemper.freedesktop.org
Thu Jul 21 02:06:20 UTC 2016
Module: Mesa
Branch: master
Commit: 138aad06b3bc577f7ee2970ad02f3381da451896
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=138aad06b3bc577f7ee2970ad02f3381da451896
Author: Timothy Arceri <timothy.arceri at collabora.com>
Date: Thu Jun 23 12:52:05 2016 +1000
i965: add helper for creating packing writemask
For example where n=3 first_component=1 this will give us
0xE (WRITEMASK_YZW).
V2:
Add assert to check first component is <= 4 (Suggested by Ken)
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>
---
src/mesa/drivers/dri/i965/brw_reg.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h
index 7eab7b5..5b427b2 100644
--- a/src/mesa/drivers/dri/i965/brw_reg.h
+++ b/src/mesa/drivers/dri/i965/brw_reg.h
@@ -972,6 +972,13 @@ brw_writemask_for_size(unsigned n)
return (1 << n) - 1;
}
+static inline unsigned
+brw_writemask_for_component_packing(unsigned n, unsigned first_component)
+{
+ assert(first_component + n <= 4);
+ return (((1 << n) - 1) << first_component);
+}
+
static inline struct brw_reg
negate(struct brw_reg reg)
{
More information about the mesa-commit
mailing list