diff options
author | Keith Whitwell <[email protected]> | 2010-05-14 12:07:38 +0100 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2010-05-14 12:19:57 +0100 |
commit | 7375d7a5c9d5c32fd6bdde0cc8cab8fe41415964 (patch) | |
tree | ca9f7aea3be8c302ea80f05676c7e763ce653dd0 /src/gallium/targets/graw-xlib | |
parent | 39087f636afcee058fc9af2c58cb1e2474c9b258 (diff) |
graw: move towards glut-like interface, add tri.c
Diffstat (limited to 'src/gallium/targets/graw-xlib')
-rw-r--r-- | src/gallium/targets/graw-xlib/graw_xlib.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/gallium/targets/graw-xlib/graw_xlib.c b/src/gallium/targets/graw-xlib/graw_xlib.c index 21715c26fdc..d0e3e4bdd6b 100644 --- a/src/gallium/targets/graw-xlib/graw_xlib.c +++ b/src/gallium/targets/graw-xlib/graw_xlib.c @@ -1,6 +1,8 @@ #include "pipe/p_compiler.h" +#include "pipe/p_context.h" #include "util/u_debug.h" #include "util/u_memory.h" +#include "tgsi/tgsi_text.h" #include "target-helpers/wrap_screen.h" #include "state_tracker/xlib_sw_winsys.h" @@ -27,6 +29,7 @@ static struct { Display *display; + void (*draw)(void); } graw; @@ -179,3 +182,49 @@ graw_destroy_window( void *xlib_drawable ) { } +void +graw_set_display_func( void (*draw)( void ) ) +{ + graw.draw = draw; +} + +void +graw_main_loop( void ) +{ + int i; + for (i = 0; i < 10; i++) { + graw.draw(); + sleep(1); + } +} + + + +/* Helper functions. These are the same for all graw implementations. + */ +void *graw_parse_vertex_shader(struct pipe_context *pipe, + const char *text) +{ + struct tgsi_token tokens[1024]; + struct pipe_shader_state state; + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) + return NULL; + + state.tokens = tokens; + return pipe->create_vs_state(pipe, &state); +} + +void *graw_parse_fragment_shader(struct pipe_context *pipe, + const char *text) +{ + struct tgsi_token tokens[1024]; + struct pipe_shader_state state; + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) + return NULL; + + state.tokens = tokens; + return pipe->create_fs_state(pipe, &state); +} + |