mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
panfrost: Move assign_vertex_buffer to pan_helpers
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15795>
This commit is contained in:
parent
e39f9aa883
commit
bb8a9038ff
3 changed files with 37 additions and 25 deletions
|
|
@ -3366,31 +3366,6 @@ panfrost_create_rasterizer_state(
|
||||||
return so;
|
return so;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assigns a vertex buffer for a given (index, divisor) tuple */
|
|
||||||
|
|
||||||
static unsigned
|
|
||||||
pan_assign_vertex_buffer(struct pan_vertex_buffer *buffers,
|
|
||||||
unsigned *nr_bufs,
|
|
||||||
unsigned vbi,
|
|
||||||
unsigned divisor)
|
|
||||||
{
|
|
||||||
/* Look up the buffer */
|
|
||||||
for (unsigned i = 0; i < (*nr_bufs); ++i) {
|
|
||||||
if (buffers[i].vbi == vbi && buffers[i].divisor == divisor)
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Else, create a new buffer */
|
|
||||||
unsigned idx = (*nr_bufs)++;
|
|
||||||
|
|
||||||
buffers[idx] = (struct pan_vertex_buffer) {
|
|
||||||
.vbi = vbi,
|
|
||||||
.divisor = divisor
|
|
||||||
};
|
|
||||||
|
|
||||||
return idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
panfrost_create_vertex_elements_state(
|
panfrost_create_vertex_elements_state(
|
||||||
struct pipe_context *pctx,
|
struct pipe_context *pctx,
|
||||||
|
|
|
||||||
|
|
@ -297,6 +297,9 @@ struct panfrost_shader_variants {
|
||||||
unsigned active_variant;
|
unsigned active_variant;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** (Vertex buffer index, divisor) tuple that will become an Attribute Buffer
|
||||||
|
* Descriptor at draw-time on Midgard
|
||||||
|
*/
|
||||||
struct pan_vertex_buffer {
|
struct pan_vertex_buffer {
|
||||||
unsigned vbi;
|
unsigned vbi;
|
||||||
unsigned divisor;
|
unsigned divisor;
|
||||||
|
|
@ -315,6 +318,12 @@ struct panfrost_vertex_state {
|
||||||
unsigned formats[PIPE_MAX_ATTRIBS];
|
unsigned formats[PIPE_MAX_ATTRIBS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
unsigned
|
||||||
|
pan_assign_vertex_buffer(struct pan_vertex_buffer *buffers,
|
||||||
|
unsigned *nr_bufs,
|
||||||
|
unsigned vbi,
|
||||||
|
unsigned divisor);
|
||||||
|
|
||||||
struct panfrost_zsa_state;
|
struct panfrost_zsa_state;
|
||||||
struct panfrost_sampler_state;
|
struct panfrost_sampler_state;
|
||||||
struct panfrost_sampler_view;
|
struct panfrost_sampler_view;
|
||||||
|
|
|
||||||
|
|
@ -140,4 +140,32 @@ panfrost_get_index_buffer_bounded(struct panfrost_batch *batch,
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given an (index, divisor) tuple, assign a vertex buffer. Midgard and
|
||||||
|
* Bifrost put divisor information on the attribute buffer descriptor, so this
|
||||||
|
* is the most we can compact in general. Crucially, this runs at vertex
|
||||||
|
* elements CSO create time, not at draw time.
|
||||||
|
*/
|
||||||
|
unsigned
|
||||||
|
pan_assign_vertex_buffer(struct pan_vertex_buffer *buffers,
|
||||||
|
unsigned *nr_bufs,
|
||||||
|
unsigned vbi,
|
||||||
|
unsigned divisor)
|
||||||
|
{
|
||||||
|
/* Look up the buffer */
|
||||||
|
for (unsigned i = 0; i < (*nr_bufs); ++i) {
|
||||||
|
if (buffers[i].vbi == vbi && buffers[i].divisor == divisor)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Else, create a new buffer */
|
||||||
|
unsigned idx = (*nr_bufs)++;
|
||||||
|
|
||||||
|
buffers[idx] = (struct pan_vertex_buffer) {
|
||||||
|
.vbi = vbi,
|
||||||
|
.divisor = divisor
|
||||||
|
};
|
||||||
|
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue