gallium: Fix texture refcount leak.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Wed, 23 Apr 2008 17:13:31 +0000 (02:13 +0900)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Wed, 23 Apr 2008 17:13:41 +0000 (02:13 +0900)
src/gallium/auxiliary/cso_cache/cso_context.c

index 0523cb19497d203b081af05655831588b83e1b18..d246dff433d5153e3b7a353a1d11d4c64c687283 100644 (file)
@@ -104,6 +104,8 @@ out:
 
 static void cso_release_all( struct cso_context *ctx )
 {
+   unsigned i;
+   
    if (ctx->pipe) {
       ctx->pipe->bind_blend_state( ctx->pipe, NULL );
       ctx->pipe->bind_rasterizer_state( ctx->pipe, NULL );
@@ -113,6 +115,11 @@ static void cso_release_all( struct cso_context *ctx )
       ctx->pipe->bind_vs_state( ctx->pipe, NULL );
    }
 
+   for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
+      pipe_texture_reference(&ctx->textures[i], NULL);
+   for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
+      pipe_texture_reference(&ctx->textures_saved[i], NULL);
+
    if (ctx->cache) {
       cso_cache_delete( ctx->cache );
       ctx->cache = NULL;