summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-01-31 16:17:26 -0800
committerJason Ekstrand <[email protected]>2017-02-01 12:07:54 -0800
commit0c114f2cf06858720757bdccaafb0378e20bc20e (patch)
tree10d531f1b8c3538dd3cebf1a38d44fea4c212dc6
parentf90ccf48bcd668ee3272c85b691ab8262a46b997 (diff)
isl: Add assertions for render target swizzle restrictions
Reviewed-by: Anuj Phogat <[email protected]>
-rw-r--r--src/intel/isl/isl_surface_state.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c
index b7354781cf0..c7b220b73fb 100644
--- a/src/intel/isl/isl_surface_state.c
+++ b/src/intel/isl/isl_surface_state.c
@@ -453,6 +453,38 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
#endif
#if (GEN_GEN >= 8 || GEN_IS_HASWELL)
+ if (info->view->usage & ISL_SURF_USAGE_RENDER_TARGET_BIT) {
+ /* From the Sky Lake PRM Vol. 2d,
+ * RENDER_SURFACE_STATE::Shader Channel Select Red
+ *
+ * "For Render Target, Red, Green and Blue Shader Channel Selects
+ * MUST be such that only valid components can be swapped i.e. only
+ * change the order of components in the pixel. Any other values for
+ * these Shader Channel Select fields are not valid for Render
+ * Targets. This also means that there MUST not be multiple shader
+ * channels mapped to the same RT channel."
+ */
+ assert(info->view->swizzle.r == ISL_CHANNEL_SELECT_RED ||
+ info->view->swizzle.r == ISL_CHANNEL_SELECT_GREEN ||
+ info->view->swizzle.r == ISL_CHANNEL_SELECT_BLUE);
+ assert(info->view->swizzle.g == ISL_CHANNEL_SELECT_RED ||
+ info->view->swizzle.g == ISL_CHANNEL_SELECT_GREEN ||
+ info->view->swizzle.g == ISL_CHANNEL_SELECT_BLUE);
+ assert(info->view->swizzle.b == ISL_CHANNEL_SELECT_RED ||
+ info->view->swizzle.b == ISL_CHANNEL_SELECT_GREEN ||
+ info->view->swizzle.b == ISL_CHANNEL_SELECT_BLUE);
+ assert(info->view->swizzle.r != info->view->swizzle.g);
+ assert(info->view->swizzle.r != info->view->swizzle.b);
+ assert(info->view->swizzle.g != info->view->swizzle.b);
+
+ /* From the Sky Lake PRM Vol. 2d,
+ * RENDER_SURFACE_STATE::Shader Channel Select Alpha
+ *
+ * "For Render Target, this field MUST be programmed to
+ * value = SCS_ALPHA."
+ */
+ assert(info->view->swizzle.a == ISL_CHANNEL_SELECT_ALPHA);
+ }
s.ShaderChannelSelectRed = info->view->swizzle.r;
s.ShaderChannelSelectGreen = info->view->swizzle.g;
s.ShaderChannelSelectBlue = info->view->swizzle.b;