graw_null.c revision f4905256859794d0ccc67e6a56f1ca4831c0d5de
1#include "pipe/p_compiler.h"
2#include "util/u_debug.h"
3#include "util/u_memory.h"
4#include "target-helpers/wrap_screen.h"
5#include "sw/null/null_sw_winsys.h"
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/* Haven't figured out a decent way to build the helper code yet -
16 * #include it here temporarily.
17 */
18#include "sw/sw_public.h"
19#include "sw/sw.c"
20
21#include <stdio.h>
22
23
24struct pipe_screen *
25graw_init( void )
26{
27   const char *default_driver;
28   const char *driver;
29   struct pipe_screen *screen = NULL;
30   struct sw_winsys *winsys = NULL;
31
32   /* Create the underlying winsys, which performs presents to Xlib
33    * drawables:
34    */
35   winsys = null_sw_create();
36   if (winsys == NULL)
37      return NULL;
38
39#if defined(GALLIUM_LLVMPIPE)
40   default_driver = "llvmpipe";
41#elif defined(GALLIUM_SOFTPIPE)
42   default_driver = "softpipe";
43#else
44   default_driver = "";
45#endif
46
47   driver = debug_get_option("GALLIUM_DRIVER", default_driver);
48
49#if defined(GALLIUM_LLVMPIPE)
50   if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
51      screen = llvmpipe_create_screen( winsys );
52#endif
53
54#if defined(GALLIUM_SOFTPIPE)
55   if (screen == NULL)
56      screen = softpipe_create_screen( winsys );
57#endif
58
59   /* Inject any wrapping layers we want to here:
60    */
61   return gallium_wrap_screen( screen );
62}
63
64
65void *
66graw_create_window( int x,
67                    int y,
68                    unsigned width,
69                    unsigned height,
70                    enum pipe_format format )
71{
72   static int dummy;
73   return &dummy;
74}
75
76
77void
78graw_destroy_window( void *window )
79{
80}
81
82