freedreno: Fix tracking of enabled SSBOs
authorRob Clark <robdclark@chromium.org>
Tue, 3 Jan 2023 22:23:28 +0000 (14:23 -0800)
committerEric Engestrom <eric@engestrom.ch>
Thu, 26 Jan 2023 15:40:31 +0000 (15:40 +0000)
Clearing all of the modified bits an relying on OR'ing the needed bits
back in the loop below doesn't quite work out, Because of early continue
if the SSBO has not changed.

Fixes: 0ed053f03d9 ("freedreno: simplify fd_set_shader_buffers(..)")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20575>
(cherry picked from commit e41d19a7119f2ad92d1765842e066cb84b90014b)

.pick_status.json
src/gallium/drivers/freedreno/freedreno_state.c

index 0416d37..a557b1c 100644 (file)
         "description": "freedreno: Fix tracking of enabled SSBOs",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "0ed053f03d936d301091dd68e96ced8dbedc83b2"
     },
index a23870b..f5bcd88 100644 (file)
@@ -164,7 +164,6 @@ fd_set_shader_buffers(struct pipe_context *pctx, enum pipe_shader_type shader,
    struct fd_shaderbuf_stateobj *so = &ctx->shaderbuf[shader];
    const unsigned modified_bits = u_bit_consecutive(start, count);
 
-   so->enabled_mask &= ~modified_bits;
    so->writable_mask &= ~modified_bits;
    so->writable_mask |= writable_bitmask << start;
 
@@ -194,6 +193,8 @@ fd_set_shader_buffers(struct pipe_context *pctx, enum pipe_shader_type shader,
          }
       } else {
          pipe_resource_reference(&buf->buffer, NULL);
+
+         so->enabled_mask &= ~BIT(n);
       }
    }