2 #ifndef INLINE_SW_HELPER_H
3 #define INLINE_SW_HELPER_H
5 #include "pipe/p_compiler.h"
6 #include "util/u_debug.h"
7 #include "state_tracker/sw_winsys.h"
10 /* Helper function to choose and instantiate one of the software rasterizers:
14 #ifdef GALLIUM_SOFTPIPE
15 #include "softpipe/sp_public.h"
18 #ifdef GALLIUM_LLVMPIPE
19 #include "llvmpipe/lp_public.h"
23 static INLINE
struct pipe_screen
*
24 sw_screen_create_named(struct sw_winsys
*winsys
, const char *driver
)
26 struct pipe_screen
*screen
= NULL
;
28 #if defined(GALLIUM_LLVMPIPE)
29 if (screen
== NULL
&& strcmp(driver
, "llvmpipe") == 0)
30 screen
= llvmpipe_create_screen(winsys
);
33 #if defined(GALLIUM_SOFTPIPE)
35 screen
= softpipe_create_screen(winsys
);
42 static INLINE
struct pipe_screen
*
43 sw_screen_create(struct sw_winsys
*winsys
)
45 const char *default_driver
;
48 #if defined(GALLIUM_LLVMPIPE)
49 default_driver
= "llvmpipe";
50 #elif defined(GALLIUM_SOFTPIPE)
51 default_driver
= "softpipe";
56 driver
= debug_get_option("GALLIUM_DRIVER", default_driver
);
57 return sw_screen_create_named(winsys
, driver
);
60 #if defined(GALLIUM_SOFTPIPE)
61 #if defined(DRI_TARGET)
62 #include "target-helpers/inline_debug_helper.h"
63 #include "sw/dri/dri_sw_winsys.h"
64 #include "dri_screen.h"
66 const __DRIextension
**__driDriverGetExtensions_swrast(void);
68 PUBLIC
const __DRIextension
**__driDriverGetExtensions_swrast(void)
70 globalDriverAPI
= &galliumsw_driver_api
;
71 return galliumsw_driver_extensions
;
74 INLINE
struct pipe_screen
*
75 drisw_create_screen(struct drisw_loader_funcs
*lf
)
77 struct sw_winsys
*winsys
= NULL
;
78 struct pipe_screen
*screen
= NULL
;
80 winsys
= dri_create_sw_winsys(lf
);
84 screen
= sw_screen_create(winsys
);
86 winsys
->destroy(winsys
);
90 screen
= debug_screen_wrap(screen
);
94 #endif // GALLIUM_SOFTPIPE