summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2012-05-12 23:53:18 -0700
committerJordan Justen <[email protected]>2012-05-23 15:19:09 -0700
commitf9389fbfb204995a650047949c48ab2b2703bfcf (patch)
tree0ed315a595ff053b0e1f792c2e92d9e8af048af4 /src/mesa/drivers
parentdf7d1323de08274c816a8e5fab7e99b6f00f4fa3 (diff)
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 <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_defines.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c9
4 files changed, 12 insertions, 1 deletions
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,