Mesa (master): graw: add parse_geometry_shader helper

Keith Whitwell keithw at kemper.freedesktop.org
Mon Jun 7 11:41:36 PDT 2010


Module: Mesa
Branch: master
Commit: 9d343f4ba18e506942a9c1f70f0ccae1309d7ece
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d343f4ba18e506942a9c1f70f0ccae1309d7ece

Author: Keith Whitwell <keithw at vmware.com>
Date:   Mon Jun  7 19:37:44 2010 +0100

graw: add parse_geometry_shader helper

---

 src/gallium/include/state_tracker/graw.h  |    3 +++
 src/gallium/targets/graw-xlib/graw_util.c |   13 +++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/gallium/include/state_tracker/graw.h b/src/gallium/include/state_tracker/graw.h
index e5b298e..59b0e33 100644
--- a/src/gallium/include/state_tracker/graw.h
+++ b/src/gallium/include/state_tracker/graw.h
@@ -34,6 +34,9 @@ PUBLIC struct pipe_screen *graw_create_window_and_screen( int x,
 PUBLIC void graw_set_display_func( void (*func)( void ) );
 PUBLIC void graw_main_loop( void );
 
+PUBLIC void *graw_parse_geometry_shader( struct pipe_context *pipe,
+                                         const char *text );
+
 PUBLIC void *graw_parse_vertex_shader( struct pipe_context *pipe,
                                        const char *text );
 
diff --git a/src/gallium/targets/graw-xlib/graw_util.c b/src/gallium/targets/graw-xlib/graw_util.c
index 147532c..47aca44 100644
--- a/src/gallium/targets/graw-xlib/graw_util.c
+++ b/src/gallium/targets/graw-xlib/graw_util.c
@@ -8,6 +8,19 @@
 
 /* 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)
 {



More information about the mesa-commit mailing list