diff options
author | Jakob Bornecrantz <[email protected]> | 2010-10-15 15:57:55 +0100 |
---|---|---|
committer | Jakob Bornecrantz <[email protected]> | 2010-10-15 19:13:00 +0100 |
commit | 44207ff71b3d53b30cf6c3e52c84ddc5cd44b424 (patch) | |
tree | 82e914af9613b3d38b3d827bdacf1a6dbbf88e0e | |
parent | f8f3baa43a3954b7078e5e24b41ae123f398bff8 (diff) |
wrapper: Add a way to dewrap a pipe screen without destroying it
-rw-r--r-- | src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h | 4 | ||||
-rw-r--r-- | src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c | 13 | ||||
-rw-r--r-- | src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h | 9 |
3 files changed, 24 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h index f686da6ac81..f27e34a3002 100644 --- a/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h +++ b/src/gallium/auxiliary/target-helpers/inline_wrapper_sw_helper.h @@ -26,9 +26,9 @@ sw_screen_wrap(struct pipe_screen *screen) return sw_screen; err_winsys: - sws->destroy(sws); + return wrapper_sw_winsys_dewrap_pipe_screen(sws); err: - return screen; + return screen; } #endif diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c index 38cf29e6056..bc2623e7b77 100644 --- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c +++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c @@ -304,3 +304,16 @@ err_free: err: return NULL; } + +struct pipe_screen * +wrapper_sw_winsys_dewrap_pipe_screen(struct sw_winsys *ws) +{ + struct wrapper_sw_winsys *wsw = wrapper_sw_winsys(ws); + struct pipe_screen *screen = wsw->screen; + + wsw->pipe->destroy(wsw->pipe); + /* don't destroy the screen its needed later on */ + + FREE(wsw); + return screen; +} diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h index 8a7086f19f5..ae0196c432c 100644 --- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h +++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h @@ -30,6 +30,15 @@ struct sw_winsys; struct pipe_screen; +/* + * Wrap a pipe screen. + */ struct sw_winsys *wrapper_sw_winsys_wrap_pipe_screen(struct pipe_screen *screen); +/* + * Destroy the sw_winsys and return the wrapped pipe_screen. + * Not destroying it as sw_winsys::destroy does. + */ +struct pipe_screen *wrapper_sw_winsys_dewrap_pipe_screen(struct sw_winsys *sw_winsys); + #endif |