enum pipe_error error;
unsigned num_outputs = 0;
unsigned attr;
- ubyte input_to_index[VERT_ATTRIB_MAX] = {0};
ubyte output_semantic_name[VARYING_SLOT_MAX] = {0};
ubyte output_semantic_index[VARYING_SLOT_MAX] = {0};
stvp->num_inputs = 0;
+ memset(stvp->input_to_index, ~0, sizeof(stvp->input_to_index));
if (stvp->Base.arb.IsPositionInvariant)
_mesa_insert_mvp_code(st->ctx, &stvp->Base);
*/
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
if ((stvp->Base.info.inputs_read & BITFIELD64_BIT(attr)) != 0) {
- input_to_index[attr] = stvp->num_inputs;
+ stvp->input_to_index[attr] = stvp->num_inputs;
stvp->index_to_input[stvp->num_inputs] = attr;
stvp->num_inputs++;
if ((stvp->Base.info.vs.double_inputs_read &
}
}
/* bit of a hack, presetup potentially unused edgeflag input */
- input_to_index[VERT_ATTRIB_EDGEFLAG] = stvp->num_inputs;
+ 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.
&stvp->Base,
/* inputs */
stvp->num_inputs,
- input_to_index,
+ stvp->input_to_index,
NULL, /* inputSlotToAttr */
NULL, /* input semantic name */
NULL, /* input semantic index */
&stvp->Base,
/* inputs */
stvp->num_inputs,
- input_to_index,
+ stvp->input_to_index,
NULL, /* input semantic name */
NULL, /* input semantic index */
NULL,
fprintf(stderr, "mesa: cannot emulate deprecated features\n");
}
+ for (unsigned index = 0; index < vpv->num_inputs; ++index) {
+ unsigned attr = stvp->index_to_input[index];
+ if (attr == ST_DOUBLE_ATTRIB_PLACEHOLDER)
+ continue;
+ vpv->vert_attrib_mask |= 1u << attr;
+ }
+
if (ST_DEBUG & DEBUG_TGSI) {
tgsi_dump(vpv->tgsi.tokens, 0);
debug_printf("\n");
/** similar to that in st_vertex_program, but with edgeflags info too */
GLuint num_inputs;
+
+ /** Bitfield of VERT_BIT_* bits of mesa vertex processing inputs */
+ GLbitfield vert_attrib_mask;
};
/** maps a TGSI input index back to a Mesa VERT_ATTRIB_x */
ubyte index_to_input[PIPE_MAX_ATTRIBS];
ubyte num_inputs;
+ /** Reverse mapping of the above */
+ ubyte input_to_index[VERT_ATTRIB_MAX];
/** Maps VARYING_SLOT_x to slot */
ubyte result_to_output[VARYING_SLOT_MAX];
blob_write_uint32(&blob, stvp->num_inputs);
blob_write_bytes(&blob, stvp->index_to_input,
sizeof(stvp->index_to_input));
+ blob_write_bytes(&blob, stvp->input_to_index,
+ sizeof(stvp->input_to_index));
blob_write_bytes(&blob, stvp->result_to_output,
sizeof(stvp->result_to_output));
stvp->num_inputs = blob_read_uint32(&blob_reader);
blob_copy_bytes(&blob_reader, (uint8_t *) stvp->index_to_input,
sizeof(stvp->index_to_input));
+ 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,
sizeof(stvp->result_to_output));