r600g: clean up valgrind issues on maxtargets test.
authorDave Airlie <airlied@redhat.com>
Mon, 20 Sep 2010 00:44:44 +0000 (10:44 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 20 Sep 2010 00:44:44 +0000 (10:44 +1000)
src/gallium/drivers/r600/r600_state.c

index e347943873c368abc5ddee9b7aa34a8e293a2973..2b97c2a94e32e3888022d6edb5d5ed50867b5b60 100644 (file)
@@ -382,10 +382,16 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
        struct r600_context_state *rstate;
        int i;
 
-       r600_context_state_decref(rctx->framebuffer);
+       if (rctx->framebuffer) {
+               for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++)
+                       radeon_draw_unbind(&rctx->draw, &rctx->framebuffer->rstate[i+1]);
+               radeon_draw_unbind(&rctx->draw, &rctx->framebuffer->rstate[0]);
+       }
        clean_flush(rctx, &rctx->hw_states.cb_flush);
        clean_flush(rctx, &rctx->hw_states.db_flush);
 
+       r600_context_state_decref(rctx->framebuffer);
+
        rstate = r600_new_context_state(pipe_framebuffer_type);
        rstate->state.framebuffer = *state;
        for (i = 0; i < rstate->state.framebuffer.nr_cbufs; i++) {