[Mesa-dev] [PATCH 2/2] i965: Remove hint_gs_always and resulting dead code

Ian Romanick idr at freedesktop.org
Mon Apr 11 10:30:43 PDT 2011


From: Ian Romanick <ian.d.romanick at intel.com>

---
 src/mesa/drivers/dri/i965/brw_gs.c      |   52 +++++++-----------------------
 src/mesa/drivers/dri/i965/brw_gs.h      |    5 +--
 src/mesa/drivers/dri/i965/brw_gs_emit.c |   32 -------------------
 3 files changed, 13 insertions(+), 76 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index 70c451d..14ee676 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -83,45 +83,23 @@ static void compile_gs_prog( struct brw_context *brw,
    /* Note that primitives which don't require a GS program have
     * already been weeded out by this stage:
     */
+
+   /* Gen6: VF has already converted into polygon, and LINELOOP is
+    * converted to LINESTRIP at the beginning of the 3D pipeline.
+    */
+   if (intel->gen == 6)
+      return;
+
    switch (key->primitive) {
    case GL_QUADS:
-      /* Gen6: VF has already converted into polygon. */
-      if (intel->gen == 6)
-          return;
       brw_gs_quads( &c, key );
       break;
    case GL_QUAD_STRIP:
-      if (intel->gen == 6)
-          return;
       brw_gs_quad_strip( &c, key );
       break;
    case GL_LINE_LOOP:
-      /* Gen6: LINELOOP is converted to LINESTRIP at the beginning of the 3D pipeline */
-      if (intel->gen == 6)
-          return;
       brw_gs_lines( &c );
       break;
-   case GL_LINES:
-      if (key->hint_gs_always)
-	 brw_gs_lines( &c );
-      else {
-	 return;
-      }
-      break;
-   case GL_TRIANGLES:
-      if (key->hint_gs_always)
-	 brw_gs_tris( &c );
-      else {
-	 return;
-      }
-      break;
-   case GL_POINTS:
-      if (key->hint_gs_always)
-	 brw_gs_points( &c );
-      else {
-	 return;
-      }
-      break;      
    default:
       return;
    }
@@ -170,7 +148,6 @@ static void populate_key( struct brw_context *brw,
 {
    struct gl_context *ctx = &brw->intel.ctx;
    struct intel_context *intel = &brw->intel;
-   int prim_gs_always;
 
    memset(key, 0, sizeof(*key));
 
@@ -180,8 +157,6 @@ static void populate_key( struct brw_context *brw,
    /* BRW_NEW_PRIMITIVE */
    key->primitive = gs_prim[brw->primitive];
 
-   key->hint_gs_always = 0;	/* debug code? */
-   
    /* _NEW_LIGHT */
    key->pv_first = (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION);
    if (key->primitive == GL_QUADS && ctx->Light.ShadeModel != GL_FLAT) {
@@ -191,14 +166,11 @@ static void populate_key( struct brw_context *brw,
       key->pv_first = GL_TRUE;
    }
 
-   if (intel->gen == 6)
-       prim_gs_always = 0;
-   else
-       prim_gs_always = brw->primitive == GL_QUADS ||
-			brw->primitive == GL_QUAD_STRIP ||
-			brw->primitive == GL_LINE_LOOP;
-
-   key->need_gs_prog = (key->hint_gs_always || prim_gs_always);
+   key->need_gs_prog = (intel->gen == 6)
+      ? 0
+      : (brw->primitive == GL_QUADS ||
+	 brw->primitive == GL_QUAD_STRIP ||
+	 brw->primitive == GL_LINE_LOOP);
 }
 
 /* Calculate interpolants for triangle and line rasterization.
diff --git a/src/mesa/drivers/dri/i965/brw_gs.h b/src/mesa/drivers/dri/i965/brw_gs.h
index 7e35310..c33528e 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.h
+++ b/src/mesa/drivers/dri/i965/brw_gs.h
@@ -42,10 +42,9 @@
 struct brw_gs_prog_key {
    GLbitfield64 attrs;
    GLuint primitive:4;
-   GLuint hint_gs_always:1;
    GLuint pv_first:1;
    GLuint need_gs_prog:1;
-   GLuint pad:25;
+   GLuint pad:26;
 };
 
 struct brw_gs_compile {
@@ -70,8 +69,6 @@ struct brw_gs_compile {
 
 void brw_gs_quads( struct brw_gs_compile *c, struct brw_gs_prog_key *key );
 void brw_gs_quad_strip( struct brw_gs_compile *c, struct brw_gs_prog_key *key );
-void brw_gs_tris( struct brw_gs_compile *c );
 void brw_gs_lines( struct brw_gs_compile *c );
-void brw_gs_points( struct brw_gs_compile *c );
 
 #endif
diff --git a/src/mesa/drivers/dri/i965/brw_gs_emit.c b/src/mesa/drivers/dri/i965/brw_gs_emit.c
index e1f751f..3bb526b 100644
--- a/src/mesa/drivers/dri/i965/brw_gs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_gs_emit.c
@@ -193,19 +193,6 @@ void brw_gs_quad_strip( struct brw_gs_compile *c, struct brw_gs_prog_key *key )
    }
 }
 
-void brw_gs_tris( struct brw_gs_compile *c )
-{
-   struct intel_context *intel = &c->func.brw->intel;
-
-   brw_gs_alloc_regs(c, 3);
-
-   if (intel->needs_ff_sync)
-	   brw_gs_ff_sync(c, 1);      
-   brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_TRILIST << 2) | R02_PRIM_START));
-   brw_gs_emit_vue(c, c->reg.vertex[1], 0, (_3DPRIM_TRILIST << 2));
-   brw_gs_emit_vue(c, c->reg.vertex[2], 1, ((_3DPRIM_TRILIST << 2) | R02_PRIM_END));
-}
-
 void brw_gs_lines( struct brw_gs_compile *c )
 {
    struct intel_context *intel = &c->func.brw->intel;
@@ -217,22 +204,3 @@ void brw_gs_lines( struct brw_gs_compile *c )
    brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_LINESTRIP << 2) | R02_PRIM_START));
    brw_gs_emit_vue(c, c->reg.vertex[1], 1, ((_3DPRIM_LINESTRIP << 2) | R02_PRIM_END));
 }
-
-void brw_gs_points( struct brw_gs_compile *c )
-{
-   struct intel_context *intel = &c->func.brw->intel;
-
-   brw_gs_alloc_regs(c, 1);
-
-   if (intel->needs_ff_sync)
-	   brw_gs_ff_sync(c, 1);      
-   brw_gs_emit_vue(c, c->reg.vertex[0], 1, ((_3DPRIM_POINTLIST << 2) | R02_PRIM_START | R02_PRIM_END));
-}
-
-
-
-
-
-
-
-
-- 
1.7.4



More information about the mesa-dev mailing list