brw_meta_convert_fast_clear_color(brw, irb->mt,
&ctx->Color.ClearColor);
- bool same_clear_color = memcmp(&irb->mt->fast_clear_color,
- &clear_color, sizeof(clear_color)) == 0;
+ bool same_clear_color =
+ !intel_miptree_set_clear_color(ctx, irb->mt, clear_color);
/* If the buffer is already in INTEL_FAST_CLEAR_STATE_CLEAR, the clear
* is redundant and can be skipped.
if (aux_state == ISL_AUX_STATE_CLEAR && same_clear_color)
return;
- irb->mt->fast_clear_color = clear_color;
-
- /* If the clear color has changed, we need to emit a new SURFACE_STATE
- * on the next draw call.
- */
- if (!same_clear_color)
- ctx->NewDriverState |= BRW_NEW_AUX_STATE;
-
DBG("%s (fast) to mt %p level %d layers %d+%d\n", __FUNCTION__,
irb->mt, irb->mt_level, irb->mt_layer, num_layers);
#include "isl/isl.h"
#include "blorp/blorp.h"
#include "brw_bufmgr.h"
+#include "brw_context.h"
#include <GL/internal/dri_interface.h>
#ifdef __cplusplus
intel_miptree_sample_with_hiz(struct brw_context *brw,
struct intel_mipmap_tree *mt);
+
+static inline bool
+intel_miptree_set_clear_color(struct gl_context *ctx,
+ struct intel_mipmap_tree *mt,
+ union isl_color_value clear_color)
+{
+ if (memcmp(&mt->fast_clear_color, &clear_color, sizeof(clear_color)) != 0) {
+ mt->fast_clear_color = clear_color;
+ ctx->NewDriverState |= BRW_NEW_AUX_STATE;
+ return true;
+ }
+ return false;
+}
+
+static inline bool
+intel_miptree_set_depth_clear_value(struct gl_context *ctx,
+ struct intel_mipmap_tree *mt,
+ float clear_value)
+{
+ if (mt->fast_clear_color.f32[0] != clear_value) {
+ mt->fast_clear_color.f32[0] = clear_value;
+ ctx->NewDriverState |= BRW_NEW_AUX_STATE;
+ return true;
+ }
+ return false;
+}
+
#ifdef __cplusplus
}
#endif