Merge branch '7.8'
[mesa.git] / src / gallium / state_trackers / python / st_softpipe_winsys.c
index 985374190c3dd4efc6cb25a90e2ef96ccb70f5c0..8584bad467916070374d6597e2032558f36b6ae1 100644 (file)
 #include "softpipe/sp_public.h"
 #include "llvmpipe/lp_public.h"
 #include "state_tracker/sw_winsys.h"
-#include "null/null_sw_winsys.h"
+#include "sw/null/null_sw_winsys.h"
 #include "st_winsys.h"
 
 
 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);
@@ -68,5 +70,9 @@ st_software_screen_create(void)
    }
 #endif
 
+   if (!screen) {
+      ws->destroy(ws);
+   }
+
    return screen;
 }