5 #include "pipe/p_compiler.h"
6 #include "util/u_debug.h"
7 #include "target-helpers/sw_helper_public.h"
8 #include "state_tracker/sw_winsys.h"
11 /* Helper function to choose and instantiate one of the software rasterizers:
12 * llvmpipe, softpipe, swr.
15 #ifdef GALLIUM_SOFTPIPE
16 #include "softpipe/sp_public.h"
19 #ifdef GALLIUM_LLVMPIPE
20 #include "llvmpipe/lp_public.h"
24 #include "swr/swr_public.h"
28 #include "virgl/virgl_public.h"
29 #include "virgl/vtest/virgl_vtest_public.h"
32 static inline struct pipe_screen
*
33 sw_screen_create_named(struct sw_winsys
*winsys
, const char *driver
)
35 struct pipe_screen
*screen
= NULL
;
37 #if defined(GALLIUM_LLVMPIPE)
38 if (screen
== NULL
&& strcmp(driver
, "llvmpipe") == 0)
39 screen
= llvmpipe_create_screen(winsys
);
42 #if defined(GALLIUM_VIRGL)
43 if (screen
== NULL
&& strcmp(driver
, "virpipe") == 0) {
44 struct virgl_winsys
*vws
;
45 vws
= virgl_vtest_winsys_wrap(winsys
);
46 screen
= virgl_create_screen(vws
, NULL
);
50 #if defined(GALLIUM_SOFTPIPE)
51 if (screen
== NULL
&& strcmp(driver
, "softpipe") == 0)
52 screen
= softpipe_create_screen(winsys
);
55 #if defined(GALLIUM_SWR)
56 if (screen
== NULL
&& strcmp(driver
, "swr") == 0)
57 screen
= swr_create_screen(winsys
);
65 sw_screen_create(struct sw_winsys
*winsys
)
67 const char *default_driver
;
70 #if defined(GALLIUM_LLVMPIPE)
71 default_driver
= "llvmpipe";
72 #elif defined(GALLIUM_SOFTPIPE)
73 default_driver
= "softpipe";
74 #elif defined(GALLIUM_SWR)
75 default_driver
= "swr";
80 driver
= debug_get_option("GALLIUM_DRIVER", default_driver
);
81 return sw_screen_create_named(winsys
, driver
);