Merge branch '7.8'
[mesa.git] / src / gallium / drivers / sw / sw.c
1 #include "pipe/p_compiler.h"
2 #include "util/u_debug.h"
3 #include "target-helpers/wrap_screen.h"
4 #include "sw_public.h"
5 #include "state_tracker/sw_winsys.h"
6
7
8 /* Helper function to choose and instantiate one of the software rasterizers:
9 * cell, llvmpipe, softpipe.
10 */
11
12 #ifdef GALLIUM_SOFTPIPE
13 #include "softpipe/sp_public.h"
14 #endif
15
16 #ifdef GALLIUM_LLVMPIPE
17 #include "llvmpipe/lp_public.h"
18 #endif
19
20 #ifdef GALLIUM_CELL
21 #include "cell/ppu/cell_public.h"
22 #endif
23
24 struct pipe_screen *
25 swrast_create_screen(struct sw_winsys *winsys)
26 {
27 const char *default_driver;
28 const char *driver;
29 struct pipe_screen *screen = NULL;
30
31 #if defined(GALLIUM_CELL)
32 default_driver = "cell";
33 #elif defined(GALLIUM_LLVMPIPE)
34 default_driver = "llvmpipe";
35 #elif defined(GALLIUM_SOFTPIPE)
36 default_driver = "softpipe";
37 #else
38 default_driver = "";
39 #endif
40
41 driver = debug_get_option("GALLIUM_DRIVER", default_driver);
42
43 #if defined(GALLIUM_CELL)
44 if (screen == NULL && strcmp(driver, "cell") == 0)
45 screen = cell_create_screen( winsys );
46 #endif
47
48 #if defined(GALLIUM_LLVMPIPE)
49 if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
50 screen = llvmpipe_create_screen( winsys );
51 #endif
52
53 #if defined(GALLIUM_SOFTPIPE)
54 if (screen == NULL)
55 screen = softpipe_create_screen( winsys );
56 #endif
57
58 return screen;
59 }