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

Author: Mike Blumenkrantz <[email protected]>
Date:   Wed Oct  4 13:42:52 2023 -0400

tc: always track fb attachments

this should have no measurable impact on perf

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

---

 src/gallium/auxiliary/util/u_threaded_context.c | 27 +++++++++----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_threaded_context.c 
b/src/gallium/auxiliary/util/u_threaded_context.c
index 5dc6e6be39a..05c0c4ffe25 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -1460,7 +1460,14 @@ tc_set_framebuffer_state(struct pipe_context *_pipe,
    p->state.layers = fb->layers;
    p->state.nr_cbufs = nr_cbufs;
 
-
+   for (unsigned i = 0; i < nr_cbufs; i++) {
+      p->state.cbufs[i] = NULL;
+      pipe_surface_reference(&p->state.cbufs[i], fb->cbufs[i]);
+      /* full tracking requires storing the fb attachment resources */
+      tc->fb_resources[i] = fb->cbufs[i] ? fb->cbufs[i]->texture : NULL;
+   }
+   memset(&tc->fb_resources[nr_cbufs], 0,
+            sizeof(void*) * (PIPE_MAX_COLOR_BUFS - nr_cbufs));
    if (tc->options.parse_renderpass_info) {
       /* ensure this is treated as the first fb set if no fb activity has 
occurred */
       if (!tc->renderpass_info_recording->has_draw &&
@@ -1476,17 +1483,6 @@ tc_set_framebuffer_state(struct pipe_context *_pipe,
       bool zsbuf_changed = tc->fb_resources[PIPE_MAX_COLOR_BUFS] !=
                            (fb->zsbuf ? fb->zsbuf->texture : NULL);
 
-      for (unsigned i = 0; i < nr_cbufs; i++) {
-         p->state.cbufs[i] = NULL;
-         pipe_surface_reference(&p->state.cbufs[i], fb->cbufs[i]);
-         /* full tracking requires storing the fb attachment resources */
-         tc->fb_resources[i] = fb->cbufs[i] ? fb->cbufs[i]->texture : NULL;
-      }
-      memset(&tc->fb_resources[nr_cbufs], 0,
-             sizeof(void*) * (PIPE_MAX_COLOR_BUFS - nr_cbufs));
-
-      tc->fb_resources[PIPE_MAX_COLOR_BUFS] = fb->zsbuf ? fb->zsbuf->texture : 
NULL;
-      tc->fb_resolve = fb->resolve;
       if (tc->seen_fb_state) {
          /* this is the end of a renderpass, so increment the renderpass info 
*/
          tc_batch_increment_renderpass_info(tc, tc->next, false);
@@ -1503,12 +1499,9 @@ tc_set_framebuffer_state(struct pipe_context *_pipe,
       }
       /* future fb state changes will increment the index */
       tc->seen_fb_state = true;
-   } else {
-      for (unsigned i = 0; i < nr_cbufs; i++) {
-         p->state.cbufs[i] = NULL;
-         pipe_surface_reference(&p->state.cbufs[i], fb->cbufs[i]);
-      }
    }
+   tc->fb_resources[PIPE_MAX_COLOR_BUFS] = fb->zsbuf ? fb->zsbuf->texture : 
NULL;
+   tc->fb_resolve = fb->resolve;
    tc->in_renderpass = false;
    p->state.zsbuf = NULL;
    pipe_surface_reference(&p->state.zsbuf, fb->zsbuf);

Reply via email to