Module: Mesa Branch: master Commit: fc31f9a3f255c5565ce2a3e9c73415bc17199e28 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc31f9a3f255c5565ce2a3e9c73415bc17199e28
Author: José Fonseca <jfons...@vmware.com> Date: Fri Sep 23 16:32:31 2011 +0100 draw: Make copy of the TGSI tokens. There is no guarantee that the tokens TGSI will persist beyond the create_fs_state. The pipe driver (and therefore the draw module) is responsible for making copies of the TGSI tokens when it needs them. Reviewed-by: Brian Paul <bri...@vmware.com> --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 4 +++- src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 458f85d..7ecd2aa 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -848,7 +848,7 @@ aaline_create_fs_state(struct pipe_context *pipe, if (aafs == NULL) return NULL; - aafs->state = *fs; + aafs->state.tokens = tgsi_dup_tokens(fs->tokens); /* pass-through */ aafs->driver_fs = aaline->driver_create_fs_state(pipe, fs); @@ -882,6 +882,8 @@ aaline_delete_fs_state(struct pipe_context *pipe, void *fs) if (aafs->aaline_fs) aaline->driver_delete_fs_state(pipe, aafs->aaline_fs); + FREE((void*)aafs->state.tokens); + FREE(aafs); } diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index 9265c37..698ab13 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -834,7 +834,7 @@ aapoint_create_fs_state(struct pipe_context *pipe, if (aafs == NULL) return NULL; - aafs->state = *fs; + aafs->state.tokens = tgsi_dup_tokens(fs->tokens); /* pass-through */ aafs->driver_fs = aapoint->driver_create_fs_state(pipe, fs); @@ -868,6 +868,8 @@ aapoint_delete_fs_state(struct pipe_context *pipe, void *fs) if (aafs->aapoint_fs) aapoint->driver_delete_fs_state(pipe, aafs->aapoint_fs); + FREE((void*)aafs->state.tokens); + FREE(aafs); } _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit