r600: store the mask of buffers used by a vertex state
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 17 Aug 2023 13:38:13 +0000 (09:38 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 18 Aug 2023 18:58:08 +0000 (18:58 +0000)
Fixes: 76725452 (gallium: move vertex stride to CSO)

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24754>

src/gallium/drivers/r600/r600_asm.c
src/gallium/drivers/r600/r600_pipe.h

index 0a40b84..f51fae6 100644 (file)
@@ -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,
index 04aab66..da4dbf3 100644 (file)
@@ -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];
 };