softpipe: make blend/stencil/depth functions static

This commit is contained in:
Brian Paul 2010-09-25 13:58:41 -06:00
parent 279b368dc3
commit 2739692a6e
3 changed files with 44 additions and 50 deletions

View File

@ -228,9 +228,7 @@ softpipe_create_context( struct pipe_screen *screen,
softpipe->pipe.priv = priv; softpipe->pipe.priv = priv;
/* state setters */ /* state setters */
softpipe->pipe.create_blend_state = softpipe_create_blend_state; softpipe_init_blend_funcs(&softpipe->pipe);
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.create_sampler_state = softpipe_create_sampler_state;
softpipe->pipe.bind_fragment_sampler_states = softpipe_bind_sampler_states; softpipe->pipe.bind_fragment_sampler_states = softpipe_bind_sampler_states;
@ -238,10 +236,6 @@ softpipe_create_context( struct pipe_screen *screen,
softpipe->pipe.bind_geometry_sampler_states = softpipe_bind_geometry_sampler_states; softpipe->pipe.bind_geometry_sampler_states = softpipe_bind_geometry_sampler_states;
softpipe->pipe.delete_sampler_state = softpipe_delete_sampler_state; softpipe->pipe.delete_sampler_state = softpipe_delete_sampler_state;
softpipe->pipe.create_depth_stencil_alpha_state = softpipe_create_depth_stencil_state;
softpipe->pipe.bind_depth_stencil_alpha_state = softpipe_bind_depth_stencil_state;
softpipe->pipe.delete_depth_stencil_alpha_state = softpipe_delete_depth_stencil_state;
softpipe->pipe.create_rasterizer_state = softpipe_create_rasterizer_state; softpipe->pipe.create_rasterizer_state = softpipe_create_rasterizer_state;
softpipe->pipe.bind_rasterizer_state = softpipe_bind_rasterizer_state; softpipe->pipe.bind_rasterizer_state = softpipe_bind_rasterizer_state;
softpipe->pipe.delete_rasterizer_state = softpipe_delete_rasterizer_state; softpipe->pipe.delete_rasterizer_state = softpipe_delete_rasterizer_state;
@ -256,10 +250,7 @@ softpipe_create_context( struct pipe_screen *screen,
softpipe->pipe.bind_stream_output_state = softpipe_bind_stream_output_state; softpipe->pipe.bind_stream_output_state = softpipe_bind_stream_output_state;
softpipe->pipe.delete_stream_output_state = softpipe_delete_stream_output_state; softpipe->pipe.delete_stream_output_state = softpipe_delete_stream_output_state;
softpipe->pipe.set_blend_color = softpipe_set_blend_color;
softpipe->pipe.set_stencil_ref = softpipe_set_stencil_ref;
softpipe->pipe.set_clip_state = softpipe_set_clip_state; softpipe->pipe.set_clip_state = softpipe_set_clip_state;
softpipe->pipe.set_sample_mask = softpipe_set_sample_mask;
softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state; softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state;
softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple; softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple;
softpipe->pipe.set_scissor_state = softpipe_set_scissor_state; softpipe->pipe.set_scissor_state = softpipe_set_scissor_state;

View File

@ -115,13 +115,8 @@ struct sp_so_state {
}; };
void * void
softpipe_create_blend_state(struct pipe_context *, softpipe_init_blend_funcs(struct pipe_context *pipe);
const struct pipe_blend_state *);
void softpipe_bind_blend_state(struct pipe_context *,
void *);
void softpipe_delete_blend_state(struct pipe_context *,
void *);
void * void *
softpipe_create_sampler_state(struct pipe_context *, softpipe_create_sampler_state(struct pipe_context *,
@ -137,12 +132,6 @@ softpipe_bind_geometry_sampler_states(struct pipe_context *,
void **samplers); void **samplers);
void softpipe_delete_sampler_state(struct pipe_context *, void *); void softpipe_delete_sampler_state(struct pipe_context *, void *);
void *
softpipe_create_depth_stencil_state(struct pipe_context *,
const struct pipe_depth_stencil_alpha_state *);
void softpipe_bind_depth_stencil_state(struct pipe_context *, void *);
void softpipe_delete_depth_stencil_state(struct pipe_context *, void *);
void * void *
softpipe_create_rasterizer_state(struct pipe_context *, softpipe_create_rasterizer_state(struct pipe_context *,
const struct pipe_rasterizer_state *); const struct pipe_rasterizer_state *);
@ -152,18 +141,9 @@ void softpipe_delete_rasterizer_state(struct pipe_context *, void *);
void softpipe_set_framebuffer_state( struct pipe_context *, void softpipe_set_framebuffer_state( struct pipe_context *,
const struct pipe_framebuffer_state * ); const struct pipe_framebuffer_state * );
void softpipe_set_blend_color( struct pipe_context *pipe,
const struct pipe_blend_color *blend_color );
void softpipe_set_stencil_ref( struct pipe_context *pipe,
const struct pipe_stencil_ref *stencil_ref );
void softpipe_set_clip_state( struct pipe_context *, void softpipe_set_clip_state( struct pipe_context *,
const struct pipe_clip_state * ); const struct pipe_clip_state * );
void softpipe_set_sample_mask( struct pipe_context *,
unsigned sample_mask );
void void
softpipe_init_shader_funcs(struct pipe_context *pipe); softpipe_init_shader_funcs(struct pipe_context *pipe);

View File

@ -34,14 +34,16 @@
#include "sp_state.h" #include "sp_state.h"
void * static void *
softpipe_create_blend_state(struct pipe_context *pipe, softpipe_create_blend_state(struct pipe_context *pipe,
const struct pipe_blend_state *blend) const struct pipe_blend_state *blend)
{ {
return mem_dup(blend, sizeof(*blend)); return mem_dup(blend, sizeof(*blend));
} }
void softpipe_bind_blend_state( struct pipe_context *pipe,
static void
softpipe_bind_blend_state(struct pipe_context *pipe,
void *blend) void *blend)
{ {
struct softpipe_context *softpipe = softpipe_context(pipe); struct softpipe_context *softpipe = softpipe_context(pipe);
@ -53,14 +55,17 @@ void softpipe_bind_blend_state( struct pipe_context *pipe,
softpipe->dirty |= SP_NEW_BLEND; softpipe->dirty |= SP_NEW_BLEND;
} }
void softpipe_delete_blend_state(struct pipe_context *pipe,
static void
softpipe_delete_blend_state(struct pipe_context *pipe,
void *blend) void *blend)
{ {
FREE( blend ); FREE( blend );
} }
void softpipe_set_blend_color( struct pipe_context *pipe, static void
softpipe_set_blend_color(struct pipe_context *pipe,
const struct pipe_blend_color *blend_color) const struct pipe_blend_color *blend_color)
{ {
struct softpipe_context *softpipe = softpipe_context(pipe); struct softpipe_context *softpipe = softpipe_context(pipe);
@ -73,19 +78,15 @@ void softpipe_set_blend_color( struct pipe_context *pipe,
} }
/** XXX move someday? Or consolidate all these simple state setters static void *
* into one file.
*/
void *
softpipe_create_depth_stencil_state(struct pipe_context *pipe, softpipe_create_depth_stencil_state(struct pipe_context *pipe,
const struct pipe_depth_stencil_alpha_state *depth_stencil) const struct pipe_depth_stencil_alpha_state *depth_stencil)
{ {
return mem_dup(depth_stencil, sizeof(*depth_stencil)); return mem_dup(depth_stencil, sizeof(*depth_stencil));
} }
void
static void
softpipe_bind_depth_stencil_state(struct pipe_context *pipe, softpipe_bind_depth_stencil_state(struct pipe_context *pipe,
void *depth_stencil) void *depth_stencil)
{ {
@ -96,13 +97,16 @@ softpipe_bind_depth_stencil_state(struct pipe_context *pipe,
softpipe->dirty |= SP_NEW_DEPTH_STENCIL_ALPHA; softpipe->dirty |= SP_NEW_DEPTH_STENCIL_ALPHA;
} }
void
static void
softpipe_delete_depth_stencil_state(struct pipe_context *pipe, void *depth) softpipe_delete_depth_stencil_state(struct pipe_context *pipe, void *depth)
{ {
FREE( depth ); FREE( depth );
} }
void softpipe_set_stencil_ref( struct pipe_context *pipe,
static void
softpipe_set_stencil_ref(struct pipe_context *pipe,
const struct pipe_stencil_ref *stencil_ref) const struct pipe_stencil_ref *stencil_ref)
{ {
struct softpipe_context *softpipe = softpipe_context(pipe); struct softpipe_context *softpipe = softpipe_context(pipe);
@ -112,9 +116,28 @@ void softpipe_set_stencil_ref( struct pipe_context *pipe,
softpipe->dirty |= SP_NEW_DEPTH_STENCIL_ALPHA; softpipe->dirty |= SP_NEW_DEPTH_STENCIL_ALPHA;
} }
void
static void
softpipe_set_sample_mask(struct pipe_context *pipe, softpipe_set_sample_mask(struct pipe_context *pipe,
unsigned sample_mask) unsigned sample_mask)
{ {
} }
void
softpipe_init_blend_funcs(struct pipe_context *pipe)
{
pipe->create_blend_state = softpipe_create_blend_state;
pipe->bind_blend_state = softpipe_bind_blend_state;
pipe->delete_blend_state = softpipe_delete_blend_state;
pipe->set_blend_color = softpipe_set_blend_color;
pipe->create_depth_stencil_alpha_state = softpipe_create_depth_stencil_state;
pipe->bind_depth_stencil_alpha_state = softpipe_bind_depth_stencil_state;
pipe->delete_depth_stencil_alpha_state = softpipe_delete_depth_stencil_state;
pipe->set_stencil_ref = softpipe_set_stencil_ref;
pipe->set_sample_mask = softpipe_set_sample_mask;
}