[Mesa-dev] [PATCH 03/10] i965 gs: Remove unnecessary mapping of key->primitive.
Paul Berry
stereotype441 at gmail.com
Mon Dec 5 09:40:46 PST 2011
Previously, GS generation code contained a lookup table that mapped
primitive types POLYGON, TRISTRIP, and TRIFAN to TRILIST, mapped
LINESTRIP to LINELIST, and left all other primitives unchanged. This
was silly, because we never generate a GS program for those primitive
types anyhow.
This patch removes the unnecessary lookup table.
---
src/mesa/drivers/dri/i965/brw_gs.c | 16 +---------------
src/mesa/drivers/dri/i965/brw_gs.h | 6 +++++-
2 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index 1b23f3a..804ea84 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -118,20 +118,6 @@ static void compile_gs_prog( struct brw_context *brw,
ralloc_free(mem_ctx);
}
-static const GLenum gs_prim[] = {
- [_3DPRIM_POINTLIST] = _3DPRIM_POINTLIST,
- [_3DPRIM_LINELIST] = _3DPRIM_LINELIST,
- [_3DPRIM_LINELOOP] = _3DPRIM_LINELOOP,
- [_3DPRIM_LINESTRIP] = _3DPRIM_LINELIST,
- [_3DPRIM_TRILIST] = _3DPRIM_TRILIST,
- [_3DPRIM_TRISTRIP] = _3DPRIM_TRILIST,
- [_3DPRIM_TRIFAN] = _3DPRIM_TRILIST,
- [_3DPRIM_QUADLIST] = _3DPRIM_QUADLIST,
- [_3DPRIM_QUADSTRIP] = _3DPRIM_QUADSTRIP,
- [_3DPRIM_POLYGON] = _3DPRIM_TRILIST,
- [_3DPRIM_RECTLIST] = _3DPRIM_RECTLIST,
-};
-
static void populate_key( struct brw_context *brw,
struct brw_gs_prog_key *key )
{
@@ -150,7 +136,7 @@ static void populate_key( struct brw_context *brw,
key->nr_regs = (vue_map.num_slots + 1)/2;
/* BRW_NEW_PRIMITIVE */
- key->primitive = gs_prim[brw->primitive];
+ key->primitive = brw->primitive;
/* _NEW_LIGHT */
key->pv_first = (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION);
diff --git a/src/mesa/drivers/dri/i965/brw_gs.h b/src/mesa/drivers/dri/i965/brw_gs.h
index 270b647..157afa3 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.h
+++ b/src/mesa/drivers/dri/i965/brw_gs.h
@@ -40,7 +40,11 @@
#define MAX_GS_VERTS (4)
struct brw_gs_prog_key {
- GLuint primitive:8; /**< Hardware primitive, such as _3DPRIM_TRILIST. */
+ /**
+ * Hardware primitive type being drawn, e.g. _3DPRIM_TRILIST.
+ */
+ GLuint primitive:8;
+
GLuint pv_first:1;
GLuint need_gs_prog:1;
GLuint nr_regs:8;
--
1.7.6.4
More information about the mesa-dev
mailing list