gallium: rename 'state tracker' to 'frontend'
[mesa.git] / src / gallium / auxiliary / target-helpers / sw_helper.h
1
2 #ifndef SW_HELPER_H
3 #define SW_HELPER_H
4
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"
9
10
11 /* Helper function to choose and instantiate one of the software rasterizers:
12 * llvmpipe, softpipe, swr.
13 */
14
15 #ifdef GALLIUM_ZINK
16 #include "zink/zink_public.h"
17 #endif
18
19 #ifdef GALLIUM_SOFTPIPE
20 #include "softpipe/sp_public.h"
21 #endif
22
23 #ifdef GALLIUM_LLVMPIPE
24 #include "llvmpipe/lp_public.h"
25 #endif
26
27 #ifdef GALLIUM_SWR
28 #include "swr/swr_public.h"
29 #endif
30
31 #ifdef GALLIUM_VIRGL
32 #include "virgl/virgl_public.h"
33 #include "virgl/vtest/virgl_vtest_public.h"
34 #endif
35
36 static inline struct pipe_screen *
37 sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
38 {
39 struct pipe_screen *screen = NULL;
40
41 #if defined(GALLIUM_LLVMPIPE)
42 if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
43 screen = llvmpipe_create_screen(winsys);
44 #endif
45
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);
51 }
52 #endif
53
54 #if defined(GALLIUM_SOFTPIPE)
55 if (screen == NULL && strcmp(driver, "softpipe") == 0)
56 screen = softpipe_create_screen(winsys);
57 #endif
58
59 #if defined(GALLIUM_SWR)
60 if (screen == NULL && strcmp(driver, "swr") == 0)
61 screen = swr_create_screen(winsys);
62 #endif
63
64 #if defined(GALLIUM_ZINK)
65 if (screen == NULL && strcmp(driver, "zink") == 0)
66 screen = zink_create_screen(winsys);
67 #endif
68
69 return screen;
70 }
71
72
73 struct pipe_screen *
74 sw_screen_create(struct sw_winsys *winsys)
75 {
76 const char *default_driver;
77 const char *driver;
78
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";
87 #else
88 default_driver = "";
89 #endif
90
91 driver = debug_get_option("GALLIUM_DRIVER", default_driver);
92 return sw_screen_create_named(winsys, driver);
93 }
94
95 #endif