Squashed commit of the following:
[mesa.git] / src / gallium / drivers / i965 / brw_context.c
index f85116a568c1549a4a22ddf06b852a172f4ecb3b..227bc790debbc6166c35ac175161e7d5611464a8 100644 (file)
 
 
 #include "pipe/p_context.h"
+#include "util/u_inlines.h"
 #include "util/u_simple_list.h"
 
 #include "brw_context.h"
-#include "brw_defines.h"
 #include "brw_draw.h"
 #include "brw_state.h"
 #include "brw_batchbuffer.h"
 #include "brw_winsys.h"
+#include "brw_resource.h"
 #include "brw_screen.h"
 
 
@@ -65,6 +66,9 @@ static void brw_destroy_context( struct pipe_context *pipe )
    brw_pipe_vertex_cleanup( brw );
    brw_pipe_clear_cleanup( brw );
 
+   brw_hw_cc_cleanup( brw );
+
+
    FREE(brw->wm.compile_data);
 
    for (i = 0; i < brw->curr.fb.nr_cbufs; i++)
@@ -96,13 +100,11 @@ static void brw_destroy_context( struct pipe_context *pipe )
    bo_reference(&brw->wm.sampler_bo, NULL);
    bo_reference(&brw->wm.prog_bo, NULL);
    bo_reference(&brw->wm.state_bo, NULL);
-   bo_reference(&brw->cc.prog_bo, NULL);
-   bo_reference(&brw->cc.state_bo, NULL);
-   bo_reference(&brw->cc.vp_bo, NULL);
 }
 
 
-struct pipe_context *brw_create_context(struct pipe_screen *screen)
+struct pipe_context *brw_create_context(struct pipe_screen *screen,
+                                       void *priv)
 {
    struct brw_context *brw = (struct brw_context *) CALLOC_STRUCT(brw_context);
 
@@ -112,10 +114,12 @@ struct pipe_context *brw_create_context(struct pipe_screen *screen)
    }
 
    brw->base.screen = screen;
+   brw->base.priv = priv;
    brw->base.destroy = brw_destroy_context;
    brw->sws = brw_screen(screen)->sws;
    brw->chipset = brw_screen(screen)->chipset;
 
+   brw_init_resource_functions( brw );
    brw_pipe_blend_init( brw );
    brw_pipe_depth_stencil_init( brw );
    brw_pipe_framebuffer_init( brw );
@@ -128,6 +132,8 @@ struct pipe_context *brw_create_context(struct pipe_screen *screen)
    brw_pipe_vertex_init( brw );
    brw_pipe_clear_init( brw );
 
+   brw_hw_cc_init( brw );
+
    brw_init_state( brw );
    brw_draw_init( brw );