i965: Add HiZ operation state to brw_context
[mesa.git] / src / mesa / drivers / dri / i965 / brw_gs.c
index 0a37485171ea6351d4b84eb89409f54e2773e2e5..91f8d0b5dcba410028ae1d5fdb92f0d9d3afe812 100644 (file)
@@ -64,7 +64,7 @@ static void compile_gs_prog( struct brw_context *brw,
    c.key = *key;
    /* The geometry shader needs to access the entire VUE. */
    struct brw_vue_map vue_map;
-   brw_compute_vue_map(&vue_map, intel, c.key.nr_userclip, c.key.attrs);
+   brw_compute_vue_map(&vue_map, intel, c.key.userclip_active, c.key.attrs);
    c.nr_regs = (vue_map.num_slots + 1)/2;
 
    mem_ctx = NULL;
@@ -86,13 +86,13 @@ static void compile_gs_prog( struct brw_context *brw,
     */
 
    switch (key->primitive) {
-   case GL_QUADS:
+   case _3DPRIM_QUADLIST:
       brw_gs_quads( &c, key );
       break;
-   case GL_QUAD_STRIP:
+   case _3DPRIM_QUADSTRIP:
       brw_gs_quad_strip( &c, key );
       break;
-   case GL_LINE_LOOP:
+   case _3DPRIM_LINELOOP:
       brw_gs_lines( &c );
       break;
    default:
@@ -122,17 +122,18 @@ static void compile_gs_prog( struct brw_context *brw,
    ralloc_free(mem_ctx);
 }
 
-static const GLenum gs_prim[GL_POLYGON+1] = {  
-   GL_POINTS,
-   GL_LINES,
-   GL_LINE_LOOP,
-   GL_LINES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_QUADS,
-   GL_QUAD_STRIP,
-   GL_TRIANGLES
+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,
@@ -151,26 +152,27 @@ static void populate_key( struct brw_context *brw,
 
    /* _NEW_LIGHT */
    key->pv_first = (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION);
-   if (key->primitive == GL_QUADS && ctx->Light.ShadeModel != GL_FLAT) {
+   if (key->primitive == _3DPRIM_QUADLIST && ctx->Light.ShadeModel != GL_FLAT) {
       /* Provide consistent primitive order with brw_set_prim's
        * optimization of single quads to trifans.
        */
-      key->pv_first = GL_TRUE;
+      key->pv_first = true;
    }
 
    /* _NEW_TRANSFORM */
-   key->nr_userclip = brw_count_bits(ctx->Transform.ClipPlanesEnabled);
+   key->userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
 
    key->need_gs_prog = (intel->gen >= 6)
       ? 0
-      : (brw->primitive == GL_QUADS ||
-        brw->primitive == GL_QUAD_STRIP ||
-        brw->primitive == GL_LINE_LOOP);
+      : (brw->primitive == _3DPRIM_QUADLIST ||
+        brw->primitive == _3DPRIM_QUADSTRIP ||
+        brw->primitive == _3DPRIM_LINELOOP);
 }
 
 /* Calculate interpolants for triangle and line rasterization.
  */
-static void prepare_gs_prog(struct brw_context *brw)
+static void
+brw_upload_gs_prog(struct brw_context *brw)
 {
    struct brw_gs_prog_key key;
    /* Populate the key:
@@ -199,5 +201,5 @@ const struct brw_tracked_state brw_gs_prog = {
       .brw   = BRW_NEW_PRIMITIVE,
       .cache = CACHE_NEW_VS_PROG
    },
-   .prepare = prepare_gs_prog
+   .emit = brw_upload_gs_prog
 };