summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_gen_mipmap.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-03-27 15:42:09 -0600
committerBrian <brian.paul@tungstengraphics.com>2008-03-27 15:43:32 -0600
commitdccbfd8bf0624250a435948029916073d3390191 (patch)
treea5a5854dd3cb58d92d9b459ad6eb198bbb31df94 /src/gallium/auxiliary/util/u_gen_mipmap.c
parent89222ee49de340774279c9c0bf884649e66ad6df (diff)
gallium: return pipe_shader_state from the simple shader functions
Allows us to fix a mem leak (tokens array).
Diffstat (limited to 'src/gallium/auxiliary/util/u_gen_mipmap.c')
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index 5549652abb..2fd214d22e 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -62,6 +62,8 @@ struct gen_mipmap_state
struct pipe_rasterizer_state rasterizer;
struct pipe_sampler_state sampler;
+ struct pipe_shader_state vert_shader;
+ struct pipe_shader_state frag_shader;
void *vs;
void *fs;
@@ -740,11 +742,12 @@ util_create_gen_mipmap(struct pipe_context *pipe,
TGSI_SEMANTIC_GENERIC };
const uint semantic_indexes[] = { 0, 0 };
ctx->vs = util_make_vertex_passthrough_shader(pipe, 2, semantic_names,
- semantic_indexes);
+ semantic_indexes,
+ &ctx->vert_shader);
}
/* fragment shader */
- ctx->fs = util_make_fragment_tex_shader(pipe);
+ ctx->fs = util_make_fragment_tex_shader(pipe, &ctx->frag_shader);
ctx->vbuf = pipe->winsys->buffer_create(pipe->winsys,
32,
@@ -813,6 +816,9 @@ util_destroy_gen_mipmap(struct gen_mipmap_state *ctx)
pipe->delete_vs_state(pipe, ctx->vs);
pipe->delete_fs_state(pipe, ctx->fs);
+ FREE((void*) ctx->vert_shader.tokens);
+ FREE((void*) ctx->frag_shader.tokens);
+
pipe->winsys->buffer_destroy(pipe->winsys, ctx->vbuf);
FREE(ctx);