gallium/i915: Fix emit_hw_vertex(): need to use vinfo->src_index[]
authorBrian <brian@i915.localnet.net>
Tue, 26 Feb 2008 01:53:22 +0000 (18:53 -0700)
committerBrian <brian@i915.localnet.net>
Tue, 26 Feb 2008 01:56:36 +0000 (18:56 -0700)
src/gallium/drivers/i915simple/i915_prim_emit.c

index 6da42b3846cc02838ef4e1288cf97d8f0fa50dab..d8de5178f60971c66baa333885f71264017fc9d6 100644 (file)
@@ -75,37 +75,39 @@ emit_hw_vertex( struct i915_context *i915,
    assert(!i915->dirty);
 
    for (i = 0; i < vinfo->num_attribs; i++) {
+      const uint j = vinfo->src_index[i];
+      const float *attrib = vertex->data[j];
       switch (vinfo->emit[i]) {
       case EMIT_OMIT:
          /* no-op */
          break;
       case EMIT_1F:
-         OUT_BATCH( fui(vertex->data[i][0]) );
+         OUT_BATCH( fui(attrib[0]) );
          count++;
          break;
       case EMIT_2F:
-         OUT_BATCH( fui(vertex->data[i][0]) );
-         OUT_BATCH( fui(vertex->data[i][1]) );
+         OUT_BATCH( fui(attrib[0]) );
+         OUT_BATCH( fui(attrib[1]) );
          count += 2;
          break;
       case EMIT_3F:
-         OUT_BATCH( fui(vertex->data[i][0]) );
-         OUT_BATCH( fui(vertex->data[i][1]) );
-         OUT_BATCH( fui(vertex->data[i][2]) );
+         OUT_BATCH( fui(attrib[0]) );
+         OUT_BATCH( fui(attrib[1]) );
+         OUT_BATCH( fui(attrib[2]) );
          count += 3;
          break;
       case EMIT_4F:
-         OUT_BATCH( fui(vertex->data[i][0]) );
-         OUT_BATCH( fui(vertex->data[i][1]) );
-         OUT_BATCH( fui(vertex->data[i][2]) );
-         OUT_BATCH( fui(vertex->data[i][3]) );
+         OUT_BATCH( fui(attrib[0]) );
+         OUT_BATCH( fui(attrib[1]) );
+         OUT_BATCH( fui(attrib[2]) );
+         OUT_BATCH( fui(attrib[3]) );
          count += 4;
          break;
       case EMIT_4UB:
-         OUT_BATCH( 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] )) );
+         OUT_BATCH( pack_ub4(float_to_ubyte( attrib[2] ),
+                             float_to_ubyte( attrib[1] ),
+                             float_to_ubyte( attrib[0] ),
+                             float_to_ubyte( attrib[3] )) );
          count += 1;
          break;
       default: