diff options
author | Keith Whitwell <[email protected]> | 2008-05-12 14:10:03 +0100 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2008-05-12 17:40:55 +0100 |
commit | de818835de70961602bb9ceca86b98e9bbc63fc1 (patch) | |
tree | 8b6bc9be3b67005ea065e94604ef35faf2900a97 /src/gallium/drivers/softpipe/sp_context.c | |
parent | 2258f6b437705860912be300e728efbde60e2140 (diff) |
softpipe: add failure paths for context creation
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_context.c')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_context.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index fe9cd8375e3..a48e5461391 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -88,7 +88,8 @@ static void softpipe_destroy( struct pipe_context *pipe ) struct pipe_winsys *ws = pipe->winsys; uint i; - draw_destroy( softpipe->draw ); + if (softpipe->draw) + draw_destroy( softpipe->draw ); softpipe->quad.polygon_stipple->destroy( softpipe->quad.polygon_stipple ); softpipe->quad.earlyz->destroy( softpipe->quad.earlyz ); @@ -216,8 +217,12 @@ softpipe_create( struct pipe_screen *screen, * Create drawing context and plug our rendering stage into it. */ softpipe->draw = draw_create(); - assert(softpipe->draw); + if (!softpipe->draw) + goto fail; + softpipe->setup = sp_draw_render_stage(softpipe); + if (!softpipe->setup) + goto fail; if (GETENV( "SP_NO_RAST" ) != NULL) softpipe->no_rast = TRUE; @@ -241,4 +246,8 @@ softpipe_create( struct pipe_screen *screen, sp_init_surface_functions(softpipe); return &softpipe->pipe; + + fail: + softpipe_destroy(&softpipe->pipe); + return NULL; } |