diff options
author | Younes Manton <younes.m@gmail.com> | 2008-07-23 23:35:23 -0400 |
---|---|---|
committer | Younes Manton <younes.m@gmail.com> | 2008-07-23 23:46:45 -0400 |
commit | a8da04cb861b8f9caf3acd33f52f64621f0c15e2 (patch) | |
tree | bacbfd492330e23f9d670e4319c3f8c07f004153 /src/gallium/drivers/nv04 | |
parent | b4d198e47704f3b79c5a61877846172ae9d4b4c0 (diff) |
nv all: Copy shader tokens on create, free on delete.
Must copy token stream on shader create, client is allowed to free
their copy after creating the state object.
Diffstat (limited to 'src/gallium/drivers/nv04')
-rw-r--r-- | src/gallium/drivers/nv04/nv04_state.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/nv04/nv04_state.h | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/gallium/drivers/nv04/nv04_state.c b/src/gallium/drivers/nv04/nv04_state.c index d618465a20..7e71dee7b5 100644 --- a/src/gallium/drivers/nv04/nv04_state.c +++ b/src/gallium/drivers/nv04/nv04_state.c @@ -4,6 +4,7 @@ #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" +#include "tgsi/util/tgsi_parse.h" #include "nv04_context.h" #include "nv04_state.h" @@ -291,7 +292,7 @@ nv04_fp_state_create(struct pipe_context *pipe, struct nv04_fragment_program *fp; fp = CALLOC(1, sizeof(struct nv04_fragment_program)); - fp->pipe = cso; + fp->pipe.tokens = tgsi_dup_tokens(cso->tokens); return (void *)fp; } @@ -313,6 +314,7 @@ nv04_fp_state_delete(struct pipe_context *pipe, void *hwcso) struct nv04_fragment_program *fp = hwcso; nv04_fragprog_destroy(nv04, fp); + free((void*)fp->pipe.tokens); free(fp); } diff --git a/src/gallium/drivers/nv04/nv04_state.h b/src/gallium/drivers/nv04/nv04_state.h index 7487819c3a..39f7cd17b3 100644 --- a/src/gallium/drivers/nv04/nv04_state.h +++ b/src/gallium/drivers/nv04/nv04_state.h @@ -47,7 +47,7 @@ struct nv04_fragment_program_data { }; struct nv04_fragment_program { - const struct pipe_shader_state *pipe; + struct pipe_shader_state pipe; struct tgsi_shader_info info; boolean translated; |