summaryrefslogtreecommitdiff
path: root/src/gallium/targets/graw-xlib/graw_util.c
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2010-05-19 14:04:16 +0100
committerKeith Whitwell <keithw@vmware.com>2010-05-19 14:04:16 +0100
commit431a51b9af32980ae8a544d129bf567287887376 (patch)
tree91f1dad5509413524ea6330bba2de75d3c58ffe8 /src/gallium/targets/graw-xlib/graw_util.c
parenta536c204e289c46b0d493acfb4ebaf99f2b05189 (diff)
parentc7ac03d3964400169ba0dd769e06796c9830aee1 (diff)
Merge commit 'origin/graw-tests'
Diffstat (limited to 'src/gallium/targets/graw-xlib/graw_util.c')
-rw-r--r--src/gallium/targets/graw-xlib/graw_util.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/gallium/targets/graw-xlib/graw_util.c b/src/gallium/targets/graw-xlib/graw_util.c
new file mode 100644
index 0000000000..147532cdee
--- /dev/null
+++ b/src/gallium/targets/graw-xlib/graw_util.c
@@ -0,0 +1,36 @@
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_context.h"
+#include "tgsi/tgsi_text.h"
+#include "util/u_memory.h"
+#include "state_tracker/graw.h"
+
+
+/* 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);
+}
+