diff options
author | Marek Olšák <[email protected]> | 2013-04-15 13:00:54 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-04-24 03:23:23 +0200 |
commit | 99bd76d834e0c771274f327e1efe9b089ff273d4 (patch) | |
tree | d58b554df1dc0ead07965381e5a6110d784eacf3 /src/mesa | |
parent | b95cbe5e800e95d888d148e20e6a4e34c8857a9e (diff) |
mesa: convert _NEW_RASTERIZER_DISCARD to a driver flag
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_gs.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_state_upload.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_sol_state.c | 8 | ||||
-rw-r--r-- | src/mesa/main/enable.c | 3 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 9 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_rasterizer.c | 6 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.h | 1 |
10 files changed, 22 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 04d6943352e..ce22bc3a9ef 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -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; diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index e4fd0714c33..2ad62cd3a91 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -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 */ diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 59053d4c6c9..a432b76fa77 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -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 diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 843324f8c9f..80a46051257 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -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} }; diff --git a/src/mesa/drivers/dri/i965/gen7_sol_state.c b/src/mesa/drivers/dri/i965/gen7_sol_state.c index a404e2be3d4..f5703362968 100644 --- a/src/mesa/drivers/dri/i965/gen7_sol_state.c +++ b/src/mesa/drivers/dri/i965/gen7_sol_state.c @@ -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, }; diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 1b8ccc31aef..8fdd3070e0f 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -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; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 8d8622e9e1b..42b26fd138a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -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 diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 561dc9accb8..f4d0cab4252 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -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 */ }; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index ed1bf26a260..25e895b4a9d 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -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, diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 807453e9974..451217ff69e 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -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 { |