From 8236fa3ff166053f7e47a1a768631d3e9bf800bd Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 14 Aug 2020 12:09:05 -0400 Subject: [PATCH] panfrost: Make attribute-buffer map explicit This helps decouple the attribute and attribute buffer emission. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 41abf57b0be..28607b4b7d5 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -1348,6 +1348,7 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch, * vertex buffer mask and instancing. Twice as much room is allocated, * for a worst case of NPOT_DIVIDEs which take up extra slot */ union mali_attr attrs[PIPE_MAX_ATTRIBS * 2]; + unsigned attrib_to_buffer[PIPE_MAX_ATTRIBS] = { 0 }; unsigned k = 0; for (unsigned i = 0; i < so->num_elements; ++i) { @@ -1358,11 +1359,7 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch, struct pipe_vertex_element *elem = &so->pipe[i]; unsigned vbi = elem->vertex_buffer_index; - - /* The exception to 1:1 mapping is that we can have multiple - * entries (NPOT divisors), so we fixup anyways */ - - so->hw[i].index = k; + attrib_to_buffer[i] = k; if (!(ctx->vb_mask & (1 << vbi))) continue; @@ -1470,6 +1467,7 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch, src_offset -= buf->stride * start; so->hw[i].src_offset = src_offset; + so->hw[i].index = attrib_to_buffer[i]; } -- 2.30.2