mesa: convert _NEW_RASTERIZER_DISCARD to a driver flag
authorMarek Olšák <maraeo@gmail.com>
Mon, 15 Apr 2013 11:00:54 +0000 (13:00 +0200)
committerMarek Olšák <maraeo@gmail.com>
Wed, 24 Apr 2013 01:23:23 +0000 (03:23 +0200)
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_state_upload.c
src/mesa/drivers/dri/i965/gen7_sol_state.c
src/mesa/main/enable.c
src/mesa/main/mtypes.h
src/mesa/state_tracker/st_atom_rasterizer.c
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_context.h

index 04d6943352e315b69d371106ad3c61ee4bef2ff0..ce22bc3a9ef917f112580a3920c71a67a55b3e0e 100644 (file)
@@ -154,6 +154,7 @@ brwCreateContext(int api,
       tnl->Driver.RunPipeline = _tnl_run_pipeline;
 
    ctx->DriverFlags.NewTransformFeedback = BRW_NEW_TRANSFORM_FEEDBACK;
+   ctx->DriverFlags.NewRasterizerDiscard = BRW_NEW_RASTERIZER_DISCARD;
 
    ctx->Const.MaxDualSourceDrawBuffers = 1;
    ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS;
index e4fd0714c33472f3d7d2ad3ac84f07715e773892..2ad62cd3a915328eff9d5ee00ead89ae134b0400 100644 (file)
@@ -151,6 +151,7 @@ enum brw_state_id {
    BRW_STATE_SOL_INDICES,
    BRW_STATE_VUE_MAP_GEOM_OUT,
    BRW_STATE_TRANSFORM_FEEDBACK,
+   BRW_STATE_RASTERIZER_DISCARD,
 };
 
 #define BRW_NEW_URB_FENCE               (1 << BRW_STATE_URB_FENCE)
@@ -180,6 +181,7 @@ enum brw_state_id {
 #define BRW_NEW_SOL_INDICES            (1 << BRW_STATE_SOL_INDICES)
 #define BRW_NEW_VUE_MAP_GEOM_OUT       (1 << BRW_STATE_VUE_MAP_GEOM_OUT)
 #define BRW_NEW_TRANSFORM_FEEDBACK     (1 << BRW_STATE_TRANSFORM_FEEDBACK)
+#define BRW_NEW_RASTERIZER_DISCARD     (1 << BRW_STATE_RASTERIZER_DISCARD)
 
 struct brw_state_flags {
    /** State update flags signalled by mesa internals */
index 59053d4c6c9b93f19c2e2e6d1dcf4af70e91544f..a432b76fa779499dc03e4469cebabcc8117325e5 100644 (file)
@@ -215,7 +215,7 @@ static void populate_key( struct brw_context *brw,
          }
       }
       /* On Gen6, GS is also used for rasterizer discard. */
-      /* _NEW_RASTERIZER_DISCARD */
+      /* BRW_NEW_RASTERIZER_DISCARD */
       if (ctx->RasterDiscard) {
          key->need_gs_prog = true;
          key->rasterizer_discard = true;
@@ -257,10 +257,10 @@ brw_upload_gs_prog(struct brw_context *brw)
 
 const struct brw_tracked_state brw_gs_prog = {
    .dirty = {
-      .mesa  = (_NEW_LIGHT |
-                _NEW_RASTERIZER_DISCARD),
+      .mesa  = (_NEW_LIGHT),
       .brw   = (BRW_NEW_PRIMITIVE |
-                BRW_NEW_TRANSFORM_FEEDBACK),
+                BRW_NEW_TRANSFORM_FEEDBACK |
+                BRW_NEW_RASTERIZER_DISCARD),
       .cache = CACHE_NEW_VS_PROG
    },
    .emit = brw_upload_gs_prog
index 843324f8c9ffa6c26bc045016c3c6f0d688b7011..80a460512576c2cedfb65771ff0e828c0f5f212a 100644 (file)
@@ -372,6 +372,7 @@ static struct dirty_bit_map brw_bits[] = {
    DEFINE_BIT(BRW_NEW_SOL_INDICES),
    DEFINE_BIT(BRW_NEW_VUE_MAP_GEOM_OUT),
    DEFINE_BIT(BRW_NEW_TRANSFORM_FEEDBACK),
+   DEFINE_BIT(BRW_NEW_RASTERIZER_DISCARD),
    {0, 0, 0}
 };
 
index a404e2be3d475f65461c43967d12df6adb992fc8..f5703362968587d9d47397a029cdaacfcc499324 100644 (file)
@@ -195,7 +195,7 @@ upload_3dstate_streamout(struct brw_context *brw, bool active,
    uint32_t dw1 = 0, dw2 = 0;
    int i;
 
-   /* _NEW_RASTERIZER_DISCARD */
+   /* BRW_NEW_RASTERIZER_DISCARD */
    if (ctx->RasterDiscard)
       dw1 |= SO_RENDERING_DISABLE;
 
@@ -263,12 +263,12 @@ upload_sol_state(struct brw_context *brw)
 
 const struct brw_tracked_state gen7_sol_state = {
    .dirty = {
-      .mesa  = (_NEW_RASTERIZER_DISCARD |
-               _NEW_LIGHT),
+      .mesa  = (_NEW_LIGHT),
       .brw   = (BRW_NEW_BATCH |
                BRW_NEW_VERTEX_PROGRAM |
                 BRW_NEW_VUE_MAP_GEOM_OUT |
-                BRW_NEW_TRANSFORM_FEEDBACK)
+                BRW_NEW_TRANSFORM_FEEDBACK |
+                BRW_NEW_RASTERIZER_DISCARD)
    },
    .emit = upload_sol_state,
 };
index 1b8ccc31aef50d583a6b9df8dd7c0f1ff537e2db..8fdd3070e0f25f7087c4c362017ea20e854c5bb2 100644 (file)
@@ -956,7 +956,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
             goto invalid_enum_error;
         CHECK_EXTENSION(EXT_transform_feedback, cap);
          if (ctx->RasterDiscard != state) {
-            FLUSH_VERTICES(ctx, _NEW_RASTERIZER_DISCARD);
+            FLUSH_VERTICES(ctx, 0);
+            ctx->NewDriverState |= ctx->DriverFlags.NewRasterizerDiscard;
             ctx->RasterDiscard = state;
          }
          break;
index 8d8622e9e1b163fcbc3127443c8a0daabd983c47..42b26fd138aff79572824eb726d24ba6ffd347d4 100644 (file)
@@ -3151,12 +3151,6 @@ struct gl_matrix_stack
 /* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */
 #define _NEW_VARYING_VP_INPUTS (1 << 31) /**< gl_context::varying_vp_inputs */
 #define _NEW_ALL ~0
-
-/**
- * We use _NEW_TRANSFORM for GL_RASTERIZER_DISCARD.  This #define is for
- * clarity.
- */
-#define _NEW_RASTERIZER_DISCARD _NEW_TRANSFORM
 /*@}*/
 
 
@@ -3338,6 +3332,9 @@ struct gl_driver_flags
 
    /** gl_context::TransformFeedback::CurrentObject */
    GLbitfield NewTransformFeedback;
+
+   /** gl_context::RasterDiscard */
+   GLbitfield NewRasterizerDiscard;
 };
 
 struct gl_uniform_buffer_binding
index 561dc9accb89610f65ca31f12e0970ee9f58f14f..f4d0cab4252e9f2cf88a229d9d4a323e0c0ebf03 100644 (file)
@@ -233,7 +233,7 @@ static void update_raster_state( struct st_context *st )
    if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP)
       raster->bottom_edge_rule = 1;
 
-   /* _NEW_RASTERIZER_DISCARD */
+   /* ST_NEW_RASTERIZER */
    raster->rasterizer_discard = ctx->RasterDiscard;
 
    /* _NEW_TRANSFORM */
@@ -255,9 +255,9 @@ const struct st_tracked_state st_update_rasterizer = {
        _NEW_PROGRAM |
        _NEW_SCISSOR |
        _NEW_FRAG_CLAMP |
-       _NEW_RASTERIZER_DISCARD |
        _NEW_TRANSFORM),      /* mesa state dependencies*/
-      ST_NEW_VERTEX_PROGRAM,  /* state tracker dependencies */
+      (ST_NEW_VERTEX_PROGRAM |
+       ST_NEW_RASTERIZER),  /* state tracker dependencies */
    },
    update_raster_state     /* update function */
 };
index ed1bf26a26068db81637f2c5baf34758df44c211..25e895b4a9da19a43ee9f985bdcda45941344d1c 100644 (file)
@@ -208,6 +208,7 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
 static void st_init_driver_flags(struct gl_driver_flags *f)
 {
    f->NewArray = ST_NEW_VERTEX_ARRAYS;
+   f->NewRasterizerDiscard = ST_NEW_RASTERIZER;
 }
 
 struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
index 807453e997498809ab692459a5533d7f0083c873..451217ff69e61419cd35691e27b372fe28c16823 100644 (file)
@@ -50,6 +50,7 @@ struct u_upload_mgr;
 #define ST_NEW_EDGEFLAGS_DATA          (1 << 4)
 #define ST_NEW_GEOMETRY_PROGRAM        (1 << 5)
 #define ST_NEW_VERTEX_ARRAYS           (1 << 6)
+#define ST_NEW_RASTERIZER              (1 << 7)
 
 
 struct st_state_flags {