summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/i965simple
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-05-18 16:17:50 -0600
committerBrian Paul <[email protected]>2008-05-18 16:17:50 -0600
commit54fbd8bbd4e5a484d59907bae852908e3a8b8f3c (patch)
tree2e45fac3c2505fe1131ed38e45110e1319f49806 /src/gallium/drivers/i965simple
parentb4219e35e2de783ca03e53c311a8a56f8b633aa1 (diff)
parenta0bfeb0c3ca58a1f4d978f2aaa343ed4009de079 (diff)
Merge branch 'gallium-0.1' into gallium-tex-surfaces
Diffstat (limited to 'src/gallium/drivers/i965simple')
-rw-r--r--src/gallium/drivers/i965simple/brw_state.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gallium/drivers/i965simple/brw_state.c b/src/gallium/drivers/i965simple/brw_state.c
index 376f1487b29..ac243b7e4f9 100644
--- a/src/gallium/drivers/i965simple/brw_state.c
+++ b/src/gallium/drivers/i965simple/brw_state.c
@@ -35,6 +35,7 @@
#include "pipe/p_inlines.h"
#include "pipe/p_shader_tokens.h"
#include "tgsi/util/tgsi_dump.h"
+#include "tgsi/util/tgsi_parse.h"
#include "brw_context.h"
#include "brw_defines.h"
@@ -182,9 +183,7 @@ static void * brw_create_fs_state(struct pipe_context *pipe,
{
struct brw_fragment_program *brw_fp = CALLOC_STRUCT(brw_fragment_program);
- /* XXX: Do I have to duplicate the tokens as well??
- */
- brw_fp->program = *shader;
+ brw_fp->program.tokens = tgsi_dup_tokens(shader->tokens);
brw_fp->id = brw_context(pipe)->program_id++;
tgsi_scan_shader(shader->tokens, &brw_fp->info);
@@ -210,7 +209,10 @@ static void brw_bind_fs_state(struct pipe_context *pipe, void *shader)
static void brw_delete_fs_state(struct pipe_context *pipe, void *shader)
{
- FREE(shader);
+ struct brw_fragment_program *brw_fp = (struct brw_fragment_program *) shader;
+
+ FREE((void *) brw_fp->program.tokens);
+ FREE(brw_fp);
}
@@ -223,9 +225,7 @@ static void *brw_create_vs_state(struct pipe_context *pipe,
{
struct brw_vertex_program *brw_vp = CALLOC_STRUCT(brw_vertex_program);
- /* XXX: Do I have to duplicate the tokens as well??
- */
- brw_vp->program = *shader;
+ brw_vp->program.tokens = tgsi_dup_tokens(shader->tokens);
brw_vp->id = brw_context(pipe)->program_id++;
tgsi_scan_shader(shader->tokens, &brw_vp->info);
@@ -251,7 +251,10 @@ static void brw_bind_vs_state(struct pipe_context *pipe, void *vs)
static void brw_delete_vs_state(struct pipe_context *pipe, void *shader)
{
- FREE(shader);
+ struct brw_vertex_program *brw_vp = (struct brw_vertex_program *) shader;
+
+ FREE((void *) brw_vp->program.tokens);
+ FREE(brw_vp);
}