From 7ddb21708c800dfbe3cea2df6aaaf7aed852761b Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Sat, 27 Aug 2016 21:39:16 -0700 Subject: intel/isl: Add an isl_swizzle structure and use it for isl_view swizzles This should be more compact than the enum isl_channel_select[4] that we were using before. It's also very convenient because we already had such a structure in the Vulkan driver we just needed to pull it over. Signed-off-by: Jason Ekstrand Reviewed-by: Topi Pohjolainen --- src/intel/isl/isl.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/intel/isl/isl.h') diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h index e01624bfae9..d8260b2a0c5 100644 --- a/src/intel/isl/isl.h +++ b/src/intel/isl/isl.h @@ -854,6 +854,22 @@ struct isl_surf { isl_surf_usage_flags_t usage; }; +struct isl_swizzle { + enum isl_channel_select r:4; + enum isl_channel_select g:4; + enum isl_channel_select b:4; + enum isl_channel_select a:4; +}; + +#define ISL_SWIZZLE(R, G, B, A) ((struct isl_swizzle) { \ + .r = ISL_CHANNEL_SELECT_##R, \ + .g = ISL_CHANNEL_SELECT_##G, \ + .b = ISL_CHANNEL_SELECT_##B, \ + .a = ISL_CHANNEL_SELECT_##A, \ + }) + +#define ISL_SWIZZLE_IDENTITY ISL_SWIZZLE(RED, GREEN, BLUE, ALPHA) + struct isl_view { /** * Indicates the usage of the particular view @@ -889,7 +905,7 @@ struct isl_view { uint32_t base_array_layer; uint32_t array_len; - enum isl_channel_select channel_select[4]; + struct isl_swizzle swizzle; }; union isl_color_value { -- cgit v1.2.3