diff options
author | Keith Whitwell <keithw@vmware.com> | 2009-03-13 16:22:35 +0000 |
---|---|---|
committer | Keith Whitwell <keithw@vmware.com> | 2009-03-13 16:24:22 +0000 |
commit | fa0f48504a32642d688d4b81f62eea54c693b23f (patch) | |
tree | 609b5def4528f347a2d531308eb95d3e08fcc14a /src/gallium/drivers | |
parent | b3be1651f4a45660b447881f7c61c03a1b24302a (diff) |
gallium: no need to keep a copy of shader tokens in state tracker
Any driver who needs a copy of the shader tokens must organize to
do so itself. This has been the case for a long time, but there
was still defensive code in the state tracker, which is now removed.
Any bugs resulting from this need to be fixed in the offending driver...
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_fs_sse.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_state.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_state_fs.c | 26 |
3 files changed, 21 insertions, 9 deletions
diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c index abd37547a9..366abe2ed4 100644 --- a/src/gallium/drivers/softpipe/sp_fs_sse.c +++ b/src/gallium/drivers/softpipe/sp_fs_sse.c @@ -145,7 +145,7 @@ softpipe_create_fs_sse(struct softpipe_context *softpipe, return NULL; } - shader->base.shader = *templ; + shader->base.shader.tokens = NULL; /* don't hold reference to templ->tokens */ shader->base.prepare = fs_sse_prepare; shader->base.run = fs_sse_run; shader->base.delete = fs_sse_delete; diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index 6f558e6da5..9776e978e3 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -85,7 +85,7 @@ struct sp_fragment_shader { /** Subclass of pipe_shader_state */ struct sp_vertex_shader { - struct pipe_shader_state shader; /* Note: this field not actually used */ + struct pipe_shader_state shader; struct draw_vertex_shader *draw_data; }; diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c index b63180baa5..4330c20393 100644 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ b/src/gallium/drivers/softpipe/sp_state_fs.c @@ -36,6 +36,7 @@ #include "draw/draw_context.h" #include "tgsi/tgsi_dump.h" #include "tgsi/tgsi_scan.h" +#include "tgsi/tgsi_parse.h" void * @@ -97,17 +98,28 @@ softpipe_create_vs_state(struct pipe_context *pipe, struct sp_vertex_shader *state; state = CALLOC_STRUCT(sp_vertex_shader); - if (state == NULL ) { - return NULL; - } + if (state == NULL ) + goto fail; + + /* copy shader tokens, the ones passed in will go away. + */ + state->shader.tokens = tgsi_dup_tokens(templ->tokens); + if (state->shader.tokens == NULL) + goto fail; state->draw_data = draw_create_vertex_shader(softpipe->draw, templ); - if (state->draw_data == NULL) { - FREE( state ); - return NULL; - } + if (state->draw_data == NULL) + goto fail; return state; + +fail: + if (state) { + FREE( (void *)state->shader.tokens ); + FREE( state->draw_data ); + FREE( state ); + } + return NULL; } |