struct draw_context;
struct draw_stage;
struct softpipe_tile_cache;
+struct sp_fragment_shader_state;
+struct sp_vertex_shader_state;
-struct sp_vertex_shader_state {
- struct pipe_shader_state *state;
- void *draw_data;
-};
-
struct softpipe_context {
struct pipe_context pipe; /**< base class */
struct softpipe_winsys *winsys; /**< window system interface */
-/**
- * Softpipe fs state is derived from pipe_shader_state.
- */
+/** Subclass of pipe_shader_state */
struct sp_fragment_shader_state {
struct pipe_shader_state shader;
#if defined(__i386__) || defined(__386__)
};
+/** Subclass of pipe_shader_state */
+struct sp_vertex_shader_state {
+ struct pipe_shader_state shader;
+ void *draw_data;
+};
+
+
+
void *
softpipe_create_blend_state(struct pipe_context *,
const struct pipe_blend_state *);
const struct pipe_shader_state *templ)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
+ struct sp_fragment_shader_state *state;
/* Decide whether we'll be codegenerating this shader and if so do
* that now.
*/
- struct sp_fragment_shader_state *state = MALLOC( sizeof(struct sp_fragment_shader_state) );
+ state = CALLOC_STRUCT(sp_fragment_shader_state);
+ if (!state)
+ return NULL;
+
state->shader = *templ;
- if( softpipe->dump_fs ) {
- tgsi_dump(
- state->shader.tokens,
- 0 );
+ if (softpipe->dump_fs) {
+ tgsi_dump(state->shader.tokens, 0);
}
#if defined(__i386__) || defined(__386__)
return state;
}
+
void softpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
softpipe->dirty |= SP_NEW_FS;
}
+
void softpipe_delete_fs_state(struct pipe_context *pipe,
void *shader)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
struct sp_vertex_shader_state *state;
- state = MALLOC( sizeof(struct sp_vertex_shader_state) );
+ state = CALLOC_STRUCT(sp_vertex_shader_state);
if (state == NULL ) {
return NULL;
}
- state->state = MALLOC( sizeof(struct pipe_shader_state) );
- if (state->state == NULL) {
- FREE( state );
- return NULL;
- }
- memcpy( state->state, templ, sizeof(struct pipe_shader_state) );
+ state->shader = *templ;
state->draw_data = draw_create_vertex_shader(softpipe->draw,
- state->state);
+ &state->shader);
if (state->draw_data == NULL) {
- FREE( state->state );
FREE( state );
return NULL;
}
return state;
}
+
void softpipe_bind_vs_state(struct pipe_context *pipe, void *vs)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
softpipe->dirty |= SP_NEW_VS;
}
-void softpipe_delete_vs_state(struct pipe_context *pipe,
- void *vs)
+
+void softpipe_delete_vs_state(struct pipe_context *pipe, void *vs)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
(struct sp_vertex_shader_state *)vs;
draw_delete_vertex_shader(softpipe->draw, state->draw_data);
- FREE( state->state );
FREE( state );
}
-
void softpipe_set_constant_buffer(struct pipe_context *pipe,
uint shader, uint index,
const struct pipe_constant_buffer *buf)
softpipe->dirty |= SP_NEW_CONSTANTS;
}
-
-