if (hardware)
screen = st_hardware_screen_create();
else
- screen = st_software_screen_create();
+ screen = st_software_screen_create("softpipe");
screen = trace_screen_create(screen);
if (!screen)
struct pipe_screen *
-st_software_screen_create(void)
+st_software_screen_create(const char *driver)
{
struct sw_winsys *ws;
- const char *default_driver;
- const char *driver;
struct pipe_screen *screen = NULL;
+ if (!driver) {
+ const char *default_driver;
+
#if defined(HAVE_LLVMPIPE)
- default_driver = "llvmpipe";
+ default_driver = "llvmpipe";
#elif defined(HAVE_SOFTPIPE)
- default_driver = "softpipe";
+ default_driver = "softpipe";
#else
- default_driver = "";
+ default_driver = "";
#endif
+ driver = debug_get_option("GALLIUM_DRIVER", default_driver);
+ }
+
ws = null_sw_create();
if(!ws)
return NULL;
- driver = debug_get_option("GALLIUM_DRIVER", default_driver);
-
#ifdef HAVE_LLVMPIPE
if (strcmp(driver, "llvmpipe") == 0) {
screen = llvmpipe_create_screen(ws);
}
#endif
+ if (!screen) {
+ ws->destroy(ws);
+ }
+
return screen;
}