r600g: fix stencil buffer ref counting on evergreen
authorVadim Girlin <vadimgirlin@gmail.com>
Sat, 12 Nov 2011 18:23:34 +0000 (22:23 +0400)
committerAlex Deucher <alexander.deucher@amd.com>
Sun, 13 Nov 2011 22:25:16 +0000 (17:25 -0500)
Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
src/gallium/drivers/r600/r600_texture.c

index 50a96b4d4da9e51d8a0263610b45f8115143690f..8fe1118d19d9bf9526f535543951cb9e16e1880e 100644 (file)
@@ -350,6 +350,9 @@ static void r600_texture_destroy(struct pipe_screen *screen,
        if (rtex->flushed_depth_texture)
                pipe_resource_reference((struct pipe_resource **)&rtex->flushed_depth_texture, NULL);
 
+       if (rtex->stencil)
+               pipe_resource_reference((struct pipe_resource **)&rtex->stencil, NULL);
+
        pb_reference(&resource->buf, NULL);
        FREE(rtex);
 }
@@ -469,7 +472,7 @@ r600_texture_create_object(struct pipe_screen *screen,
        }
 
        if (rtex->stencil) {
-               rtex->stencil->resource.buf = rtex->resource.buf;
+               pb_reference(&rtex->stencil->resource.buf, rtex->resource.buf);
                rtex->stencil->resource.cs_buf = rtex->resource.cs_buf;
        }
        return rtex;