struct fetch_shade_emit *fse = (struct fetch_shade_emit *)middle;
struct draw_context *draw = fse->draw;
unsigned num_vs_inputs = draw->vs.vertex_shader->info.num_inputs;
- unsigned num_vs_outputs = draw->vs.vertex_shader->info.num_outputs;
const struct vertex_info *vinfo;
unsigned i;
boolean need_psize = 0;
fse->key.output_stride = vinfo->size * 4;
- fse->key.nr_elements = MAX2(num_vs_outputs, /* outputs - translate to hw format */
- num_vs_inputs); /* inputs - fetch from api format */
+ fse->key.nr_outputs = vinfo->num_attribs;
+ fse->key.nr_inputs = num_vs_inputs;
+
+ fse->key.nr_elements = MAX2(fse->key.nr_outputs, /* outputs - translate to hw format */
+ fse->key.nr_inputs); /* inputs - fetch from api format */
fse->key.viewport = !draw->identity_viewport;
fse->key.clip = !draw->bypass_clipping;
need_psize = 1;
output_format = PIPE_FORMAT_R32_FLOAT;
emit_sz = 1 * sizeof(float);
- vs_output = num_vs_outputs + 1;
+ vs_output = vinfo->num_attribs + 1;
break;
case EMIT_4UB:
output_format = PIPE_FORMAT_B8G8R8A8_UNORM;
fse->key.element[i].input_buffer = 0; //nr_buffers + 1;
fse->key.element[i].input_offset = 0;
- fse->key.nr_elements += 1;
+ fse->key.nr_inputs += 1;
+ fse->key.nr_elements = MAX2(fse->key.nr_inputs,
+ fse->key.nr_outputs);
}
#endif
struct draw_vs_varient_key {
unsigned output_stride;
- unsigned nr_elements:16;
+ unsigned nr_elements:8; /* max2(nr_inputs, nr_outputs) */
+ unsigned nr_inputs:8;
+ unsigned nr_outputs:8;
unsigned viewport:1;
unsigned clip:1;
- unsigned pad:14;
+ unsigned pad:5;
struct draw_vs_element element[PIPE_MAX_ATTRIBS];
};
struct draw_vs_varient_aos_sse *vaos = (struct draw_vs_varient_aos_sse *)varient;
unsigned i;
- for (i = 0; i < vaos->base.vs->info.num_inputs; i++) {
+ for (i = 0; i < vaos->base.key.nr_inputs; i++) {
if (vaos->base.key.element[i].in.buffer == buf) {
vaos->machine->attrib[i].input_ptr = ((char *)ptr +
vaos->base.key.element[i].in.offset);
{
unsigned i;
- for (i = 0; i < cp->vaos->base.vs->info.num_inputs; i++) {
+ for (i = 0; i < cp->vaos->base.key.nr_inputs; i++) {
if (!load_input( cp, i, linear ))
return FALSE;
cp->insn_counter++;
{
unsigned i;
- for (i = 0; i < cp->vaos->base.vs->info.num_outputs; i++) {
+ for (i = 0; i < cp->vaos->base.key.nr_outputs; i++) {
unsigned format = cp->vaos->base.key.element[i].out.format;
unsigned offset = cp->vaos->base.key.element[i].out.offset;
- /* OK, have to build a new one:
+ /* Build free-standing fetch and emit functions:
*/
- fetch.nr_elements = vs->info.num_inputs;
+ fetch.nr_elements = key->nr_inputs;
fetch.output_stride = 0;
- for (i = 0; i < vs->info.num_inputs; i++) {
+ for (i = 0; i < key->nr_inputs; i++) {
fetch.element[i].input_format = key->element[i].in.format;
fetch.element[i].input_buffer = key->element[i].in.buffer;
fetch.element[i].input_offset = key->element[i].in.offset;
}
- emit.nr_elements = vs->info.num_outputs;
+ emit.nr_elements = key->nr_outputs;
emit.output_stride = key->output_stride;
- for (i = 0; i < vs->info.num_outputs; i++) {
+ for (i = 0; i < key->nr_outputs; i++) {
emit.element[i].input_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
emit.element[i].input_buffer = 0;
emit.element[i].input_offset = i * 4 * sizeof(float);