graw: add parse_geometry_shader helper
authorKeith Whitwell <keithw@vmware.com>
Mon, 7 Jun 2010 18:37:44 +0000 (19:37 +0100)
committerKeith Whitwell <keithw@vmware.com>
Mon, 7 Jun 2010 18:38:30 +0000 (19:38 +0100)
src/gallium/include/state_tracker/graw.h
src/gallium/targets/graw-xlib/graw_util.c

index e5b298e03d9ddb47569b8ee44c118ebc2cc2cd26..59b0e337c9216efdc3fb14ab67a46bf04eaf097b 100644 (file)
@@ -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 );
 
index 147532cdee18191c069a070cd19b8d90baa80a84..47aca4464db9fdb5b4f14951ae9a30abd60d3aef 100644 (file)
@@ -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)
 {