glsl2: Add and use new variable mode ir_var_temporary
[mesa/nouveau-pmpeg.git] / src / gallium / targets / graw-null / graw_null.c
blob5939a5acd3ca8ede3e67a44d807810be953eacaf
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 #include "os/os_time.h"
7 #include "state_tracker/graw.h"
9 #ifdef GALLIUM_SOFTPIPE
10 #include "softpipe/sp_public.h"
11 #endif
13 #ifdef GALLIUM_LLVMPIPE
14 #include "llvmpipe/lp_public.h"
15 #endif
17 /* Haven't figured out a decent way to build the helper code yet -
18 * #include it here temporarily.
20 #include "sw/sw_public.h"
21 #include "sw/sw.c"
23 #include <stdio.h>
26 static struct {
27 void (*draw)(void);
28 } graw;
32 struct pipe_screen *
33 graw_create_window_and_screen( int x,
34 int y,
35 unsigned width,
36 unsigned height,
37 enum pipe_format format,
38 void **handle)
40 const char *default_driver;
41 const char *driver;
42 struct pipe_screen *screen = NULL;
43 struct sw_winsys *winsys = NULL;
44 static int dummy;
47 /* Create the underlying winsys, which performs presents to Xlib
48 * drawables:
50 winsys = null_sw_create();
51 if (winsys == NULL)
52 return NULL;
54 #if defined(GALLIUM_LLVMPIPE)
55 default_driver = "llvmpipe";
56 #elif defined(GALLIUM_SOFTPIPE)
57 default_driver = "softpipe";
58 #else
59 default_driver = "";
60 #endif
62 driver = debug_get_option("GALLIUM_DRIVER", default_driver);
64 #if defined(GALLIUM_LLVMPIPE)
65 if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
66 screen = llvmpipe_create_screen( winsys );
67 #endif
69 #if defined(GALLIUM_SOFTPIPE)
70 if (screen == NULL)
71 screen = softpipe_create_screen( winsys );
72 #endif
74 *handle = &dummy;
76 /* Inject any wrapping layers we want to here:
78 return gallium_wrap_screen( screen );
83 void
84 graw_set_display_func( void (*draw)( void ) )
86 graw.draw = draw;
90 void
91 graw_main_loop( void )
93 graw.draw();
94 os_time_sleep(100000);