diff options
author | Keith Whitwell <[email protected]> | 2009-12-17 11:29:37 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2009-12-17 11:29:37 +0000 |
commit | 7f2ba80025e4b534db72427a206e6a542fc2f520 (patch) | |
tree | 18384be5093551559be2b0eca5299ac235f6aa28 /src/gallium/drivers/llvmpipe | |
parent | ab9438193083b7f9a3180cb9cea45e269131048a (diff) |
llvmpipe: keep copy of framebuffer state in setup context
Avoids crashes when first frame is rendered before window is mapped.
Avoids potential issue where fb state is changed before setup context is
flushed.
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup.c | 24 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_context.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_surface.c | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 76e09552377..e361e5df63a 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -36,6 +36,7 @@ #include "pipe/p_inlines.h" #include "util/u_memory.h" #include "util/u_pack_color.h" +#include "util/u_surface.h" #include "lp_scene.h" #include "lp_scene_queue.h" #include "lp_debug.h" @@ -61,10 +62,9 @@ lp_setup_get_current_scene(struct setup_context *setup) setup->scene = lp_scene_dequeue(setup->empty_scenes); if(0)lp_scene_reset( setup->scene ); /* XXX temporary? */ - if (setup->fb) { - lp_scene_set_framebuffer_size(setup->scene, - setup->fb->width, setup->fb->height); - } + lp_scene_set_framebuffer_size(setup->scene, + setup->fb.width, + setup->fb.height); } return setup->scene; } @@ -134,9 +134,9 @@ lp_setup_rasterize_scene( struct setup_context *setup, struct lp_scene *scene = lp_setup_get_current_scene(setup); lp_rasterize_scene(setup->rast, - scene, - setup->fb, - write_depth); + scene, + &setup->fb, + write_depth); reset_context( setup ); @@ -152,7 +152,7 @@ begin_binning( struct setup_context *setup ) LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__); - if (setup->fb->cbufs[0]) { + if (setup->fb.cbufs[0]) { if (setup->clear.flags & PIPE_CLEAR_COLOR) lp_scene_bin_everywhere( scene, lp_rast_clear_color, @@ -163,7 +163,7 @@ begin_binning( struct setup_context *setup ) lp_rast_arg_null() ); } - if (setup->fb->zsbuf) { + if (setup->fb.zsbuf) { if (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) lp_scene_bin_everywhere( scene, lp_rast_clear_zstencil, @@ -248,9 +248,9 @@ lp_setup_bind_framebuffer( struct setup_context *setup, set_state( setup, SETUP_FLUSHED ); - setup->fb = fb; + util_copy_framebuffer_state(&setup->fb, fb); - lp_scene_set_framebuffer_size(scene, setup->fb->width, setup->fb->height); + lp_scene_set_framebuffer_size(scene, setup->fb.width, setup->fb.height); } @@ -274,7 +274,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_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index 180d9eca84b..f6604a8034a 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -65,7 +65,7 @@ struct setup_context { boolean ccw_is_frontface; unsigned cullmode; - const struct pipe_framebuffer_state *fb; + 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 21565436eb6..957e947fe02 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_state_surface.c @@ -68,7 +68,7 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe, draw_set_mrd(lp->draw, mrd); } - lp_setup_bind_framebuffer( lp->setup, fb ); + lp_setup_bind_framebuffer( lp->setup, &lp->framebuffer ); lp->dirty |= LP_NEW_FRAMEBUFFER; } |