freedreno: Check cb0 in rebind_resource()
authorRob Clark <robdclark@chromium.org>
Wed, 10 Mar 2021 16:44:55 +0000 (08:44 -0800)
committerMarge Bot <eric+marge@anholt.net>
Thu, 11 Mar 2021 04:42:16 +0000 (04:42 +0000)
Previously we were expecting cb0 to be user_buffer.  (We did in some
cases upload it to a gpu buffer, but this was an internally allocated
buffer and not something subject to rebind.)  But with TC it becomes
a gpu buffer.

(Technically, with pctx->const_uploader, we shouldn't hit the rebind
path for cb0, but better to not try to be overly clever.. sooner or
later that would bite us.)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9323>

src/gallium/drivers/freedreno/freedreno_resource.c

index ef6297d..2c0a7c0 100644 (file)
@@ -99,7 +99,7 @@ rebind_resource_in_ctx(struct fd_context *ctx, struct fd_resource *rsc)
                                !(ctx->dirty_shader[stage] & FD_DIRTY_CONST)) {
                        struct fd_constbuf_stateobj *cb = &ctx->constbuf[stage];
                        const unsigned num_ubos = util_last_bit(cb->enabled_mask);
-                       for (unsigned i = 1; i < num_ubos; i++) {
+                       for (unsigned i = 0; i < num_ubos; i++) {
                                if (cb->cb[i].buffer == prsc) {
                                        ctx->dirty_shader[stage] |= FD_DIRTY_SHADER_CONST;
                                        ctx->dirty |= FD_DIRTY_CONST;