* programmed in SURFACE_STATE by later rendering and resolve
* operations.
*/
- brw_meta_set_fast_clear_color(brw, irb->mt, &ctx->Color.ClearColor);
+ const bool color_updated = brw_meta_set_fast_clear_color(
+ brw, irb->mt, &ctx->Color.ClearColor);
/* If the buffer is already in INTEL_FAST_CLEAR_STATE_CLEAR, the clear
* is redundant and can be skipped.
*/
- if (irb->mt->fast_clear_state == INTEL_FAST_CLEAR_STATE_CLEAR)
+ if (!color_updated &&
+ irb->mt->fast_clear_state == INTEL_FAST_CLEAR_STATE_CLEAR)
return true;
/* If the MCS buffer hasn't been allocated yet, we need to allocate
/**
* Convert the given color to a bitfield suitable for ORing into DWORD 7 of
* SURFACE_STATE (DWORD 12-15 on SKL+).
+ *
+ * Returned boolean tells if the given color differs from the stored.
*/
-void
+bool
brw_meta_set_fast_clear_color(struct brw_context *brw,
struct intel_mipmap_tree *mt,
const union gl_color_union *color)
}
}
+ bool updated;
if (brw->gen >= 9) {
+ updated = memcmp(&mt->gen9_fast_clear_color, &override_color,
+ sizeof(mt->gen9_fast_clear_color));
mt->gen9_fast_clear_color = override_color;
} else {
+ const uint32_t old_color_value = mt->fast_clear_color_value;
+
mt->fast_clear_color_value = 0;
for (int i = 0; i < 4; i++) {
/* Testing for non-0 works for integer and float colors */
1 << (GEN7_SURFACE_CLEAR_COLOR_SHIFT + (3 - i));
}
}
+
+ updated = (old_color_value != mt->fast_clear_color_value);
}
+
+ return updated;
}
static const uint32_t fast_clear_color[4] = { ~0, ~0, ~0, ~0 };
unsigned *x0, unsigned *y0,
unsigned *x1, unsigned *y1);
-void
+bool
brw_meta_set_fast_clear_color(struct brw_context *brw,
struct intel_mipmap_tree *mt,
const union gl_color_union *color);