summaryrefslogtreecommitdiffstats
path: root/src/gallium/targets/graw-xlib/graw_xlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/targets/graw-xlib/graw_xlib.c')
-rw-r--r--src/gallium/targets/graw-xlib/graw_xlib.c49
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);
+}
+