diff options
author | Zack Rusin <[email protected]> | 2007-09-17 09:47:41 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2007-09-18 06:31:22 -0400 |
commit | f117327a3f246713abfd4dc4320d4a1a7f1b811a (patch) | |
tree | 81c5c58c0ae0685c917996ad04f10003aa95cfa3 /src/mesa/pipe/softpipe | |
parent | e16c045b83f5c5b4f4064df67623bb76b46b6619 (diff) |
Make sampler an immutable state object.
Switch the sample to be an immutable state object.
Diffstat (limited to 'src/mesa/pipe/softpipe')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_context.c | 4 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_context.h | 4 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state.h | 13 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state_sampler.c | 26 |
4 files changed, 36 insertions, 11 deletions
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index b9c7013e9e1..bab7985e8d1 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -253,6 +253,9 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys, softpipe->pipe.create_blend_state = softpipe_create_blend_state; softpipe->pipe.bind_blend_state = softpipe_bind_blend_state; softpipe->pipe.delete_blend_state = softpipe_delete_blend_state; + softpipe->pipe.create_sampler_state = softpipe_create_sampler_state; + softpipe->pipe.bind_sampler_state = softpipe_bind_sampler_state; + softpipe->pipe.delete_sampler_state = softpipe_delete_sampler_state; softpipe->pipe.set_alpha_test_state = softpipe_set_alpha_test_state; softpipe->pipe.set_blend_color = softpipe_set_blend_color; @@ -265,7 +268,6 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys, softpipe->pipe.set_fs_state = softpipe_set_fs_state; softpipe->pipe.set_vs_state = softpipe_set_vs_state; softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple; - softpipe->pipe.set_sampler_state = softpipe_set_sampler_state; softpipe->pipe.set_scissor_state = softpipe_set_scissor_state; softpipe->pipe.set_setup_state = softpipe_set_setup_state; softpipe->pipe.set_stencil_state = softpipe_set_stencil_state; diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index 7fecf2974ac..5cee1a3cf93 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -71,7 +71,8 @@ struct softpipe_context { /* The most recent drawing state as set by the driver: */ - const struct pipe_blend_state *blend; + const struct pipe_blend_state *blend; + const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS]; struct pipe_alpha_test_state alpha_test; struct pipe_blend_color blend_color; @@ -85,7 +86,6 @@ struct softpipe_context { struct pipe_shader_state vs; struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissor; - struct pipe_sampler_state sampler[PIPE_MAX_SAMPLERS]; struct pipe_setup_state setup; struct pipe_stencil_state stencil; struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS]; diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h index e2b1a2a1641..c8c93709dbc 100644 --- a/src/mesa/pipe/softpipe/sp_state.h +++ b/src/mesa/pipe/softpipe/sp_state.h @@ -41,6 +41,15 @@ void softpipe_bind_blend_state(struct pipe_context *, void softpipe_delete_blend_state(struct pipe_context *, const struct pipe_blend_state *); +const struct pipe_sampler_state * +softpipe_create_sampler_state(struct pipe_context *, + const struct pipe_sampler_state *); +void softpipe_bind_sampler_state(struct pipe_context *, + unsigned, + const struct pipe_sampler_state *); +void softpipe_delete_sampler_state(struct pipe_context *, + const struct pipe_sampler_state *); + void softpipe_set_framebuffer_state( struct pipe_context *, const struct pipe_framebuffer_state * ); @@ -81,10 +90,6 @@ void softpipe_set_scissor_state( struct pipe_context *, void softpipe_set_setup_state( struct pipe_context *, const struct pipe_setup_state * ); -void softpipe_set_sampler_state( struct pipe_context *, - unsigned unit, - const struct pipe_sampler_state * ); - void softpipe_set_stencil_state( struct pipe_context *, const struct pipe_stencil_state * ); diff --git a/src/mesa/pipe/softpipe/sp_state_sampler.c b/src/mesa/pipe/softpipe/sp_state_sampler.c index 2e3d0c3d65d..09898eb5790 100644 --- a/src/mesa/pipe/softpipe/sp_state_sampler.c +++ b/src/mesa/pipe/softpipe/sp_state_sampler.c @@ -34,21 +34,39 @@ +const struct pipe_sampler_state * +softpipe_create_sampler_state(struct pipe_context *pipe, + const struct pipe_sampler_state *sampler) +{ + struct pipe_sampler_state *new_sampler = malloc(sizeof(struct pipe_sampler_state)); + memcpy(new_sampler, sampler, sizeof(struct pipe_sampler_state)); + + return new_sampler; +} + void -softpipe_set_sampler_state(struct pipe_context *pipe, - unsigned unit, - const struct pipe_sampler_state *sampler) +softpipe_bind_sampler_state(struct pipe_context *pipe, + unsigned unit, + const struct pipe_sampler_state *sampler) { struct softpipe_context *softpipe = softpipe_context(pipe); assert(unit < PIPE_MAX_SAMPLERS); - softpipe->sampler[unit] = *sampler; + softpipe->sampler[unit] = sampler; softpipe->dirty |= SP_NEW_SAMPLER; } void +softpipe_delete_sampler_state(struct pipe_context *pipe, + const struct pipe_sampler_state *sampler) +{ + free((struct pipe_sampler_state*)sampler); +} + + +void softpipe_set_texture_state(struct pipe_context *pipe, unsigned unit, struct pipe_mipmap_tree *texture) |