[Mesa-dev] [PATCH 3/4] i965: add flag to enable cut_index
Jordan Justen
jordan.l.justen at intel.com
Sun May 13 07:06:26 PDT 2012
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 at intel.com>
---
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 3ef5a57..e1e18e1 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -296,6 +296,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 dabfdf4..87a674c 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1004,6 +1004,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 01bad5c..c155d81 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 11b9caa..cf77837 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,
--
1.7.9.5
More information about the mesa-dev
mailing list