nvfx: properly unreference bound objects on context destruction
authorLuca Barbieri <luca@luca-barbieri.com>
Mon, 9 Aug 2010 03:05:12 +0000 (05:05 +0200)
committerLuca Barbieri <luca@luca-barbieri.com>
Sat, 21 Aug 2010 18:42:13 +0000 (20:42 +0200)
src/gallium/drivers/nvfx/nvfx_context.c

index 7218abff22ddf8f1da5381899bba5e03db3dde75..3d45f5f0baf8cddc3c6dedda19a98ff1707e6945 100644 (file)
@@ -1,5 +1,6 @@
 #include "draw/draw_context.h"
 #include "pipe/p_defines.h"
+#include "util/u_framebuffer.h"
 
 #include "nvfx_context.h"
 #include "nvfx_screen.h"
@@ -31,6 +32,13 @@ nvfx_destroy(struct pipe_context *pipe)
 {
        struct nvfx_context *nvfx = nvfx_context(pipe);
 
+       for(unsigned i = 0; i < nvfx->vtxbuf_nr; ++i)
+               pipe_resource_reference(&nvfx->vtxbuf[i].buffer, 0);
+       pipe_resource_reference(&nvfx->idxbuf.buffer, 0);
+       util_unreference_framebuffer_state(&nvfx->framebuffer);
+       for(unsigned i = 0; i < PIPE_MAX_SAMPLERS; ++i)
+               pipe_sampler_view_reference(&nvfx->fragment_sampler_views[i], 0);
+
        if (nvfx->draw)
                draw_destroy(nvfx->draw);
        FREE(nvfx);