diff options
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r-- | src/mesa/pipe/cso_cache/cso_cache.h | 5 | ||||
-rw-r--r-- | src/mesa/pipe/failover/fo_context.h | 2 | ||||
-rw-r--r-- | src/mesa/pipe/failover/fo_state.c | 35 | ||||
-rw-r--r-- | src/mesa/pipe/failover/fo_state_emit.c | 3 | ||||
-rw-r--r-- | src/mesa/pipe/i915simple/i915_state.c | 16 | ||||
-rw-r--r-- | src/mesa/pipe/p_context.h | 11 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state.h | 14 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state_blend.c | 16 |
8 files changed, 61 insertions, 41 deletions
diff --git a/src/mesa/pipe/cso_cache/cso_cache.h b/src/mesa/pipe/cso_cache/cso_cache.h index 57d162b2acc..291759d5d1e 100644 --- a/src/mesa/pipe/cso_cache/cso_cache.h +++ b/src/mesa/pipe/cso_cache/cso_cache.h @@ -53,6 +53,11 @@ struct cso_blend { void *data; }; +struct cso_depth_stencil { + struct pipe_depth_stencil_state state; + void *data; +}; + struct cso_rasterizer { struct pipe_rasterizer_state state; void *data; diff --git a/src/mesa/pipe/failover/fo_context.h b/src/mesa/pipe/failover/fo_context.h index a81bfe82ddb..7371ad4392b 100644 --- a/src/mesa/pipe/failover/fo_context.h +++ b/src/mesa/pipe/failover/fo_context.h @@ -72,7 +72,7 @@ struct failover_context { */ const struct fo_state *blend; const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS]; - const struct pipe_depth_stencil_state *depth_stencil; + const struct fo_state *depth_stencil; const struct fo_state *rasterizer; const struct fo_state *fragment_shader; const struct fo_state *vertex_shader; diff --git a/src/mesa/pipe/failover/fo_state.c b/src/mesa/pipe/failover/fo_state.c index db3aea77565..3379f453557 100644 --- a/src/mesa/pipe/failover/fo_state.c +++ b/src/mesa/pipe/failover/fo_state.c @@ -128,18 +128,45 @@ failover_set_clear_color_state( struct pipe_context *pipe, failover->hw->set_clear_color_state( failover->hw, clear_color ); } +static void * +failover_create_depth_stencil_state(struct pipe_context *pipe, + const struct pipe_depth_stencil_state *templ) +{ + struct fo_state *state = malloc(sizeof(struct fo_state)); + struct failover_context *failover = failover_context(pipe); + + state->sw_state = failover->sw->create_depth_stencil_state(pipe, templ); + state->hw_state = failover->hw->create_depth_stencil_state(pipe, templ); + + return state; +} + static void failover_bind_depth_stencil_state(struct pipe_context *pipe, - const struct pipe_depth_stencil_state *depth_stencil) + void *depth_stencil) { struct failover_context *failover = failover_context(pipe); - failover->depth_stencil = depth_stencil; + failover->depth_stencil = (struct fo_state *)depth_stencil; failover->dirty |= FO_NEW_DEPTH_STENCIL; failover->hw->bind_depth_stencil_state( failover->hw, depth_stencil ); } static void +failover_delete_depth_stencil_state(struct pipe_context *pipe, + void *ds) +{ + struct fo_state *state = (struct fo_state*)ds; + struct failover_context *failover = failover_context(pipe); + + failover->sw->delete_depth_stencil_state(pipe, state->sw_state); + failover->hw->delete_depth_stencil_state(pipe, state->hw_state); + state->sw_state = 0; + state->hw_state = 0; + free(state); +} + +static void failover_set_framebuffer_state(struct pipe_context *pipe, const struct pipe_framebuffer_state *framebuffer) { @@ -363,7 +390,9 @@ failover_init_state_functions( struct failover_context *failover ) failover->pipe.bind_blend_state = failover_bind_blend_state; failover->pipe.delete_blend_state = failover_delete_blend_state; failover->pipe.bind_sampler_state = failover_bind_sampler_state; - failover->pipe.bind_depth_stencil_state = failover_bind_depth_stencil_state; + failover->pipe.create_depth_stencil_state = failover_create_depth_stencil_state; + failover->pipe.bind_depth_stencil_state = failover_bind_depth_stencil_state; + failover->pipe.delete_depth_stencil_state = failover_delete_depth_stencil_state; failover->pipe.create_rasterizer_state = failover_create_rasterizer_state; failover->pipe.bind_rasterizer_state = failover_bind_rasterizer_state; failover->pipe.delete_rasterizer_state = failover_delete_rasterizer_state; diff --git a/src/mesa/pipe/failover/fo_state_emit.c b/src/mesa/pipe/failover/fo_state_emit.c index ec896fd0204..da12b4e25ce 100644 --- a/src/mesa/pipe/failover/fo_state_emit.c +++ b/src/mesa/pipe/failover/fo_state_emit.c @@ -72,7 +72,8 @@ failover_state_emit( struct failover_context *failover ) failover->sw->set_clear_color_state( failover->sw, &failover->clear_color ); if (failover->dirty & FO_NEW_DEPTH_STENCIL) - failover->sw->bind_depth_stencil_state( failover->sw, failover->depth_stencil ); + failover->sw->bind_depth_stencil_state( failover->sw, + failover->depth_stencil->sw_state ); if (failover->dirty & FO_NEW_FRAMEBUFFER) failover->sw->set_framebuffer_state( failover->sw, &failover->framebuffer ); diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c index 1104c9519db..be549ed6fdb 100644 --- a/src/mesa/pipe/i915simple/i915_state.c +++ b/src/mesa/pipe/i915simple/i915_state.c @@ -175,31 +175,27 @@ static void i915_delete_sampler_state(struct pipe_context *pipe, * into one file. */ -static const struct pipe_depth_stencil_state * +static void * i915_create_depth_stencil_state(struct pipe_context *pipe, const struct pipe_depth_stencil_state *depth_stencil) { - struct pipe_depth_stencil_state *new_ds = - malloc(sizeof(struct pipe_depth_stencil_state)); - memcpy(new_ds, depth_stencil, sizeof(struct pipe_depth_stencil_state)); - - return new_ds; + return 0; } static void i915_bind_depth_stencil_state(struct pipe_context *pipe, - const struct pipe_depth_stencil_state *depth_stencil) + void *depth_stencil) { struct i915_context *i915 = i915_context(pipe); - i915->depth_stencil = depth_stencil; + i915->depth_stencil = (const struct pipe_depth_stencil_state *)depth_stencil; i915->dirty |= I915_NEW_DEPTH_STENCIL; } static void i915_delete_depth_stencil_state(struct pipe_context *pipe, - const struct pipe_depth_stencil_state *depth_stencil) + void *depth_stencil) { - free((struct pipe_depth_stencil_state *)depth_stencil); + /* do nothing */ } static void i915_set_alpha_test_state(struct pipe_context *pipe, diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index e17faad2c73..84aca20c58a 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -105,13 +105,10 @@ struct pipe_context { void (*bind_rasterizer_state)(struct pipe_context *, void *); void (*delete_rasterizer_state)(struct pipe_context *, void *); - const struct pipe_depth_stencil_state * (*create_depth_stencil_state)( - struct pipe_context *, - const struct pipe_depth_stencil_state *); - void (*bind_depth_stencil_state)(struct pipe_context *, - const struct pipe_depth_stencil_state *); - void (*delete_depth_stencil_state)(struct pipe_context *, - const struct pipe_depth_stencil_state *); + void * (*create_depth_stencil_state)(struct pipe_context *, + const struct pipe_depth_stencil_state *); + void (*bind_depth_stencil_state)(struct pipe_context *, void *); + void (*delete_depth_stencil_state)(struct pipe_context *, void *); void * (*create_fs_state)(struct pipe_context *, const struct pipe_shader_state *); diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h index 5ed963c21de..08dfe208fbd 100644 --- a/src/mesa/pipe/softpipe/sp_state.h +++ b/src/mesa/pipe/softpipe/sp_state.h @@ -50,21 +50,17 @@ void softpipe_bind_sampler_state(struct pipe_context *, void softpipe_delete_sampler_state(struct pipe_context *, const struct pipe_sampler_state *); -const struct pipe_depth_stencil_state * +void * softpipe_create_depth_stencil_state(struct pipe_context *, const struct pipe_depth_stencil_state *); -void softpipe_bind_depth_stencil_state(struct pipe_context *, - const struct pipe_depth_stencil_state *); -void softpipe_delete_depth_stencil_state(struct pipe_context *, - const struct pipe_depth_stencil_state *); +void softpipe_bind_depth_stencil_state(struct pipe_context *, void *); +void softpipe_delete_depth_stencil_state(struct pipe_context *, void *); void * softpipe_create_rasterizer_state(struct pipe_context *, const struct pipe_rasterizer_state *); -void softpipe_bind_rasterizer_state(struct pipe_context *, - void *); -void softpipe_delete_rasterizer_state(struct pipe_context *, - void *); +void softpipe_bind_rasterizer_state(struct pipe_context *, void *); +void softpipe_delete_rasterizer_state(struct pipe_context *, void *); void softpipe_set_framebuffer_state( struct pipe_context *, const struct pipe_framebuffer_state * ); diff --git a/src/mesa/pipe/softpipe/sp_state_blend.c b/src/mesa/pipe/softpipe/sp_state_blend.c index 7fb47e7aaba..cf476079557 100644 --- a/src/mesa/pipe/softpipe/sp_state_blend.c +++ b/src/mesa/pipe/softpipe/sp_state_blend.c @@ -82,30 +82,26 @@ softpipe_set_alpha_test_state(struct pipe_context *pipe, softpipe->dirty |= SP_NEW_ALPHA_TEST; } -const struct pipe_depth_stencil_state * +void * softpipe_create_depth_stencil_state(struct pipe_context *pipe, const struct pipe_depth_stencil_state *depth_stencil) { - struct pipe_depth_stencil_state *new_ds = malloc(sizeof(struct pipe_depth_stencil_state)); - memcpy(new_ds, depth_stencil, sizeof(struct pipe_depth_stencil_state)); - - return new_ds; + return 0; } void softpipe_bind_depth_stencil_state(struct pipe_context *pipe, - const struct pipe_depth_stencil_state *depth_stencil) + void *depth_stencil) { struct softpipe_context *softpipe = softpipe_context(pipe); - softpipe->depth_stencil = depth_stencil; + softpipe->depth_stencil = (const struct pipe_depth_stencil_state *)depth_stencil; softpipe->dirty |= SP_NEW_DEPTH_STENCIL; } void -softpipe_delete_depth_stencil_state(struct pipe_context *pipe, - const struct pipe_depth_stencil_state *depth) +softpipe_delete_depth_stencil_state(struct pipe_context *pipe, void *depth) { - free((struct pipe_depth_stencil_state*)depth); + /* do nothing */ } |