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: 6dd02a5139 ("zink: stop using util_set_vertex_buffers_mask()")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12871>
This commit is contained in:
Mike Blumenkrantz 2021-09-15 10:50:03 -04:00 committed by Marge Bot
parent 09bb8602f3
commit 53aade0ef0
1 changed files with 6 additions and 1 deletions

View File

@ -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