mesa: convert _NEW_RASTERIZER_DISCARD to a driver flag 51/6151/1
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 04d6943..ce22bc3 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 e4fd071..2ad62cd 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 59053d4..a432b76 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 843324f..80a4605 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 a404e2b..f570336 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 1b8ccc3..8fdd307 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 8d8622e..42b26fd 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 561dc9a..f4d0cab 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 ed1bf26..25e895b 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 807453e..451217f 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 {