st/mesa: remove st_vertex_program::index_to_input
We just need the mask of used vertex attribs. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11370>
This commit is contained in:
@@ -420,6 +420,7 @@ st_prepare_vertex_program(struct st_program *stp)
|
||||
struct st_vertex_program *stvp = (struct st_vertex_program *)stp;
|
||||
|
||||
stvp->num_inputs = 0;
|
||||
stvp->vert_attrib_mask = 0;
|
||||
memset(stvp->input_to_index, ~0, sizeof(stvp->input_to_index));
|
||||
memset(stvp->result_to_output, ~0, sizeof(stvp->result_to_output));
|
||||
|
||||
@@ -429,13 +430,13 @@ st_prepare_vertex_program(struct st_program *stp)
|
||||
for (unsigned attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
|
||||
if ((stp->Base.info.inputs_read & BITFIELD64_BIT(attr)) != 0) {
|
||||
stvp->input_to_index[attr] = stvp->num_inputs;
|
||||
stvp->index_to_input[stvp->num_inputs] = attr;
|
||||
stvp->vert_attrib_mask |= BITFIELD_BIT(attr);
|
||||
stvp->num_inputs++;
|
||||
}
|
||||
}
|
||||
|
||||
/* pre-setup potentially unused edgeflag input */
|
||||
stvp->input_to_index[VERT_ATTRIB_EDGEFLAG] = stvp->num_inputs;
|
||||
stvp->index_to_input[stvp->num_inputs] = VERT_ATTRIB_EDGEFLAG;
|
||||
|
||||
/* Compute mapping of vertex program outputs to slots. */
|
||||
unsigned num_outputs = 0;
|
||||
@@ -975,11 +976,10 @@ st_get_common_variant(struct st_context *st,
|
||||
|
||||
if (stp->Base.info.stage == MESA_SHADER_VERTEX) {
|
||||
struct st_vertex_program *stvp = (struct st_vertex_program *)stp;
|
||||
unsigned num_inputs = stvp->num_inputs + key->passthrough_edgeflags;
|
||||
for (unsigned index = 0; index < num_inputs; ++index) {
|
||||
unsigned attr = stvp->index_to_input[index];
|
||||
v->vert_attrib_mask |= 1u << attr;
|
||||
}
|
||||
|
||||
v->vert_attrib_mask =
|
||||
stvp->vert_attrib_mask |
|
||||
(key->passthrough_edgeflags ? VERT_BIT_EDGEFLAG : 0);
|
||||
}
|
||||
|
||||
st_add_variant(&stp->variants, &v->base);
|
||||
|
||||
@@ -281,10 +281,10 @@ struct st_vertex_program
|
||||
{
|
||||
struct st_program Base;
|
||||
|
||||
/** maps a TGSI input index back to a Mesa VERT_ATTRIB_x */
|
||||
ubyte index_to_input[PIPE_MAX_ATTRIBS];
|
||||
uint32_t vert_attrib_mask; /**< mask of sourced vertex attribs */
|
||||
|
||||
ubyte num_inputs;
|
||||
/** Reverse mapping of the above */
|
||||
/** Map a vertex attrib to a gallium vertex element index. */
|
||||
ubyte input_to_index[VERT_ATTRIB_MAX];
|
||||
|
||||
/** Maps VARYING_SLOT_x to slot */
|
||||
|
||||
@@ -100,8 +100,7 @@ st_serialise_ir_program(struct gl_context *ctx, struct gl_program *prog,
|
||||
struct st_vertex_program *stvp = (struct st_vertex_program *)stp;
|
||||
|
||||
blob_write_uint32(&blob, stvp->num_inputs);
|
||||
blob_write_bytes(&blob, stvp->index_to_input,
|
||||
sizeof(stvp->index_to_input));
|
||||
blob_write_uint32(&blob, stvp->vert_attrib_mask);
|
||||
blob_write_bytes(&blob, stvp->input_to_index,
|
||||
sizeof(stvp->input_to_index));
|
||||
blob_write_bytes(&blob, stvp->result_to_output,
|
||||
@@ -198,8 +197,7 @@ st_deserialise_ir_program(struct gl_context *ctx,
|
||||
if (prog->info.stage == MESA_SHADER_VERTEX) {
|
||||
struct st_vertex_program *stvp = (struct st_vertex_program *)stp;
|
||||
stvp->num_inputs = blob_read_uint32(&blob_reader);
|
||||
blob_copy_bytes(&blob_reader, (uint8_t *) stvp->index_to_input,
|
||||
sizeof(stvp->index_to_input));
|
||||
stvp->vert_attrib_mask = blob_read_uint32(&blob_reader);
|
||||
blob_copy_bytes(&blob_reader, (uint8_t *) stvp->input_to_index,
|
||||
sizeof(stvp->input_to_index));
|
||||
blob_copy_bytes(&blob_reader, (uint8_t *) stvp->result_to_output,
|
||||
|
||||
Reference in New Issue
Block a user