• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 #ifndef INLINE_SW_HELPER_H
3 #define INLINE_SW_HELPER_H
4 
5 #include "pipe/p_compiler.h"
6 #include "util/u_debug.h"
7 #include "state_tracker/sw_winsys.h"
8 
9 #ifdef GALLIUM_SWR
10 #include "swr/swr_public.h"
11 #endif
12 
13 /* Helper function to choose and instantiate one of the software rasterizers:
14  * llvmpipe, softpipe.
15  */
16 
17 #ifdef GALLIUM_SOFTPIPE
18 #include "softpipe/sp_public.h"
19 #endif
20 
21 #ifdef GALLIUM_LLVMPIPE
22 #include "llvmpipe/lp_public.h"
23 #endif
24 
25 #ifdef GALLIUM_VIRGL
26 #include "virgl/virgl_public.h"
27 #include "virgl/vtest/virgl_vtest_public.h"
28 #endif
29 
30 static inline struct pipe_screen *
sw_screen_create_named(struct sw_winsys * winsys,const char * driver)31 sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
32 {
33    struct pipe_screen *screen = NULL;
34 
35 #if defined(GALLIUM_LLVMPIPE)
36    if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
37       screen = llvmpipe_create_screen(winsys);
38 #endif
39 
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);
45    }
46 #endif
47 
48 #if defined(GALLIUM_SOFTPIPE)
49    if (screen == NULL && strcmp(driver, "softpipe") == 0)
50       screen = softpipe_create_screen(winsys);
51 #endif
52 
53 #if defined(GALLIUM_SWR)
54    if (screen == NULL && strcmp(driver, "swr") == 0)
55       screen = swr_create_screen(winsys);
56 #endif
57 
58    return screen;
59 }
60 
61 
62 static inline struct pipe_screen *
sw_screen_create(struct sw_winsys * winsys)63 sw_screen_create(struct sw_winsys *winsys)
64 {
65    const char *default_driver;
66    const char *driver;
67 
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";
74 #else
75    default_driver = "";
76 #endif
77 
78    driver = debug_get_option("GALLIUM_DRIVER", default_driver);
79    return sw_screen_create_named(winsys, driver);
80 }
81 
82 #endif
83