r600g: move around variables to share depth uncompression code
authorJerome Glisse <jglisse@redhat.com>
Sun, 26 Sep 2010 20:25:47 +0000 (16:25 -0400)
committerJerome Glisse <jglisse@redhat.com>
Sun, 26 Sep 2010 20:29:33 +0000 (16:29 -0400)
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
src/gallium/drivers/r600/r600_blit.c
src/gallium/drivers/r600/r600_context.h
src/gallium/drivers/r600/r600_state.c

index c30a7c187c9ebd5ce0a4f098c2215fa5a8361c84..52326534e6ebd7cae30c8f0c18c239c383713eb9 100644 (file)
@@ -180,10 +180,8 @@ void r600_init_blit_functions(struct r600_context *rctx)
 int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture)
 {
        struct r600_context *rctx = r600_context(ctx);
-       struct r600_screen *rscreen = rctx->screen;
-       struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
+       struct pipe_framebuffer_state *fb = rctx->pframebuffer;
        struct pipe_surface *zsurf, *cbsurf;
-       enum radeon_family family;
        int level = 0;
        float depth = 1.0f;
 
@@ -196,11 +194,10 @@ int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_te
        r600_blitter_save_states(ctx);
        util_blitter_save_framebuffer(rctx->blitter, fb);
 
-       family = radeon_get_family(rscreen->rw);
-       if (family == CHIP_RV610 || family == CHIP_RV630 || family == CHIP_RV620 ||
-           family == CHIP_RV635)
+       if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 ||
+               rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635)
                depth = 0.0f;
-       
+
        util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth);
 
        /* resume queries */
index aec0dab338c22d08d365c66cce5ea78d9d1ceee0..d104531d365688d2f8e31515a855d2f24d0489ba 100644 (file)
@@ -198,10 +198,14 @@ extern struct r600_context_hw_state_vtbl eg_hw_state_vtbl;
 
 struct r600_context {
        struct pipe_context             context;
+       struct blitter_context          *blitter;
+       struct pipe_framebuffer_state   *pframebuffer;
+       unsigned                        family;
+       void                            *custom_dsa_flush;
+       struct list_head                query_list;
        struct r600_screen              *screen;
        struct radeon                   *rw;
        struct radeon_ctx               *ctx;
-       struct blitter_context          *blitter;
        struct radeon_draw              draw;
        struct r600_context_hw_state_vtbl *vtbl;
        struct radeon_state             config;
@@ -238,14 +242,11 @@ struct r600_context {
        struct pipe_vertex_buffer       vertex_buffer[PIPE_MAX_ATTRIBS];
        struct pipe_index_buffer        index_buffer;
        struct pipe_blend_color         blend_color;
-       struct list_head                query_list;
 
        /* upload managers */
        struct u_upload_mgr *upload_vb;
        struct u_upload_mgr *upload_ib;
        bool any_user_vbs;
-
-       void *custom_dsa_flush;
 };
 
 /* Convenience cast wrapper. */
index 424f7a8913f805ef02c00285254fd15fe4b11deb..791b39a001e475778a2c0eda7964013ec5a8d2b8 100644 (file)
@@ -389,7 +389,7 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
        }
        clean_flush(rctx, &rctx->hw_states.cb_flush);
        clean_flush(rctx, &rctx->hw_states.db_flush);
-
+       rctx->pframebuffer = NULL;
        r600_context_state_decref(rctx->framebuffer);
 
        rstate = r600_new_context_state(pipe_framebuffer_type);
@@ -399,6 +399,7 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
        }
        pipe_reference(NULL, &state->zsbuf->reference);
        rctx->framebuffer = rstate;
+       rctx->pframebuffer = &rstate->state.framebuffer;
        for (i = 0; i < state->nr_cbufs; i++) {
                rctx->vtbl->cb(rctx, &rstate->rstate[i+1], state, i);
        }