summaryrefslogtreecommitdiffstats
path: root/src/gallium/targets/graw-xlib
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-08-26 11:37:42 +0100
committerJosé Fonseca <[email protected]>2010-08-26 11:37:42 +0100
commit90437330e2886fcd351dd11ee0e5aa3e8b523fdc (patch)
treec315c0b32a29b28a05b7efff7e3075d908c5c0b2 /src/gallium/targets/graw-xlib
parent0f74efdef05c5c27b3137163d795dc91f34cc114 (diff)
graw: Undo late loading of graw drivers.
Keith prefers a clean separation between graw applications and implementations, where apps do not link libgallium.a but instead get all functionality they need via graw interface. Although this is not incompatible with late loading of graw drivers, it it would make it very hard to maintain, as wrappers for every utility symbol exposed in graw would have to be written or generated somehow.
Diffstat (limited to 'src/gallium/targets/graw-xlib')
-rw-r--r--src/gallium/targets/graw-xlib/SConscript1
-rw-r--r--src/gallium/targets/graw-xlib/graw_util.c50
2 files changed, 51 insertions, 0 deletions
diff --git a/src/gallium/targets/graw-xlib/SConscript b/src/gallium/targets/graw-xlib/SConscript
index 32b98cdef3b..21fce948f43 100644
--- a/src/gallium/targets/graw-xlib/SConscript
+++ b/src/gallium/targets/graw-xlib/SConscript
@@ -26,6 +26,7 @@ env.Append(CPPPATH = [
sources = [
'graw_xlib.c',
+ 'graw_util.c',
]
env.Tool('x11')
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 00000000000..fc7c9ae6f92
--- /dev/null
+++ b/src/gallium/targets/graw-xlib/graw_util.c
@@ -0,0 +1,50 @@
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_context.h"
+#include "pipe/p_state.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_geometry_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_gs_state(pipe, &state);
+}
+
+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);
+}
+