r600g: deref old driver states for set entry points.
authorDave Airlie <airlied@redhat.com>
Fri, 3 Sep 2010 02:01:59 +0000 (12:01 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 3 Sep 2010 02:01:59 +0000 (12:01 +1000)
src/gallium/drivers/r600/r600_state.c

index 9d7d7b6c40a52d7c4d8364467b82620104bcd45a..190d1c807d7e2ae92242b9da235a93e1d5ed3137 100644 (file)
@@ -380,6 +380,8 @@ static void r600_set_clip_state(struct pipe_context *ctx,
        struct r600_context *rctx = r600_context(ctx);
        struct r600_context_state *rstate;
 
+       r600_context_state_decref(rctx->clip);
+
        rstate = r600_new_context_state(pipe_clip_type);
        rstate->state.clip = *state;
        r600_ucp(rctx, &rstate->rstate[0], &rstate->state.clip);
@@ -439,6 +441,8 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
        struct r600_context_state *rstate;
        int i;
 
+       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++) {
@@ -472,6 +476,8 @@ static void r600_set_scissor_state(struct pipe_context *ctx,
        struct r600_context *rctx = r600_context(ctx);
        struct r600_context_state *rstate;
 
+       r600_context_state_decref(rctx->scissor);
+
        rstate = r600_new_context_state(pipe_scissor_type);
        rstate->state.scissor = *state;
        rctx->scissor = rstate;
@@ -483,6 +489,8 @@ static void r600_set_stencil_ref(struct pipe_context *ctx,
        struct r600_context *rctx = r600_context(ctx);
        struct r600_context_state *rstate;
 
+       r600_context_state_decref(rctx->stencil_ref);
+
        rstate = r600_new_context_state(pipe_stencil_ref_type);
        rstate->state.stencil_ref = *state;
        rctx->stencil_ref = rstate;
@@ -528,6 +536,8 @@ static void r600_set_viewport_state(struct pipe_context *ctx,
        struct r600_context *rctx = r600_context(ctx);
        struct r600_context_state *rstate;
 
+       r600_context_state_decref(rctx->viewport);
+
        rstate = r600_new_context_state(pipe_viewport_type);
        rstate->state.viewport = *state;
        r600_viewport(rctx, &rstate->rstate[0], &rstate->state.viewport);