1 #include "pipe/p_compiler.h"
2 #include "util/u_debug.h"
3 #include "target-helpers/wrap_screen.h"
7 #ifdef GALLIUM_SOFTPIPE
8 #include "softpipe/sp_public.h"
11 #ifdef GALLIUM_LLVMPIPE
12 #include "llvmpipe/lp_public.h"
16 #include "cell/ppu/cell_public.h"
20 * Helper function to choose and instantiate one of the software rasterizers:
21 * cell, llvmpipe, softpipe.
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.
31 static INLINE
struct pipe_screen
*
32 swrast_screen_create(struct sw_winsys
*winsys
)
34 const char *default_driver
;
36 struct pipe_screen
*screen
= NULL
;
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";
48 driver
= debug_get_option("GALLIUM_DRIVER", default_driver
);
50 #if defined(GALLIUM_CELL)
51 if (screen
== NULL
&& strcmp(driver
, "cell") == 0)
52 screen
= cell_create_screen( winsys
);
55 #if defined(GALLIUM_LLVMPIPE)
56 if (screen
== NULL
&& strcmp(driver
, "llvmpipe") == 0)
57 screen
= llvmpipe_create_screen( winsys
);
60 #if defined(GALLIUM_SOFTPIPE)
62 screen
= softpipe_create_screen( winsys
);
65 return gallium_wrap_screen( screen
);