i965: add flag to enable cut_index
authorJordan Justen <jordan.l.justen@intel.com>
Sun, 13 May 2012 06:53:18 +0000 (23:53 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Wed, 23 May 2012 22:19:09 +0000 (15:19 -0700)
When brw->prim_restart.enable_cut_index is set, the cut index
will be enabled when uploading index_buffer commands.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_defines.h
src/mesa/drivers/dri/i965/brw_draw_upload.c

index 4078e4848275e8061561fa06320f2b749a17561a..f7073cd57eb829ce7ed22daed17146ac4634ae37 100644 (file)
@@ -297,6 +297,7 @@ brwCreateContext(int api,
    }
 
    brw->prim_restart.in_progress = false;
+   brw->prim_restart.enable_cut_index = false;
 
    brw_init_state( brw );
 
index 2a9de745c144700e3a3926085bdeec8f7ed95722..8f20d6ec8c02c97053bca878ec33ed29dee3218f 100644 (file)
@@ -1044,6 +1044,7 @@ struct brw_context
    /* PrimitiveRestart */
    struct {
       bool in_progress;
+      bool enable_cut_index;
    } prim_restart;
 };
 
index 8ed55dc6f730be116a0de5899ed8dc6bdf9dc89d..0482058875e832b2af0241771aa63a1f5b75c7d2 100644 (file)
 
 #define BRW_SPRITE_POINT_ENABLE  16
 
+#define BRW_CUT_INDEX_ENABLE     (1 << 10)
+
 #define BRW_INDEX_BYTE     0
 #define BRW_INDEX_WORD     1
 #define BRW_INDEX_DWORD    2
index 11b9caaec827702868abbb0ac69187927b4ce891..cf7783725d8465d020239d9cef6aebd13ff5d264 100644 (file)
@@ -851,13 +851,20 @@ static void brw_emit_index_buffer(struct brw_context *brw)
 {
    struct intel_context *intel = &brw->intel;
    const struct _mesa_index_buffer *index_buffer = brw->ib.ib;
+   GLuint cut_index_setting;
 
    if (index_buffer == NULL)
       return;
 
+   if (brw->prim_restart.enable_cut_index) {
+      cut_index_setting = BRW_CUT_INDEX_ENABLE;
+   } else {
+      cut_index_setting = 0;
+   }
+
    BEGIN_BATCH(3);
    OUT_BATCH(CMD_INDEX_BUFFER << 16 |
-             /* cut index enable << 10 */
+             cut_index_setting |
              get_index_type(index_buffer->type) << 8 |
              1);
    OUT_RELOC(brw->ib.bo,