summaryrefslogtreecommitdiffstats
path: root/src/intel/isl/isl.h
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-08-27 21:39:16 -0700
committerJason Ekstrand <[email protected]>2016-09-12 19:42:57 -0700
commit7ddb21708c800dfbe3cea2df6aaaf7aed852761b (patch)
treed6572da54873cc2f06aeef659aecaa1a868e89ab /src/intel/isl/isl.h
parent376d1dc2f1f5a36fe20ede5defe394b87b385731 (diff)
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 <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/intel/isl/isl.h')
-rw-r--r--src/intel/isl/isl.h18
1 files changed, 17 insertions, 1 deletions
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 {