X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=blobdiff_plain;f=src%2Fgallium%2Fstate_trackers%2Fpython%2Fst_softpipe_winsys.c;h=8584bad467916070374d6597e2032558f36b6ae1;hp=dfe3e465f7785ae001e7e97784b53d13c91bf101;hb=1318848f782cce716d6376ca13aebf68b728e24c;hpb=43867acb6afc7fad26cdc2f22b2a3bb6eeefb2da diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c index dfe3e465f77..8584bad4679 100644 --- a/src/gallium/state_trackers/python/st_softpipe_winsys.c +++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c @@ -26,19 +26,53 @@ * **************************************************************************/ -/** - * @file - * Softpipe support. - * - * @author Keith Whitwell - * @author Brian Paul - * @author Jose Fonseca - */ - -#include "softpipe/sp_winsys.h" +#include "util/u_debug.h" +#include "softpipe/sp_public.h" +#include "llvmpipe/lp_public.h" +#include "state_tracker/sw_winsys.h" +#include "sw/null/null_sw_winsys.h" #include "st_winsys.h" -const struct st_winsys st_softpipe_winsys = { - &softpipe_create_screen_malloc, - &softpipe_create, -}; + +struct pipe_screen * +st_software_screen_create(const char *driver) +{ + struct sw_winsys *ws; + struct pipe_screen *screen = NULL; + + if (!driver) { + const char *default_driver; + +#if defined(HAVE_LLVMPIPE) + default_driver = "llvmpipe"; +#elif defined(HAVE_SOFTPIPE) + default_driver = "softpipe"; +#else + default_driver = ""; +#endif + + driver = debug_get_option("GALLIUM_DRIVER", default_driver); + } + + ws = null_sw_create(); + if(!ws) + return NULL; + +#ifdef HAVE_LLVMPIPE + if (strcmp(driver, "llvmpipe") == 0) { + screen = llvmpipe_create_screen(ws); + } +#endif + +#ifdef HAVE_SOFTPIPE + if (strcmp(driver, "softpipe") == 0) { + screen = softpipe_create_screen(ws); + } +#endif + + if (!screen) { + ws->destroy(ws); + } + + return screen; +}