From dccbfd8bf0624250a435948029916073d3390191 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 27 Mar 2008 15:42:09 -0600 Subject: gallium: return pipe_shader_state from the simple shader functions Allows us to fix a mem leak (tokens array). --- src/gallium/auxiliary/util/u_blit.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/gallium/auxiliary/util/u_blit.c') diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 9986dc3570..eec5e600c9 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -58,6 +58,8 @@ struct blit_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; @@ -129,11 +131,12 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso) 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, @@ -168,6 +171,9 @@ util_destroy_blit(struct blit_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); -- cgit v1.2.3