summaryrefslogtreecommitdiffstats
path: root/src/intel/isl/isl_surface_state.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-08-05 15:06:36 -0700
committerJason Ekstrand <[email protected]>2016-08-17 14:46:22 -0700
commitdc880c99b656988eadf012000a01869e40be8f57 (patch)
tree81442105d907b8b0d0534eb5c78bfe2fd92eeecf /src/intel/isl/isl_surface_state.c
parent2684e48321ac2a22161ae3ed1c21c0169946eed9 (diff)
isl/state: Only set clear color if aux is used
Otherwise, the clear color will get ignored. This prevents assertion errors if clear color is set to something invalid and aux is not used. Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/intel/isl/isl_surface_state.c')
-rw-r--r--src/intel/isl/isl_surface_state.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c
index 990b7633d98..4a7e921a798 100644
--- a/src/intel/isl/isl_surface_state.c
+++ b/src/intel/isl/isl_surface_state.c
@@ -503,35 +503,37 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
}
#endif
+ if (info->aux_usage != ISL_AUX_USAGE_NONE) {
#if GEN_GEN >= 9
- s.RedClearColor = info->clear_color.u32[0];
- s.GreenClearColor = info->clear_color.u32[1];
- s.BlueClearColor = info->clear_color.u32[2];
- s.AlphaClearColor = info->clear_color.u32[3];
+ s.RedClearColor = info->clear_color.u32[0];
+ s.GreenClearColor = info->clear_color.u32[1];
+ s.BlueClearColor = info->clear_color.u32[2];
+ s.AlphaClearColor = info->clear_color.u32[3];
#elif GEN_GEN >= 7
- /* Prior to Sky Lake, we only have one bit for the clear color which
- * gives us 0 or 1 in whatever the surface's format happens to be.
- */
- if (isl_format_has_int_channel(info->view->format)) {
- for (unsigned i = 0; i < 4; i++) {
- assert(info->clear_color.u32[i] == 0 ||
- info->clear_color.u32[i] == 1);
- }
- s.RedClearColor = info->clear_color.u32[0] != 0;
- s.GreenClearColor = info->clear_color.u32[1] != 0;
- s.BlueClearColor = info->clear_color.u32[2] != 0;
- s.AlphaClearColor = info->clear_color.u32[3] != 0;
- } else {
- for (unsigned i = 0; i < 4; i++) {
- assert(info->clear_color.f32[i] == 0.0f ||
- info->clear_color.f32[i] == 1.0f);
+ /* Prior to Sky Lake, we only have one bit for the clear color which
+ * gives us 0 or 1 in whatever the surface's format happens to be.
+ */
+ if (isl_format_has_int_channel(info->view->format)) {
+ for (unsigned i = 0; i < 4; i++) {
+ assert(info->clear_color.u32[i] == 0 ||
+ info->clear_color.u32[i] == 1);
+ }
+ s.RedClearColor = info->clear_color.u32[0] != 0;
+ s.GreenClearColor = info->clear_color.u32[1] != 0;
+ s.BlueClearColor = info->clear_color.u32[2] != 0;
+ s.AlphaClearColor = info->clear_color.u32[3] != 0;
+ } else {
+ for (unsigned i = 0; i < 4; i++) {
+ assert(info->clear_color.f32[i] == 0.0f ||
+ info->clear_color.f32[i] == 1.0f);
+ }
+ s.RedClearColor = info->clear_color.f32[0] != 0.0f;
+ s.GreenClearColor = info->clear_color.f32[1] != 0.0f;
+ s.BlueClearColor = info->clear_color.f32[2] != 0.0f;
+ s.AlphaClearColor = info->clear_color.f32[3] != 0.0f;
}
- s.RedClearColor = info->clear_color.f32[0] != 0.0f;
- s.GreenClearColor = info->clear_color.f32[1] != 0.0f;
- s.BlueClearColor = info->clear_color.f32[2] != 0.0f;
- s.AlphaClearColor = info->clear_color.f32[3] != 0.0f;
- }
#endif
+ }
GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &s);
}