From 53aade0ef0def4ea7f8468cdec04acd2384e2d2c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 15 Sep 2021 10:50:03 -0400 Subject: [PATCH] zink: fix enabled vertex buffer mask calculation the mask can't entirely be calculated based on the integer parameters, as it's possible for some of the "bind" slots to actually be unbinds, so remove bits as necessary to fix this also add some debug asserts to ensure I don't break this again for the tenth time Fixes: 6dd02a5139a ("zink: stop using util_set_vertex_buffers_mask()") Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index d35332d..1f97c14 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -938,7 +938,8 @@ zink_set_vertex_buffers(struct pipe_context *pctx, zink_resource_buffer_barrier(ctx, res, VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT); set_vertex_buffer_clamped(ctx, start_slot + i); - } + } else + enabled_buffers &= ~BITFIELD_BIT(i); } } else { if (need_state_change) @@ -954,6 +955,10 @@ zink_set_vertex_buffers(struct pipe_context *pctx, } ctx->gfx_pipeline_state.vertex_buffers_enabled_mask = enabled_buffers; ctx->vertex_buffers_dirty = num_buffers > 0; +#ifndef NDEBUG + u_foreach_bit(b, enabled_buffers) + assert(ctx->vertex_buffers[b].buffer.resource); +#endif } static void -- 2.7.4