r600g: fix invalid ref count handling in r600_set_constant_buffer
[mesa.git] / src / gallium / drivers / nv50 / nv50_context.c
index aa14e17872df2ff1b4df07b3ace7a3d7bf2ef059..4f9761617603bd1e9480fcd8378b0cf325b86454 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "nv50_context.h"
 #include "nv50_screen.h"
+#include "nv50_resource.h"
 
 static void
 nv50_flush(struct pipe_context *pipe, unsigned flags,
@@ -48,6 +49,10 @@ nv50_destroy(struct pipe_context *pipe)
        struct nv50_context *nv50 = nv50_context(pipe);
        int i;
 
+        for (i = 0; i < nv50->vtxbuf_nr; i++) {
+           pipe_resource_reference(&nv50->vtxbuf[i].buffer, NULL);
+        }
+
        for (i = 0; i < 64; i++) {
                if (!nv50->state.hw[i])
                        continue;
@@ -81,25 +86,19 @@ nv50_create(struct pipe_screen *pscreen, void *priv)
 
        nv50->pipe.destroy = nv50_destroy;
 
-       nv50->pipe.draw_arrays = nv50_draw_arrays;
-       nv50->pipe.draw_arrays_instanced = nv50_draw_arrays_instanced;
-       nv50->pipe.draw_elements = nv50_draw_elements;
-       nv50->pipe.draw_elements_instanced = nv50_draw_elements_instanced;
+       nv50->pipe.draw_vbo = nv50_draw_vbo;
        nv50->pipe.clear = nv50_clear;
 
        nv50->pipe.flush = nv50_flush;
 
-       nv50->pipe.is_texture_referenced = nouveau_is_texture_referenced;
-       nv50->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
-
        screen->base.channel->user_private = nv50;
 
        nv50_init_surface_functions(nv50);
        nv50_init_state_functions(nv50);
        nv50_init_query_functions(nv50);
-        nv50_init_transfer_functions(nv50);
+       nv50_init_resource_functions(&nv50->pipe);
 
-       nv50->draw = draw_create();
+       nv50->draw = draw_create(&nv50->pipe);
        assert(nv50->draw);
        draw_set_rasterize_stage(nv50->draw, nv50_draw_render_stage(nv50));