diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-03-24 16:31:15 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-03-24 16:35:25 -0600 |
commit | ae146e4bc86aeade59d018100e39e160f7553994 (patch) | |
tree | ecd4019e22dab520ce99bb15405152be75b261a7 /src/gallium/auxiliary/draw/draw_vs_llvm.c | |
parent | 7f430293772f201a59bcf62edd1ed4f942f8be29 (diff) | |
download | external_mesa3d-ae146e4bc86aeade59d018100e39e160f7553994.zip external_mesa3d-ae146e4bc86aeade59d018100e39e160f7553994.tar.gz external_mesa3d-ae146e4bc86aeade59d018100e39e160f7553994.tar.bz2 |
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_llvm.c')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_vs_llvm.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_vs_llvm.c b/src/gallium/auxiliary/draw/draw_vs_llvm.c index 53c260b..bd983f2 100644 --- a/src/gallium/auxiliary/draw/draw_vs_llvm.c +++ b/src/gallium/auxiliary/draw/draw_vs_llvm.c @@ -38,6 +38,8 @@ #include "draw_context.h" #include "draw_vs.h" +#include "tgsi/util/tgsi_parse.h" + #ifdef MESA_LLVM #include "gallivm/gallivm.h" @@ -186,6 +188,7 @@ vs_llvm_delete( struct draw_vertex_shader *base ) /* Do something to free compiled shader: */ + FREE( (void*) shader->base.state.tokens ); FREE( shader ); } @@ -197,12 +200,14 @@ draw_create_vs_llvm(struct draw_context *draw, const struct pipe_shader_state *templ) { struct draw_llvm_vertex_shader *vs; + uint nt = tgsi_num_tokens(templ->tokens); vs = CALLOC_STRUCT( draw_llvm_vertex_shader ); if (vs == NULL) return NULL; - vs->base.state = templ; + /* we make a private copy of the tokens */ + vs->base.state.tokens = mem_dup(templ->tokens, nt * sizeof(templ->tokens[0])); vs->base.prepare = vs_llvm_prepare; vs->base.run = vs_llvm_run; vs->base.delete = vs_llvm_delete; |