target-helpers: Remove per target software wrapper check
[mesa.git] / src / gallium / auxiliary / target-helpers / inline_sw_helper.h
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
10 /* Helper function to choose and instantiate one of the software rasterizers:
11 * cell, llvmpipe, softpipe.
12 */
13
14 #ifdef GALLIUM_SOFTPIPE
15 #include "softpipe/sp_public.h"
16 #endif
17
18 #ifdef GALLIUM_LLVMPIPE
19 #include "llvmpipe/lp_public.h"
20 #endif
21
22 #ifdef GALLIUM_CELL
23 #include "cell/ppu/cell_public.h"
24 #endif
25
26
27 static INLINE struct pipe_screen *
28 sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
29 {
30 struct pipe_screen *screen = NULL;
31
32 #if defined(GALLIUM_CELL)
33 if (screen == NULL && strcmp(driver, "cell") == 0)
34 screen = cell_create_screen(winsys);
35 #endif
36
37 #if defined(GALLIUM_LLVMPIPE)
38 if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
39 screen = llvmpipe_create_screen(winsys);
40 #endif
41
42 #if defined(GALLIUM_SOFTPIPE)
43 if (screen == NULL)
44 screen = softpipe_create_screen(winsys);
45 #endif
46
47 return screen;
48 }
49
50
51 static INLINE struct pipe_screen *
52 sw_screen_create(struct sw_winsys *winsys)
53 {
54 const char *default_driver;
55 const char *driver;
56
57 #if defined(GALLIUM_CELL)
58 default_driver = "cell";
59 #elif defined(GALLIUM_LLVMPIPE)
60 default_driver = "llvmpipe";
61 #elif defined(GALLIUM_SOFTPIPE)
62 default_driver = "softpipe";
63 #else
64 default_driver = "";
65 #endif
66
67 driver = debug_get_option("GALLIUM_DRIVER", default_driver);
68 return sw_screen_create_named(winsys, driver);
69 }
70
71
72 #endif