<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Sep 15, 2017 at 3:02 AM, Iago Toral Quiroga <span dir="ltr"><<a href="mailto:itoral@igalia.com" target="_blank">itoral@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
src/mesa/drivers/dri/i965/brw_<wbr>blorp.c | 12 ++----------<br>
src/mesa/drivers/dri/i965/brw_<wbr>clear.c | 2 +-<br>
src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h | 28 +++++++++++++++++++++++++++<br>
3 files changed, 31 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
index fde1257623..aba7b6ddb8 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
@@ -847,8 +847,8 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,<br>
brw_meta_convert_fast_clear_<wbr>color(brw, irb->mt,<br>
&ctx->Color.ClearColor);<br>
<br>
- bool same_clear_color = memcmp(&irb->mt->fast_clear_<wbr>color,<br>
- &clear_color, sizeof(clear_color)) == 0;<br>
+ bool same_clear_color =<br>
+ !intel_miptree_set_clear_<wbr>value(ctx, irb->mt, clear_color);<br>
<br>
/* If the buffer is already in INTEL_FAST_CLEAR_STATE_CLEAR, the clear<br>
* is redundant and can be skipped.<br>
@@ -856,14 +856,6 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,<br>
if (aux_state == ISL_AUX_STATE_CLEAR && same_clear_color)<br>
return;<br>
<br>
- irb->mt->fast_clear_color = clear_color;<br>
-<br>
- /* If the clear color has changed, we need to emit a new SURFACE_STATE<br>
- * on the next draw call.<br>
- */<br>
- if (!same_clear_color)<br>
- ctx->NewDriverState |= BRW_NEW_AUX_STATE;<br>
-<br>
DBG("%s (fast) to mt %p level %d layers %d+%d\n", __FUNCTION__,<br>
irb->mt, irb->mt_level, irb->mt_layer, num_layers);<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_clear.c b/src/mesa/drivers/dri/i965/<wbr>brw_clear.c<br>
index b9e087ce33..fe8634b3b3 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_clear.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_clear.c<br>
@@ -212,7 +212,7 @@ brw_fast_clear_depth(struct gl_context *ctx)<br>
}<br>
}<br>
<br>
- mt->fast_clear_color.f32[0] = clear_value;<br>
+ intel_miptree_set_depth_clear_<wbr>value(ctx, mt, clear_value);<br>
}<br>
<br>
bool need_clear = false;<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
index e2b23c5aad..452608c2f8 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
@@ -50,6 +50,7 @@<br>
#include "isl/isl.h"<br>
#include "blorp/blorp.h"<br>
#include "brw_bufmgr.h"<br>
+#include "brw_context.h"<br>
#include <GL/internal/dri_interface.h><br>
<br>
#ifdef __cplusplus<br>
@@ -710,6 +711,33 @@ bool<br>
intel_miptree_sample_with_hiz(<wbr>struct brw_context *brw,<br>
struct intel_mipmap_tree *mt);<br>
<br>
+<br>
+static inline bool<br>
+intel_miptree_set_clear_<wbr>value(struct gl_context *ctx,<br></blockquote><div><br></div><div>Maybe call this "set_clear_color"?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ struct intel_mipmap_tree *mt,<br>
+ union isl_color_value clear_value)<br>
+{<br>
+ if (memcmp(&mt->fast_clear_color, &clear_value, sizeof(clear_value)) != 0) {<br>
+ mt->fast_clear_color = clear_value;<br>
+ ctx->NewDriverState |= BRW_NEW_AUX_STATE;<br>
+ return true;<br>
+ }<br>
+ return false;<br>
+}<br>
+<br>
+static inline bool<br>
+intel_miptree_set_depth_<wbr>clear_value(struct gl_context *ctx,<br>
+ struct intel_mipmap_tree *mt,<br>
+ float clear_value)<br>
+{<br>
+ if (mt->fast_clear_color.f32[0] != clear_value) {<br>
+ mt->fast_clear_color.f32[0] = clear_value;<br>
+ ctx->NewDriverState |= BRW_NEW_AUX_STATE;<br>
+ return true;<br>
+ }<br>
+ return false;<br>
+}<br>
+<br>
#ifdef __cplusplus<br>
}<br>
#endif<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>