diff options
author | José Fonseca <[email protected]> | 2014-01-06 18:45:49 +0000 |
---|---|---|
committer | José Fonseca <[email protected]> | 2014-01-07 16:04:42 +0000 |
commit | 2d368b982af5e6566c7da7fd2bc8b190af28188b (patch) | |
tree | e6102cbfd74fd819851fb45db42927d98b6eed15 /src | |
parent | 95bf222603bbbb643a6119e370c6a616ccc5ceaf (diff) |
llvmpipe: Basic implementation of pipe_context::set_sample_mask.
We don't support MSAA (ie, number of samples is always one) therefore
sample_mask boils down to a synonym of the rasterizer_discard flag.
Also, this change makes setup actually use the value received in
lp_setup_set_rasterizer_discard instead of reaching out to llvmpipe
upper layers to re-fetch it.
Based on Si Chen's draft.
With this patch `wgf11multisample Coverage passes 100%` on the UMD
D3D10 state tracker.
Reviewed-by: Roland Scheidegger <[email protected]>
Reviewed-by: Si Chen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_context.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_blend.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_derived.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_rasterizer.c | 2 |
5 files changed, 20 insertions, 7 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index 9ec18e8429e..62fa6a90b4d 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -69,6 +69,7 @@ struct llvmpipe_context { const struct lp_so_state *so; /** Other rendering state */ + unsigned sample_mask; struct pipe_blend_color blend_color; struct pipe_stencil_ref stencil_ref; struct pipe_clip_state clip; diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 2fad469d197..7f2223129aa 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -66,9 +66,6 @@ static boolean try_update_scene_state( struct lp_setup_context *setup ); static void lp_setup_get_empty_scene(struct lp_setup_context *setup) { - struct llvmpipe_context *lp = llvmpipe_context(setup->pipe); - boolean discard = lp->rasterizer ? lp->rasterizer->rasterizer_discard : FALSE; - assert(setup->scene == NULL); setup->scene_idx++; @@ -84,8 +81,8 @@ lp_setup_get_empty_scene(struct lp_setup_context *setup) lp_fence_wait(setup->scene->fence); } - lp_scene_begin_binning(setup->scene, &setup->fb, discard); - + lp_scene_begin_binning(setup->scene, &setup->fb, setup->rasterizer_discard); + } diff --git a/src/gallium/drivers/llvmpipe/lp_state_blend.c b/src/gallium/drivers/llvmpipe/lp_state_blend.c index 6bba9077d1b..b0fc1d38124 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_blend.c +++ b/src/gallium/drivers/llvmpipe/lp_state_blend.c @@ -177,6 +177,13 @@ static void llvmpipe_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask) { + struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); + + if (sample_mask != llvmpipe->sample_mask) { + llvmpipe->sample_mask = sample_mask; + + llvmpipe->dirty |= LP_NEW_RASTERIZER; + } } void @@ -194,4 +201,6 @@ llvmpipe_init_blend_funcs(struct llvmpipe_context *llvmpipe) llvmpipe->pipe.set_stencil_ref = llvmpipe_set_stencil_ref; llvmpipe->pipe.set_sample_mask = llvmpipe_set_sample_mask; + + llvmpipe->sample_mask = ~0; } diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c index 5c3a3a8e3a9..a300841d395 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_derived.c +++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c @@ -185,6 +185,14 @@ void llvmpipe_update_derived( struct llvmpipe_context *llvmpipe ) LP_NEW_OCCLUSION_QUERY)) llvmpipe_update_fs( llvmpipe ); + if (llvmpipe->dirty & (LP_NEW_RASTERIZER)) { + boolean discard = + (llvmpipe->sample_mask & 1) == 0 || + (llvmpipe->rasterizer ? llvmpipe->rasterizer->rasterizer_discard : FALSE); + + lp_setup_set_rasterizer_discard(llvmpipe->setup, discard); + } + if (llvmpipe->dirty & (LP_NEW_FS | LP_NEW_FRAMEBUFFER | LP_NEW_RASTERIZER)) diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c index 2149ffc2351..5a0f51fe108 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c +++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c @@ -119,8 +119,6 @@ llvmpipe_bind_rasterizer_state(struct pipe_context *pipe, void *handle) state->lp_state.bottom_edge_rule); lp_setup_set_flatshade_first( llvmpipe->setup, state->lp_state.flatshade_first); - lp_setup_set_rasterizer_discard( llvmpipe->setup, - state->lp_state.rasterizer_discard); lp_setup_set_line_state( llvmpipe->setup, state->lp_state.line_width); lp_setup_set_point_state( llvmpipe->setup, |