Module: Mesa
Branch: main
Commit: 767ef6e02e06f379ce2aab6172b7b60eaf45ff0e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=767ef6e02e06f379ce2aab6172b7b60eaf45ff0e

Author: Mike Blumenkrantz <[email protected]>
Date:   Wed Mar  8 12:13:05 2023 -0500

aux/tc: flag late zs clears as partial clears

this ensures drivers can't optimize out a zs attachment that gets
a late clear

Fixes: 07017aa137b ("util/tc: implement renderpass tracking")

Acked-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21800>

---

 src/gallium/auxiliary/util/u_threaded_context.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_threaded_context.c 
b/src/gallium/auxiliary/util/u_threaded_context.c
index bb4f849160b..78e46e208b2 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -4379,8 +4379,13 @@ tc_clear(struct pipe_context *_pipe, unsigned buffers, 
const struct pipe_scissor
       if (info) {
          /* full clears use a different load operation, but are only valid if 
draws haven't occurred yet */
          info->cbuf_clear |= (buffers >> 2) & ~info->cbuf_load;
-         if (buffers & PIPE_CLEAR_DEPTHSTENCIL && !info->zsbuf_load && 
!info->zsbuf_clear_partial)
-            info->zsbuf_clear = true;
+         if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
+            if (!info->zsbuf_load && !info->zsbuf_clear_partial)
+               info->zsbuf_clear = true;
+            else if (!info->zsbuf_clear)
+               /* this is a clear that occurred after a draw: flag as partial 
to ensure it isn't ignored */
+               info->zsbuf_clear_partial = true;
+         }
       }
    }
    p->scissor_state_set = !!scissor_state;

Reply via email to