summaryrefslogtreecommitdiffstats
path: root/src/intel/isl
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-08-27 21:39:16 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2016-09-12 19:42:57 -0700
commit7ddb21708c800dfbe3cea2df6aaaf7aed852761b (patch)
treed6572da54873cc2f06aeef659aecaa1a868e89ab /src/intel/isl
parent376d1dc2f1f5a36fe20ede5defe394b87b385731 (diff)
downloadexternal_mesa3d-7ddb21708c800dfbe3cea2df6aaaf7aed852761b.zip
external_mesa3d-7ddb21708c800dfbe3cea2df6aaaf7aed852761b.tar.gz
external_mesa3d-7ddb21708c800dfbe3cea2df6aaaf7aed852761b.tar.bz2
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 <jason@jlekstrand.net> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Diffstat (limited to 'src/intel/isl')
-rw-r--r--src/intel/isl/isl.h18
-rw-r--r--src/intel/isl/isl_surface_state.c8
2 files changed, 21 insertions, 5 deletions
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index e01624b..d8260b2 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 {
diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c
index 5c5386e..5845175 100644
--- a/src/intel/isl/isl_surface_state.c
+++ b/src/intel/isl/isl_surface_state.c
@@ -411,10 +411,10 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
#endif
#if (GEN_GEN >= 8 || GEN_IS_HASWELL)
- s.ShaderChannelSelectRed = info->view->channel_select[0];
- s.ShaderChannelSelectGreen = info->view->channel_select[1];
- s.ShaderChannelSelectBlue = info->view->channel_select[2];
- s.ShaderChannelSelectAlpha = info->view->channel_select[3];
+ s.ShaderChannelSelectRed = info->view->swizzle.r;
+ s.ShaderChannelSelectGreen = info->view->swizzle.g;
+ s.ShaderChannelSelectBlue = info->view->swizzle.b;
+ s.ShaderChannelSelectAlpha = info->view->swizzle.a;
#endif
s.SurfaceBaseAddress = info->address;