aux/tc: fix renderpass tracking fb state clobber scenario
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 11 Sep 2023 13:41:37 +0000 (09:41 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 13 Sep 2023 17:50:58 +0000 (17:50 +0000)
in a stream like:
* set fb state (A)
* flush
* set fb state (B)
* draw -> driver query
* flush

the "driver query" should return the tc info corresponding to the most
recent fb state (B). previously this would increment to C because
the flag for incrementing at the start of a batch was set

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

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25206>

src/gallium/auxiliary/util/u_threaded_context.c

index 4b59a9b..3423a8e 100644 (file)
@@ -1458,6 +1458,13 @@ tc_set_framebuffer_state(struct pipe_context *_pipe,
 
 
    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 &&
+          !tc->renderpass_info_recording->cbuf_clear &&
+          !tc->renderpass_info_recording->cbuf_load &&
+          !tc->renderpass_info_recording->zsbuf_load &&
+          !tc->renderpass_info_recording->zsbuf_clear_partial)
+         tc->batch_slots[tc->next].first_set_fb = false;
       /* store existing zsbuf data for possible persistence */
       uint8_t zsbuf = tc->renderpass_info_recording->has_draw ?
                       0 :