= cell->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
struct vertex_info *vinfo = &cell->vertex_info;
uint front0;
+ uint src = 0;
memset(vinfo, 0, sizeof(*vinfo));
#endif
/* always emit vertex pos */
- draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_LINEAR);
+ draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_LINEAR, src++);
#if 1
- front0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp);
+ front0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src++);
#endif
#if 0
case TGSI_SEMANTIC_COLOR:
if (vs->output_semantic_index[i] == 0) {
- front0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp);
+ front0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src++);
}
else {
assert(vs->output_semantic_index[i] == 1);
- front1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp);
+ front1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src++);
}
break;
break;
case TGSI_SEMANTIC_FOG:
- draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_PERSPECTIVE);
+ draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_PERSPECTIVE, src++);
break;
case TGSI_SEMANTIC_PSIZE:
case TGSI_SEMANTIC_GENERIC:
/* this includes texcoords and varying vars */
- draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_PERSPECTIVE);
+ draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_PERSPECTIVE, src++);
break;
default:
* up 1:1 with the fragment shader inputs.
*/
if (emitBack0) {
- back0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp);
+ back0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src++);
}
if (emitBack1) {
- back1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp);
+ back1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src++);
}
if (emitPsize) {
cell->psize_slot
- = draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_CONSTANT);
+ = draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_CONSTANT, src++);
}
/* If the attributes have changed, tell the draw module about
vertex->vertex_id = vbuf->nr_vertices++;
for (i = 0; i < vinfo->num_attribs; i++) {
+ uint j = vinfo->src_index[i];
switch (vinfo->format[i]) {
case FORMAT_OMIT:
/* no-op */
break;
case FORMAT_1F:
- *vbuf->vertex_ptr++ = fui(vertex->data[i][0]);
+ *vbuf->vertex_ptr++ = fui(vertex->data[j][0]);
count++;
break;
case FORMAT_2F:
- *vbuf->vertex_ptr++ = fui(vertex->data[i][0]);
- *vbuf->vertex_ptr++ = fui(vertex->data[i][1]);
+ *vbuf->vertex_ptr++ = fui(vertex->data[j][0]);
+ *vbuf->vertex_ptr++ = fui(vertex->data[j][1]);
count += 2;
break;
case FORMAT_3F:
- *vbuf->vertex_ptr++ = fui(vertex->data[i][0]);
- *vbuf->vertex_ptr++ = fui(vertex->data[i][1]);
- *vbuf->vertex_ptr++ = fui(vertex->data[i][2]);
+ *vbuf->vertex_ptr++ = fui(vertex->data[j][0]);
+ *vbuf->vertex_ptr++ = fui(vertex->data[j][1]);
+ *vbuf->vertex_ptr++ = fui(vertex->data[j][2]);
count += 3;
break;
case FORMAT_4F:
- *vbuf->vertex_ptr++ = fui(vertex->data[i][0]);
- *vbuf->vertex_ptr++ = fui(vertex->data[i][1]);
- *vbuf->vertex_ptr++ = fui(vertex->data[i][2]);
- *vbuf->vertex_ptr++ = fui(vertex->data[i][3]);
+ *vbuf->vertex_ptr++ = fui(vertex->data[j][0]);
+ *vbuf->vertex_ptr++ = fui(vertex->data[j][1]);
+ *vbuf->vertex_ptr++ = fui(vertex->data[j][2]);
+ *vbuf->vertex_ptr++ = fui(vertex->data[j][3]);
count += 4;
break;
case FORMAT_4UB:
- *vbuf->vertex_ptr++ = pack_ub4(float_to_ubyte( vertex->data[i][2] ),
- float_to_ubyte( vertex->data[i][1] ),
- float_to_ubyte( vertex->data[i][0] ),
- float_to_ubyte( vertex->data[i][3] ));
+ *vbuf->vertex_ptr++ = pack_ub4(float_to_ubyte( vertex->data[j][2] ),
+ float_to_ubyte( vertex->data[j][1] ),
+ float_to_ubyte( vertex->data[j][0] ),
+ float_to_ubyte( vertex->data[j][3] ));
count += 1;
break;
default:
uint hwfmt[4]; /**< hardware format info for this format */
enum interp_mode interp_mode[PIPE_MAX_SHADER_OUTPUTS];
enum attrib_format format[PIPE_MAX_SHADER_OUTPUTS]; /**< FORMAT_x */
+ uint src_index[PIPE_MAX_SHADER_OUTPUTS];
uint size; /**< total vertex size in dwords */
};
/**
* Add another attribute to the given vertex_info object.
+ * \param src_index indicates which post-transformed vertex attrib slot
+ * corresponds to this attribute.
* \return slot in which the attribute was added
*/
static INLINE uint
draw_emit_vertex_attr(struct vertex_info *vinfo,
- enum attrib_format format, enum interp_mode interp)
+ enum attrib_format format, enum interp_mode interp,
+ uint src_index)
{
const uint n = vinfo->num_attribs;
assert(n < PIPE_MAX_SHADER_OUTPUTS);
vinfo->format[n] = format;
vinfo->interp_mode[n] = interp;
+ vinfo->src_index[n] = src_index;
vinfo->num_attribs++;
return n;
}
boolean needW = 0;
uint i;
boolean texCoords[8];
+ uint src = 0;
memset(texCoords, 0, sizeof(texCoords));
memset(&vinfo, 0, sizeof(vinfo));
/* pos */
- draw_emit_vertex_attr(&vinfo, FORMAT_3F, INTERP_LINEAR);
+ draw_emit_vertex_attr(&vinfo, FORMAT_3F, INTERP_LINEAR, src++);
/* Note: we'll set the S4_VFMT_XYZ[W] bits below */
for (i = 0; i < fs->num_inputs; i++) {
break;
case TGSI_SEMANTIC_COLOR:
if (fs->input_semantic_index[i] == 0) {
- front0 = draw_emit_vertex_attr(&vinfo, FORMAT_4UB, colorInterp);
+ front0 = draw_emit_vertex_attr(&vinfo, FORMAT_4UB, colorInterp, src++);
vinfo.hwfmt[0] |= S4_VFMT_COLOR;
}
else {
assert(fs->input_semantic_index[i] == 1);
- front1 = draw_emit_vertex_attr(&vinfo, FORMAT_4UB, colorInterp);
+ front1 = draw_emit_vertex_attr(&vinfo, FORMAT_4UB, colorInterp, src++);
vinfo.hwfmt[0] |= S4_VFMT_SPEC_FOG;
}
break;
const uint unit = fs->input_semantic_index[i];
uint hwtc;
texCoords[unit] = TRUE;
- draw_emit_vertex_attr(&vinfo, FORMAT_4F, INTERP_PERSPECTIVE);
+ draw_emit_vertex_attr(&vinfo, FORMAT_4F, INTERP_PERSPECTIVE, src++);
hwtc = TEXCOORDFMT_4D;
needW = TRUE;
vinfo.hwfmt[1] |= hwtc << (unit * 4);
break;
case TGSI_SEMANTIC_FOG:
fprintf(stderr, "i915 fogcoord not implemented yet\n");
- draw_emit_vertex_attr(&vinfo, FORMAT_1F, INTERP_PERSPECTIVE);
+ draw_emit_vertex_attr(&vinfo, FORMAT_1F, INTERP_PERSPECTIVE, src++);
break;
default:
assert(0);
*/
if (i915->rasterizer->light_twoside) {
if (front0) {
- back0 = draw_emit_vertex_attr(&vinfo, FORMAT_OMIT, colorInterp);
+ back0 = draw_emit_vertex_attr(&vinfo, FORMAT_OMIT, colorInterp, src++);
}
if (back0) {
- back1 = draw_emit_vertex_attr(&vinfo, FORMAT_OMIT, colorInterp);
+ back1 = draw_emit_vertex_attr(&vinfo, FORMAT_OMIT, colorInterp, src++);
}
}
boolean emitBack0 = FALSE, emitBack1 = FALSE, emitPsize = FALSE;
uint front0 = 0, back0 = 0, front1 = 0, back1 = 0;
uint i;
+ int src = 0;
memset(vinfo, 0, sizeof(*vinfo));
softpipe->psize_slot = -1;
/* always emit vertex pos */
- draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_LINEAR);
+ draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_LINEAR, src++);
/*
* XXX I think we need to reconcile the vertex shader outputs with
case TGSI_SEMANTIC_COLOR:
if (vs->output_semantic_index[i] == 0) {
- front0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp);
+ front0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src++);
}
else {
assert(vs->output_semantic_index[i] == 1);
- front1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp);
+ front1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src++);
}
break;
break;
case TGSI_SEMANTIC_FOG:
- draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_PERSPECTIVE);
+ draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_PERSPECTIVE, src++);
break;
case TGSI_SEMANTIC_PSIZE:
case TGSI_SEMANTIC_GENERIC:
/* this includes texcoords and varying vars */
- draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_PERSPECTIVE);
+ draw_emit_vertex_attr(vinfo, FORMAT_4F, INTERP_PERSPECTIVE, src++);
break;
default:
* up 1:1 with the fragment shader inputs.
*/
if (emitBack0) {
- back0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp);
+ back0 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src++);
}
if (emitBack1) {
- back1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp);
+ back1 = draw_emit_vertex_attr(vinfo, FORMAT_4F, colorInterp, src++);
}
if (emitPsize) {
softpipe->psize_slot
- = draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_CONSTANT);
+ = draw_emit_vertex_attr(vinfo, FORMAT_1F, INTERP_CONSTANT, src++);
}
/* If the attributes have changed, tell the draw module about