llvmpipe: twoside for specular color also
[mesa.git] / src / gallium / include / state_tracker / swrast_screen_create.h
1 #include "pipe/p_compiler.h"
2 #include "util/u_debug.h"
3 #include "target-helpers/wrap_screen.h"
4
5 struct sw_winsys;
6
7 #ifdef GALLIUM_SOFTPIPE
8 #include "softpipe/sp_public.h"
9 #endif
10
11 #ifdef GALLIUM_LLVMPIPE
12 #include "llvmpipe/lp_public.h"
13 #endif
14
15 #ifdef GALLIUM_CELL
16 #include "cell/ppu/cell_public.h"
17 #endif
18
19 /*
20 * Helper function to choose and instantiate one of the software rasterizers:
21 * cell, llvmpipe, softpipe.
22 *
23 * This function could be shared, but currently causes headaches for
24 * the build systems, particularly scons if we try. Long term, want
25 * to avoid having global #defines for things like GALLIUM_LLVMPIPE,
26 * GALLIUM_CELL, etc. Scons already eliminates those #defines, so
27 * things that are painful for it now are likely to be painful for
28 * other build systems in the future.
29 */
30
31 static INLINE struct pipe_screen *
32 swrast_screen_create(struct sw_winsys *winsys)
33 {
34 const char *default_driver;
35 const char *driver;
36 struct pipe_screen *screen = NULL;
37
38 #if defined(GALLIUM_CELL)
39 default_driver = "cell";
40 #elif defined(GALLIUM_LLVMPIPE)
41 default_driver = "llvmpipe";
42 #elif defined(GALLIUM_SOFTPIPE)
43 default_driver = "softpipe";
44 #else
45 default_driver = "";
46 #endif
47
48 driver = debug_get_option("GALLIUM_DRIVER", default_driver);
49
50 #if defined(GALLIUM_CELL)
51 if (screen == NULL && strcmp(driver, "cell") == 0)
52 screen = cell_create_screen( winsys );
53 #endif
54
55 #if defined(GALLIUM_LLVMPIPE)
56 if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
57 screen = llvmpipe_create_screen( winsys );
58 #endif
59
60 #if defined(GALLIUM_SOFTPIPE)
61 if (screen == NULL)
62 screen = softpipe_create_screen( winsys );
63 #endif
64
65 return gallium_wrap_screen( screen );
66 }
67