r300-gallium: duplicate tokens in create_fs_state
authorJoakim Sindholt <opensource@zhasha.com>
Tue, 12 May 2009 19:41:48 +0000 (21:41 +0200)
committerJoakim Sindholt <opensource@zhasha.com>
Tue, 12 May 2009 19:41:48 +0000 (21:41 +0200)
This was all phoenix64's idea. Credit goes to him

src/gallium/drivers/r300/r300_state.c

index 0143e228c4ec94b44c181875ac3b9db7ac074346..80e11d6ecf31ab81ab8f5c33dd30a210c0ae072b 100644 (file)
@@ -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);
 }