From 63267bcb944598b14fbd0a34631e82ba68729dcf Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 17 Aug 2023 09:38:13 -0400 Subject: [PATCH] r600: store the mask of buffers used by a vertex state Fixes: 76725452 (gallium: move vertex stride to CSO) Reviewed-by: Gert Wollny Part-of: --- src/gallium/drivers/r600/r600_asm.c | 3 +++ src/gallium/drivers/r600/r600_pipe.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 0a40b84da98..f51fae64d04 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -2814,6 +2814,7 @@ void *r600_create_vertex_fetch_shader(struct pipe_context *ctx, unsigned format, num_format, format_comp, endian; uint32_t *bytecode; int i, j, r, fs_size; + uint32_t buffer_mask = 0; struct r600_fetch_shader *shader; unsigned strides[PIPE_MAX_ATTRIBS]; @@ -2864,6 +2865,7 @@ void *r600_create_vertex_fetch_shader(struct pipe_context *ctx, } } strides[elements[i].vertex_buffer_index] = elements[i].src_stride; + buffer_mask |= BITFIELD_BIT(elements[i].vertex_buffer_index); } for (i = 0; i < count; i++) { @@ -2929,6 +2931,7 @@ void *r600_create_vertex_fetch_shader(struct pipe_context *ctx, return NULL; } memcpy(shader->strides, strides, sizeof(strides)); + shader->buffer_mask = buffer_mask; u_suballocator_alloc(&rctx->allocator_fetch_shader, fs_size, 256, &shader->offset, diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 04aab66127d..da4dbf3f4d2 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -434,6 +434,7 @@ struct r600_cso_state struct r600_fetch_shader { struct r600_resource *buffer; unsigned offset; + uint32_t buffer_mask; unsigned strides[PIPE_MAX_ATTRIBS]; };