5 #include "pipe/p_compiler.h"
6 #include "util/u_debug.h"
7 #include "target-helpers/sw_helper_public.h"
8 #include "frontend/sw_winsys.h"
11 /* Helper function to choose and instantiate one of the software rasterizers:
12 * llvmpipe, softpipe, swr.
16 #include "zink/zink_public.h"
19 #ifdef GALLIUM_SOFTPIPE
20 #include "softpipe/sp_public.h"
23 #ifdef GALLIUM_LLVMPIPE
24 #include "llvmpipe/lp_public.h"
28 #include "swr/swr_public.h"
32 #include "virgl/virgl_public.h"
33 #include "virgl/vtest/virgl_vtest_public.h"
36 static inline struct pipe_screen
*
37 sw_screen_create_named(struct sw_winsys
*winsys
, const char *driver
)
39 struct pipe_screen
*screen
= NULL
;
41 #if defined(GALLIUM_LLVMPIPE)
42 if (screen
== NULL
&& strcmp(driver
, "llvmpipe") == 0)
43 screen
= llvmpipe_create_screen(winsys
);
46 #if defined(GALLIUM_VIRGL)
47 if (screen
== NULL
&& strcmp(driver
, "virpipe") == 0) {
48 struct virgl_winsys
*vws
;
49 vws
= virgl_vtest_winsys_wrap(winsys
);
50 screen
= virgl_create_screen(vws
, NULL
);
54 #if defined(GALLIUM_SOFTPIPE)
55 if (screen
== NULL
&& strcmp(driver
, "softpipe") == 0)
56 screen
= softpipe_create_screen(winsys
);
59 #if defined(GALLIUM_SWR)
60 if (screen
== NULL
&& strcmp(driver
, "swr") == 0)
61 screen
= swr_create_screen(winsys
);
64 #if defined(GALLIUM_ZINK)
65 if (screen
== NULL
&& strcmp(driver
, "zink") == 0)
66 screen
= zink_create_screen(winsys
);
74 sw_screen_create(struct sw_winsys
*winsys
)
76 const char *default_driver
;
79 #if defined(GALLIUM_LLVMPIPE)
80 default_driver
= "llvmpipe";
81 #elif defined(GALLIUM_SOFTPIPE)
82 default_driver
= "softpipe";
83 #elif defined(GALLIUM_SWR)
84 default_driver
= "swr";
85 #elif defined(GALLIUM_ZINK)
86 default_driver
= "zink";
91 driver
= debug_get_option("GALLIUM_DRIVER", default_driver
);
92 return sw_screen_create_named(winsys
, driver
);