diff options
author | Zack Rusin <[email protected]> | 2007-09-28 04:33:55 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2007-09-28 09:12:20 -0400 |
commit | 6dcfddb8e2ec2bfb6187b912807fa65f28da2c5e (patch) | |
tree | 66c447fff8d693fa1a39522271bd29735d7828d6 /src/mesa/pipe/softpipe | |
parent | 7966e479dca22bf2d2b844d50ac5bef70614e15a (diff) |
Redoing the way we handle vertex shaders for the draw module.
Diffstat (limited to 'src/mesa/pipe/softpipe')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_context.c | 8 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_context.h | 8 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state.h | 14 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state_derived.c | 2 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_state_fs.c | 49 |
5 files changed, 58 insertions, 23 deletions
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index e415966dae1..695bf1a9e02 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -275,12 +275,12 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys, softpipe->pipe.create_rasterizer_state = softpipe_create_rasterizer_state; softpipe->pipe.bind_rasterizer_state = softpipe_bind_rasterizer_state; softpipe->pipe.delete_rasterizer_state = softpipe_delete_rasterizer_state; - softpipe->pipe.create_fs_state = softpipe_create_shader_state; + softpipe->pipe.create_fs_state = softpipe_create_fs_state; softpipe->pipe.bind_fs_state = softpipe_bind_fs_state; - softpipe->pipe.delete_fs_state = softpipe_delete_shader_state; - softpipe->pipe.create_vs_state = softpipe_create_shader_state; + softpipe->pipe.delete_fs_state = softpipe_delete_fs_state; + softpipe->pipe.create_vs_state = softpipe_create_vs_state; softpipe->pipe.bind_vs_state = softpipe_bind_vs_state; - softpipe->pipe.delete_vs_state = softpipe_delete_shader_state; + softpipe->pipe.delete_vs_state = softpipe_delete_vs_state; softpipe->pipe.set_blend_color = softpipe_set_blend_color; softpipe->pipe.set_clip_state = softpipe_set_clip_state; diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index c0a681f3d6b..ccf29b5683d 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -62,8 +62,12 @@ struct draw_stage; #define SP_NEW_VS 0x2000 #define SP_NEW_CONSTANTS 0x4000 +struct sp_vertex_shader_state { + const struct pipe_shader_state *state; + void *draw_data; +}; -struct softpipe_context { +struct softpipe_context { struct pipe_context pipe; /**< base class */ struct softpipe_winsys *winsys; /**< window system interface */ @@ -76,7 +80,7 @@ struct softpipe_context { const struct pipe_depth_stencil_state *depth_stencil; const struct pipe_rasterizer_state *rasterizer; const struct pipe_shader_state *fs; - const struct pipe_shader_state *vs; + const struct sp_vertex_shader_state *vs; struct pipe_blend_color blend_color; struct pipe_clear_color_state clear_color; diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h index f0e1461d258..f9061e86e53 100644 --- a/src/mesa/pipe/softpipe/sp_state.h +++ b/src/mesa/pipe/softpipe/sp_state.h @@ -87,12 +87,14 @@ void softpipe_set_constant_buffer(struct pipe_context *, void softpipe_set_feedback_state( struct pipe_context *, const struct pipe_feedback_state * ); -void * -softpipe_create_shader_state( struct pipe_context *, - const struct pipe_shader_state * ); -void softpipe_bind_fs_state( struct pipe_context *, void * ); -void softpipe_bind_vs_state( struct pipe_context *, void * ); -void softpipe_delete_shader_state( struct pipe_context *, void * ); +void *softpipe_create_fs_state(struct pipe_context *, + const struct pipe_shader_state *); +void softpipe_bind_fs_state(struct pipe_context *, void *); +void softpipe_delete_fs_state(struct pipe_context *, void *); +void *softpipe_create_vs_state(struct pipe_context *, + const struct pipe_shader_state *); +void softpipe_bind_vs_state(struct pipe_context *, void *); +void softpipe_delete_vs_state(struct pipe_context *, void *); void softpipe_set_polygon_stipple( struct pipe_context *, const struct pipe_poly_stipple * ); diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c index 6c6e7980698..b6145df8e25 100644 --- a/src/mesa/pipe/softpipe/sp_state_derived.c +++ b/src/mesa/pipe/softpipe/sp_state_derived.c @@ -43,7 +43,7 @@ */ static void calculate_vertex_layout( struct softpipe_context *softpipe ) { - const struct pipe_shader_state *vs = softpipe->vs; + const struct pipe_shader_state *vs = softpipe->vs->state; const struct pipe_shader_state *fs = softpipe->fs; const interp_mode colorInterp = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; diff --git a/src/mesa/pipe/softpipe/sp_state_fs.c b/src/mesa/pipe/softpipe/sp_state_fs.c index 8306a95f449..f1bec2c73ac 100644 --- a/src/mesa/pipe/softpipe/sp_state_fs.c +++ b/src/mesa/pipe/softpipe/sp_state_fs.c @@ -33,10 +33,13 @@ #include "pipe/draw/draw_context.h" -void * softpipe_create_shader_state(struct pipe_context *pipe, - const struct pipe_shader_state *templ) +void * softpipe_create_fs_state(struct pipe_context *pipe, + const struct pipe_shader_state *templ) { - /* we just want the pipe_shader_state template in the bind calls */ + /* Decide whether we'll be codegenerating this shader and if so do + * that now. + */ + return 0; } @@ -49,25 +52,51 @@ void softpipe_bind_fs_state(struct pipe_context *pipe, void *fs) softpipe->dirty |= SP_NEW_FS; } +void softpipe_delete_fs_state(struct pipe_context *pipe, + void *shader) +{ +} + + +void * softpipe_create_vs_state(struct pipe_context *pipe, + const struct pipe_shader_state *templ) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + struct sp_vertex_shader_state *state = + malloc(sizeof(struct sp_vertex_shader_state)); + + state->state = templ; + state->draw_data = draw_create_vertex_shader(softpipe->draw, + state->state); + + return state; +} void softpipe_bind_vs_state(struct pipe_context *pipe, void *vs) { struct softpipe_context *softpipe = softpipe_context(pipe); - softpipe->vs = (struct pipe_shader_state *)vs; + softpipe->vs = (const struct sp_vertex_shader_state *)vs; - softpipe->dirty |= SP_NEW_VS; + draw_bind_vertex_shader(softpipe->draw, softpipe->vs->draw_data); - draw_set_vertex_shader(softpipe->draw, (struct pipe_shader_state *)vs); + softpipe->dirty |= SP_NEW_VS; } - -void softpipe_delete_shader_state( struct pipe_context *pipe, - void *shader ) +void softpipe_delete_vs_state(struct pipe_context *pipe, + void *vs) { - /* do nothing */ + struct softpipe_context *softpipe = softpipe_context(pipe); + + struct sp_vertex_shader_state *state = + (struct sp_vertex_shader_state *)vs; + + draw_delete_vertex_shader(softpipe->draw, state->draw_data); + free(state); } + + void softpipe_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, const struct pipe_constant_buffer *buf) |