From f9389fbfb204995a650047949c48ab2b2703bfcf Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Sat, 12 May 2012 23:53:18 -0700 Subject: [PATCH] i965: add flag to enable cut_index 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 Reviewed-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/mesa/drivers/dri/i965/brw_context.c | 1 + src/mesa/drivers/dri/i965/brw_context.h | 1 + src/mesa/drivers/dri/i965/brw_defines.h | 2 ++ src/mesa/drivers/dri/i965/brw_draw_upload.c | 9 ++++++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 4078e484827..f7073cd57eb 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -297,6 +297,7 @@ brwCreateContext(int api, } brw->prim_restart.in_progress = false; + brw->prim_restart.enable_cut_index = false; brw_init_state( brw ); diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 2a9de745c14..8f20d6ec8c0 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1044,6 +1044,7 @@ struct brw_context /* PrimitiveRestart */ struct { bool in_progress; + bool enable_cut_index; } prim_restart; }; diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index 8ed55dc6f73..0482058875e 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -167,6 +167,8 @@ #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 diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 11b9caaec82..cf7783725d8 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -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, -- 2.30.2