2 #ifndef INLINE_SW_HELPER_H
3 #define INLINE_SW_HELPER_H
5 #include "pipe/p_compiler.h"
6 #include "util/u_debug.h"
7 #include "state_tracker/sw_winsys.h"
10 #include "swr/swr_public.h"
13 /* Helper function to choose and instantiate one of the software rasterizers:
17 #ifdef GALLIUM_SOFTPIPE
18 #include "softpipe/sp_public.h"
21 #ifdef GALLIUM_LLVMPIPE
22 #include "llvmpipe/lp_public.h"
26 #include "virgl/virgl_public.h"
27 #include "virgl/vtest/virgl_vtest_public.h"
30 static inline struct pipe_screen
*
31 sw_screen_create_named(struct sw_winsys
*winsys
, const char *driver
)
33 struct pipe_screen
*screen
= NULL
;
35 #if defined(GALLIUM_LLVMPIPE)
36 if (screen
== NULL
&& strcmp(driver
, "llvmpipe") == 0)
37 screen
= llvmpipe_create_screen(winsys
);
40 #if defined(GALLIUM_VIRGL)
41 if (screen
== NULL
&& strcmp(driver
, "virpipe") == 0) {
42 struct virgl_winsys
*vws
;
43 vws
= virgl_vtest_winsys_wrap(winsys
);
44 screen
= virgl_create_screen(vws
, NULL
);
48 #if defined(GALLIUM_SOFTPIPE)
49 if (screen
== NULL
&& strcmp(driver
, "softpipe") == 0)
50 screen
= softpipe_create_screen(winsys
);
53 #if defined(GALLIUM_SWR)
54 if (screen
== NULL
&& strcmp(driver
, "swr") == 0)
55 screen
= swr_create_screen(winsys
);
62 static inline struct pipe_screen
*
63 sw_screen_create(struct sw_winsys
*winsys
)
65 const char *default_driver
;
68 #if defined(GALLIUM_LLVMPIPE)
69 default_driver
= "llvmpipe";
70 #elif defined(GALLIUM_SOFTPIPE)
71 default_driver
= "softpipe";
72 #elif defined(GALLIUM_SWR)
73 default_driver
= "swr";
78 driver
= debug_get_option("GALLIUM_DRIVER", default_driver
);
79 return sw_screen_create_named(winsys
, driver
);