<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Apr 24, 2018 at 5:48 PM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Determine the predicate for updating the indirect depth value in the<br>
loop which inspects whether or not we need to resolve any slices.<br>
---<br>
src/mesa/drivers/dri/i965/brw_<wbr>clear.c | 43 +++++++++++++-----------------<wbr>-----<br>
1 file changed, 16 insertions(+), 27 deletions(-)<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 6521141d7f6..e372d28926e 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_clear.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_clear.c<br>
@@ -108,7 +108,6 @@ brw_fast_clear_depth(struct gl_context *ctx)<br>
struct intel_mipmap_tree *mt = depth_irb->mt;<br>
struct gl_renderbuffer_attachment *depth_att = &fb->Attachment[BUFFER_DEPTH];<br>
const struct gen_device_info *devinfo = &brw->screen->devinfo;<br>
- bool same_clear_value = true;<br>
<br>
if (devinfo->gen < 6)<br>
return false;<br>
@@ -174,9 +173,16 @@ brw_fast_clear_depth(struct gl_context *ctx)<br>
const uint32_t num_layers = depth_att->Layered ? depth_irb->layer_count : 1;<br>
<br>
/* If we're clearing to a new clear value, then we need to resolve any clear<br>
- * flags out of the HiZ buffer into the real depth buffer.<br>
+ * flags out of the HiZ buffer into the real depth buffer and update the<br>
+ * miptree's clear value.<br>
*/<br>
if (mt->fast_clear_color.f32[0] != clear_value) {<br>
+ /* BLORP updates the indirect clear color buffer when we do fast clears.<br>
+ * If we won't do a fast clear, we'll have to update it ourselves. Start<br>
+ * off assuming we won't perform a fast clear.<br>
+ */<br>
+ bool blorp_will_update_indirect_<wbr>color = false;<br></blockquote><div><br></div><div>This boolean is rather awkward.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
for (uint32_t level = mt->first_level; level <= mt->last_level; level++) {<br>
if (!intel_miptree_level_has_hiz(<wbr>mt, level))<br>
continue;<br>
@@ -184,16 +190,20 @@ brw_fast_clear_depth(struct gl_context *ctx)<br>
const unsigned level_layers = brw_get_num_logical_layers(mt, level);<br>
<br>
for (uint32_t layer = 0; layer < level_layers; layer++) {<br>
+ const enum isl_aux_state aux_state =<br>
+ intel_miptree_get_aux_state(<wbr>mt, level, layer);<br>
+<br>
if (level == depth_irb->mt_level &&<br>
layer >= depth_irb->mt_layer &&<br>
layer < depth_irb->mt_layer + num_layers) {<br>
+<br>
+ if (aux_state != ISL_AUX_STATE_CLEAR)<br>
+ blorp_will_update_indirect_<wbr>color = true;<br>
+<br>
/* We're going to clear this layer anyway. Leave it alone. */<br>
continue;<br>
}<br>
<br>
- enum isl_aux_state aux_state =<br>
- intel_miptree_get_aux_state(<wbr>mt, level, layer);<br>
-<br>
if (aux_state != ISL_AUX_STATE_CLEAR &&<br>
aux_state != ISL_AUX_STATE_COMPRESSED_<wbr>CLEAR) {<br>
/* This slice doesn't have any fast-cleared bits. */<br>
@@ -214,29 +224,8 @@ brw_fast_clear_depth(struct gl_context *ctx)<br>
}<br>
<br>
intel_miptree_set_depth_clear_<wbr>value(brw, mt, clear_value);<br>
- same_clear_value = false;<br>
- }<br>
-<br>
- bool need_clear = false;<br>
- for (unsigned a = 0; a < num_layers; a++) {<br>
- enum isl_aux_state aux_state =<br>
- intel_miptree_get_aux_state(<wbr>mt, depth_irb->mt_level,<br>
- depth_irb->mt_layer + a);<br>
-<br>
- if (aux_state != ISL_AUX_STATE_CLEAR) {<br>
- need_clear = true;<br>
- break;<br>
- }<br>
- }<br>
-<br>
- if (!need_clear) {<br>
- if (!same_clear_value) {<br>
- /* BLORP updates the indirect clear color buffer when performing a<br>
- * fast clear. Since we are skipping the fast clear here, we need to<br>
- * do the update ourselves.<br>
- */<br>
+ if (!blorp_will_update_indirect_<wbr>color)<br>
intel_miptree_update_indirect_<wbr>color(brw, mt);<br>
- }<br></blockquote><div><br></div><div>I think we can do this even better. We could do<br><br></div><div>bool blorp_updated_indirect_clear_color = false;<br><br></div><div>and then set it to true if we call intel_hiz_exec below. Then, after the loop below we would do<br><br></div><div>if (!blorp_updated_indirect_clear_color)<br></div><div> intel_miptree_update_indirect_color(brw, mt);<br><br></div><div>after we've done the clears.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
}<br>
<br>
for (unsigned a = 0; a < num_layers; a++) {<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.16.2<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>