i965: Trim the trailing NOOP from 3DSTATE_INDEX_BUFFER
authorChris Wilson <chris@chris-wilson.co.uk>
Sat, 29 Jan 2011 14:01:50 +0000 (14:01 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 21 Feb 2011 12:59:33 +0000 (12:59 +0000)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/mesa/drivers/dri/i965/brw_draw_upload.c

index 2cefe614dd2cf2fac78ba724444cafe725f11803..2cd249812f9626b741bba762ea141af79b456c46 100644 (file)
@@ -681,29 +681,18 @@ static void brw_emit_index_buffer(struct brw_context *brw)
    if (index_buffer == NULL)
       return;
 
-   /* Emit the indexbuffer packet:
-    */
-   {
-      struct brw_indexbuffer ib;
-
-      memset(&ib, 0, sizeof(ib));
-
-      ib.header.bits.opcode = CMD_INDEX_BUFFER;
-      ib.header.bits.length = sizeof(ib)/4 - 2;
-      ib.header.bits.index_format = get_index_type(index_buffer->type);
-      ib.header.bits.cut_index_enable = 0;
-
-      BEGIN_BATCH(4);
-      OUT_BATCH( ib.header.dword );
-      OUT_RELOC(brw->ib.bo,
-               I915_GEM_DOMAIN_VERTEX, 0,
-               brw->ib.offset);
-      OUT_RELOC(brw->ib.bo,
-               I915_GEM_DOMAIN_VERTEX, 0,
-               brw->ib.offset + brw->ib.size - 1);
-      OUT_BATCH( 0 );
-      ADVANCE_BATCH();
-   }
+   BEGIN_BATCH(3);
+   OUT_BATCH(CMD_INDEX_BUFFER << 16 |
+             /* cut index enable << 10 */
+             get_index_type(index_buffer->type) << 8 |
+             1);
+   OUT_RELOC(brw->ib.bo,
+             I915_GEM_DOMAIN_VERTEX, 0,
+             brw->ib.offset);
+   OUT_RELOC(brw->ib.bo,
+             I915_GEM_DOMAIN_VERTEX, 0,
+             brw->ib.offset + brw->ib.size - 1);
+   ADVANCE_BATCH();
 }
 
 const struct brw_tracked_state brw_index_buffer = {