From 9fca3e065b9ab5ef1389a76934bc24ed2b287a76 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 4 Dec 2009 14:22:08 -0700 Subject: [PATCH] llvmpipe: simplify framebuffer state code --- src/gallium/drivers/llvmpipe/lp_setup.c | 29 +++++++++++-------- src/gallium/drivers/llvmpipe/lp_setup.h | 5 ++-- .../drivers/llvmpipe/lp_setup_context.h | 7 +---- .../drivers/llvmpipe/lp_state_surface.c | 4 +-- 4 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 7f31df6ae50..38609ec88a2 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -241,12 +241,12 @@ rasterize_bins( struct setup_context *setup, LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); lp_rast_begin( rast, - setup->fb.cbuf, - setup->fb.zsbuf, - setup->fb.cbuf != NULL, - setup->fb.zsbuf != NULL && write_depth, - setup->fb.width, - setup->fb.height ); + setup->fb->cbufs[0], + setup->fb->zsbuf, + setup->fb->cbufs[0] != NULL, + setup->fb->zsbuf != NULL && write_depth, + setup->fb->width, + setup->fb->height ); /* loop over tile bins, rasterize each */ for (i = 0; i < setup->tiles_x; i++) { @@ -271,7 +271,7 @@ begin_binning( struct setup_context *setup ) { LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); - if (setup->fb.cbuf) { + if (setup->fb->cbufs[0]) { if (setup->clear.flags & PIPE_CLEAR_COLOR) bin_everywhere( setup, lp_rast_clear_color, @@ -280,7 +280,7 @@ begin_binning( struct setup_context *setup ) bin_everywhere( setup, lp_rast_load_color, lp_rast_arg_null() ); } - if (setup->fb.zsbuf) { + if (setup->fb->zsbuf) { if (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) bin_everywhere( setup, lp_rast_clear_zstencil, @@ -355,13 +355,13 @@ lp_setup_flush( struct setup_context *setup, void lp_setup_bind_framebuffer( struct setup_context *setup, - struct pipe_surface *color, - struct pipe_surface *zstencil ) + const struct pipe_framebuffer_state *fb ) { LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); set_state( setup, SETUP_FLUSHED ); +#if 0 pipe_surface_reference( &setup->fb.cbuf, color ); pipe_surface_reference( &setup->fb.zsbuf, zstencil ); @@ -386,9 +386,14 @@ lp_setup_bind_framebuffer( struct setup_context *setup, setup->fb.height = MIN2(setup->fb.cbuf->height, setup->fb.zsbuf->height); } - setup->tiles_x = align(setup->fb.width, TILE_SIZE) / TILE_SIZE; setup->tiles_y = align(setup->fb.height, TILE_SIZE) / TILE_SIZE; +#else + setup->fb = fb; + setup->tiles_x = align(setup->fb->width, TILE_SIZE) / TILE_SIZE; + setup->tiles_y = align(setup->fb->height, TILE_SIZE) / TILE_SIZE; +#endif + } @@ -411,7 +416,7 @@ lp_setup_clear( struct setup_context *setup, if (flags & PIPE_CLEAR_DEPTHSTENCIL) { setup->clear.zstencil.clear_zstencil = - util_pack_z_stencil(setup->fb.zsbuf->format, + util_pack_z_stencil(setup->fb->zsbuf->format, depth, stencil); } diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h index 1edd7410fc0..66a7f29f1e7 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.h +++ b/src/gallium/drivers/llvmpipe/lp_setup.h @@ -53,7 +53,7 @@ struct pipe_surface; struct pipe_buffer; struct pipe_blend_color; struct pipe_screen; -struct setup_context; +struct pipe_framebuffer_state; struct lp_fragment_shader; struct lp_jit_context; @@ -90,8 +90,7 @@ lp_setup_flush( struct setup_context *setup, void lp_setup_bind_framebuffer( struct setup_context *setup, - struct pipe_surface *color, - struct pipe_surface *zstencil ); + const struct pipe_framebuffer_state *fb ); void lp_setup_set_triangle_state( struct setup_context *setup, diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index 180b8f6e880..dc12eb78471 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -79,12 +79,7 @@ struct setup_context { boolean ccw_is_frontface; unsigned cullmode; - struct { - struct pipe_surface *cbuf; - struct pipe_surface *zsbuf; - unsigned width; - unsigned height; - } fb; + const struct pipe_framebuffer_state *fb; struct { unsigned flags; diff --git a/src/gallium/drivers/llvmpipe/lp_state_surface.c b/src/gallium/drivers/llvmpipe/lp_state_surface.c index 909ca9f1170..3eff40e3f19 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_state_surface.c @@ -83,9 +83,7 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe, } if (dirty) { - lp_setup_bind_framebuffer( lp->setup, - fb->cbufs[0], - fb->zsbuf ); + lp_setup_bind_framebuffer( lp->setup, fb ); lp->dirty |= LP_NEW_FRAMEBUFFER; } -- 2.30.2