Mesa (master): r300-gallium: duplicate tokens in create_fs_state

Joakim Sindholt jsindholt at kemper.freedesktop.org
Tue May 12 19:44:32 UTC 2009


Module: Mesa
Branch: master
Commit: 62c0c7d81a3f271b7dc7177467f9c884e89f9eee
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=62c0c7d81a3f271b7dc7177467f9c884e89f9eee

Author: Joakim Sindholt <opensource at zhasha.com>
Date:   Tue May 12 21:41:48 2009 +0200

r300-gallium: duplicate tokens in create_fs_state

This was all phoenix64's idea. Credit goes to him

---

 src/gallium/drivers/r300/r300_state.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 0143e22..80e11d6 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -289,6 +289,7 @@ static void* r300_create_fs_state(struct pipe_context* pipe,
 
     /* Copy state directly into shader. */
     fs->state = *shader;
+    fs->state.tokens = tgsi_dup_tokens(shader->tokens);
 
     tgsi_scan_shader(shader->tokens, &fs->info);
 
@@ -317,6 +318,8 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader)
 /* Delete fragment shader state. */
 static void r300_delete_fs_state(struct pipe_context* pipe, void* shader)
 {
+    struct r3xx_fragment_shader* fs = (struct r3xx_fragment_shader*)shader
+    FREE(fs->state.tokens);
     FREE(shader);
 }
 




More information about the mesa-commit mailing list