summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw/draw_vs_exec.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-03-24 16:31:15 -0600
committerBrian <brian.paul@tungstengraphics.com>2008-03-24 16:35:25 -0600
commitae146e4bc86aeade59d018100e39e160f7553994 (patch)
treeecd4019e22dab520ce99bb15405152be75b261a7 /src/gallium/auxiliary/draw/draw_vs_exec.c
parent7f430293772f201a59bcf62edd1ed4f942f8be29 (diff)
gallium: make a copy of the vertex shader's token array.
This solves problems when the state tracker frees the token array when the draw module still needs it.
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_vs_exec.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_exec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c
index 364693e0b4..4e2fa72707 100644
--- a/src/gallium/auxiliary/draw/draw_vs_exec.c
+++ b/src/gallium/auxiliary/draw/draw_vs_exec.c
@@ -38,6 +38,8 @@
#include "draw_context.h"
#include "draw_vs.h"
+#include "tgsi/util/tgsi_parse.h"
+
static INLINE unsigned
compute_clipmask(const float *clip, /*const*/ float plane[][4], unsigned nr)
@@ -187,6 +189,7 @@ vs_exec_run( struct draw_vertex_shader *shader,
static void
vs_exec_delete( struct draw_vertex_shader *dvs )
{
+ FREE((void*) dvs->state.tokens);
FREE( dvs );
}
@@ -196,11 +199,13 @@ draw_create_vs_exec(struct draw_context *draw,
const struct pipe_shader_state *state)
{
struct draw_vertex_shader *vs = CALLOC_STRUCT( draw_vertex_shader );
+ uint nt = tgsi_num_tokens(state->tokens);
if (vs == NULL)
return NULL;
- vs->state = *state;
+ /* we make a private copy of the tokens */
+ vs->state.tokens = mem_dup(state->tokens, nt * sizeof(state->tokens[0]));
vs->prepare = vs_exec_prepare;
vs->run = vs_exec_run;
vs->delete = vs_exec_delete;