i965: add helpers for creating component layout swizzle
authorTimothy Arceri <timothy.arceri@collabora.com>
Wed, 22 Jun 2016 23:32:39 +0000 (09:32 +1000)
committerTimothy Arceri <timothy.arceri@collabora.com>
Thu, 21 Jul 2016 02:06:11 +0000 (12:06 +1000)
This will be used to swizzle components to the beginning or end
of the vector based on the component layout qualifier and whether
we are doing a load or store.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
src/mesa/drivers/dri/i965/brw_reg.h

index 38cf8e313714d77b3380ad9d4b4fa3bc4f05dff9..7eab7b51e380b98d7c8f2aa1195f0acc7c7a825e 100644 (file)
@@ -88,6 +88,9 @@ struct brw_device_info;
 #define BRW_SWIZZLE_ZWZW      BRW_SWIZZLE4(2,3,2,3)
 #define BRW_SWIZZLE_WZYX      BRW_SWIZZLE4(3,2,1,0)
 
+#define BRW_SWZ_COMP_INPUT(comp) (BRW_SWIZZLE_XYZW >> ((comp)*2))
+#define BRW_SWZ_COMP_OUTPUT(comp) (BRW_SWIZZLE_XYZW << ((comp)*2))
+
 static inline bool
 brw_is_single_value_swizzle(unsigned swiz)
 {