mesa: Free the util shaders with the gallium's FREE.
authorJosé Fonseca <jfonseca@vmware.com>
Thu, 19 Feb 2009 13:02:47 +0000 (13:02 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Thu, 19 Feb 2009 13:29:04 +0000 (13:29 +0000)
src/gallium/auxiliary/util/u_simple_shaders.c
src/gallium/auxiliary/util/u_simple_shaders.h
src/mesa/state_tracker/st_atom_shader.c
src/mesa/state_tracker/st_cb_bitmap.c
src/mesa/state_tracker/st_cb_clear.c

index 3cd2d52c64ceb50cab47df852bb6e27355384e37..2fcad6fe3d52c467cd8ac147e4cfc31411f89d87 100644 (file)
@@ -359,3 +359,10 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe,
    return pipe->create_fs_state(pipe, shader);
 }
 
+
+void
+util_free_shader(struct pipe_shader_state *shader)
+{
+   FREE((struct tgsi_token *)shader->tokens);
+   shader->tokens = NULL;
+}
index 8ca4977d71565f80cf587b2129e25a7cab19f1dc..99b8d9067d6c57189ebc677fef9a8435e06b3bc5 100644 (file)
@@ -60,6 +60,10 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe,
                                       struct pipe_shader_state *shader);
 
 
+extern void
+util_free_shader(struct pipe_shader_state *shader);
+
+
 #ifdef __cplusplus
 }
 #endif
index bed3ff4ae5bc11143c41a2259cabf82c3ee91023..486582fce89cdf143f97408a2d473cd6a4ca2ef2 100644 (file)
@@ -313,7 +313,7 @@ get_passthrough_fs(struct st_context *st)
       st->passthrough_fs =
          util_make_fragment_passthrough_shader(st->pipe, &shader);
 #if 0      /* We actually need to keep the tokens around at this time */
-      _mesa_free((void *) shader.tokens);
+      util_free_shader(&shader);
 #endif
    }
 
index 77aac8507e1562db6b7763962043120fb00e1ce9..ef44a08859cf0b086cc1a3cd14cd97ba752a0a80 100644 (file)
@@ -819,6 +819,7 @@ st_destroy_bitmap(struct st_context *st)
       cso_delete_vertex_shader(st->cso_context, st->bitmap.vs);
       st->bitmap.vs = NULL;
    }
+   util_free_shader(&st->bitmap.vert_shader);
 
    if (st->bitmap.vbuf) {
       pipe_buffer_reference(pipe->screen, &st->bitmap.vbuf, NULL);
index 0eddda23a7ae651cdd431144dd5dbda7351970a3..20eaaa4ae73035ee9bc5ac7e42e3e4bb4e2fddb0 100644 (file)
@@ -98,12 +98,12 @@ st_destroy_clear(struct st_context *st)
    struct pipe_context *pipe = st->pipe;
 
    if (st->clear.vert_shader.tokens) {
-      _mesa_free((void *) st->clear.vert_shader.tokens);
+      util_free_shader(&st->clear.vert_shader);
       st->clear.vert_shader.tokens = NULL;
    }
 
    if (st->clear.frag_shader.tokens) {
-      _mesa_free((void *) st->clear.frag_shader.tokens);
+      util_free_shader(&st->clear.frag_shader);
       st->clear.frag_shader.tokens = NULL;
    }