summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_state_fs.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-03-20 10:52:17 +1000
committerDave Airlie <airlied@redhat.com>2009-03-20 10:52:17 +1000
commit407e8ae5b167b0193e1e5b1266a5d61ed836dfb5 (patch)
tree2d9d05a5c3122f41a13aa8bd9ae921c1176e6b0d /src/gallium/drivers/softpipe/sp_state_fs.c
parentbdaa0341caffc353fd26bbd91865c2d86eed11c1 (diff)
parent114bb54324f22cb53bcd14607234d0acd74d37bd (diff)
Merge remote branch 'main/master' into radeon-rewrite
Conflicts: src/mesa/drivers/dri/r300/r300_cmdbuf.c src/mesa/drivers/dri/r300/r300_state.c src/mesa/drivers/dri/r300/r300_swtcl.c src/mesa/drivers/dri/r300/radeon_ioctl.c src/mesa/drivers/dri/radeon/radeon_screen.c
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_state_fs.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_state_fs.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c
index 4d01a9dbe1..4330c20393 100644
--- a/src/gallium/drivers/softpipe/sp_state_fs.c
+++ b/src/gallium/drivers/softpipe/sp_state_fs.c
@@ -31,12 +31,12 @@
#include "pipe/p_defines.h"
#include "util/u_memory.h"
-#include "pipe/p_inlines.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_shader_tokens.h"
#include "draw/draw_context.h"
#include "tgsi/tgsi_dump.h"
#include "tgsi/tgsi_scan.h"
+#include "tgsi/tgsi_parse.h"
void *
@@ -98,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;
}
@@ -146,14 +157,12 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
const struct pipe_constant_buffer *buf)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- struct pipe_screen *screen = pipe->screen;
assert(shader < PIPE_SHADER_TYPES);
assert(index == 0);
/* note: reference counting */
- pipe_buffer_reference(screen,
- &softpipe->constants[shader].buffer,
+ pipe_buffer_reference(&softpipe->constants[shader].buffer,
buf ? buf->buffer : NULL);
softpipe->dirty |= SP_NEW_CONSTANTS;