/* Other attributes
* Note: start at 1 to skip winpos (data[0]) since we just computed
* it above.
- * Subtract two from nr_attrs since the first two attribs (always
- * VF_ATTRIB_VERTEX_HEADER and VF_ATTRIB_CLIP_POS, see
- * draw_set_vertex_attributes()) are in the vertex_header struct,
- * not in the data[] array.
*/
- for (j = 1; j < nr_attrs - 2; j++) {
+ for (j = 1; j < nr_attrs; j++) {
interp_attr(dst->data[j], t, in->data[j], out->data[j]);
}
}
static void clip_begin( struct draw_stage *stage )
{
- /* sanity checks. If these fail, review the clip/interp code! */
- assert(stage->draw->vertex_info.num_attribs >= 3);
-#if 0
- assert(stage->draw->vertex_info.slot_to_attrib[0] == TGSI_ATTRIB_VERTEX_HEADER);
- assert(stage->draw->vertex_info.slot_to_attrib[1] == TGSI_ATTRIB_CLIP_POS);
-#endif
+ /* should always have position, at least */
+ assert(stage->draw->vertex_info.num_attribs >= 1);
stage->next->begin( stage->next );
}
uint i;
/* Look for constant/flat attribs and duplicate from src to dst vertex */
- for (i = 1; i < num_attribs - 2; i++) {
- if (interp[i + 2] == INTERP_CONSTANT) {
+ /* skip attrib[0] which is vert pos */
+ for (i = 1; i < num_attribs; i++) {
+ if (interp[i] == INTERP_CONSTANT) {
copy_attr( i, dst, src );
}
}
vinfo->size += 3;
break;
case FORMAT_4F:
- case FORMAT_4F_VIEWPORT:
vinfo->size += 4;
break;
default:
struct vertex_info *vinfo = &draw->vertex_info;
unsigned i;
-#if 0
- assert(slot_to_vf_attr[0] == TGSI_ATTRIB_POS);
-#endif
+ assert(interps[0] == INTERP_LINEAR); /* should be vert pos */
- memset(vinfo, 0, sizeof(*vinfo));
+ assert(nr_attrs <= PIPE_MAX_SHADER_OUTPUTS);
- /*
- * First three attribs are always the same: header, clip pos, winpos
+ /* Note that draw-module vertices will consist of the attributes passed
+ * to this function, plus a header/prefix containing the vertex header
+ * flags and GLfloat[4] clip pos.
*/
- emit_vertex_attr(vinfo, FORMAT_1F, INTERP_NONE);
- emit_vertex_attr(vinfo, FORMAT_4F, INTERP_LINEAR);
- emit_vertex_attr(vinfo, FORMAT_4F_VIEWPORT, INTERP_LINEAR);
- /*
- * Remaining attribs (color, texcoords, etc)
- */
- for (i = 1; i < nr_attrs; i++) {
+ memset(vinfo, 0, sizeof(*vinfo));
+
+ /* copy attrib info */
+ for (i = 0; i < nr_attrs; i++) {
emit_vertex_attr(vinfo, FORMAT_4F, interps[i]);
}
draw_compute_vertex_size(vinfo);
+
+ /* add extra words for vertex header (uint), clip pos (float[4]) */
+ vinfo->size += 5;
}
FORMAT_2F,
FORMAT_3F,
FORMAT_4F,
- FORMAT_4F_VIEWPORT,
FORMAT_4UB
};
#endif
/* Remaining attributes are packed into sequential post-transform
* vertex attrib slots.
- * Skip 0 since we just did it above.
- * Subtract two because of the VERTEX_HEADER, CLIP_POS attribs.
*/
- for (slot = 1; slot < draw->vertex_info.num_attribs - 2; slot++) {
+ for (slot = 1; slot < draw->vertex_info.num_attribs; slot++) {
vOut[j]->data[slot][0] = machine->Outputs[slot].xyzw[0].f[j];
vOut[j]->data[slot][1] = machine->Outputs[slot].xyzw[1].f[j];
vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
/* Remaining attributes are packed into sequential post-transform
* vertex attrib slots.
- * Skip 0 since we just did it above.
- * Subtract two because of the VERTEX_HEADER, CLIP_POS attribs.
*/
- for (slot = 1; slot < draw->vertex_info.num_attribs - 2; slot++) {
+ for (slot = 1; slot < draw->vertex_info.num_attribs; slot++) {
vOut->data[slot][0] = dests[slot][0];
vOut->data[slot][1] = dests[slot][1];
vOut->data[slot][2] = dests[slot][2];