glsl2: Add and use new variable mode ir_var_temporary
[mesa/nouveau-pmpeg.git] / src / gallium / targets / graw-xlib / graw_util.c
blob47aca4464db9fdb5b4f14951ae9a30abd60d3aef
2 #include "pipe/p_compiler.h"
3 #include "pipe/p_context.h"
4 #include "tgsi/tgsi_text.h"
5 #include "util/u_memory.h"
6 #include "state_tracker/graw.h"
9 /* Helper functions. These are the same for all graw implementations.
11 void *graw_parse_geometry_shader(struct pipe_context *pipe,
12 const char *text)
14 struct tgsi_token tokens[1024];
15 struct pipe_shader_state state;
17 if (!tgsi_text_translate(text, tokens, Elements(tokens)))
18 return NULL;
20 state.tokens = tokens;
21 return pipe->create_gs_state(pipe, &state);
24 void *graw_parse_vertex_shader(struct pipe_context *pipe,
25 const char *text)
27 struct tgsi_token tokens[1024];
28 struct pipe_shader_state state;
30 if (!tgsi_text_translate(text, tokens, Elements(tokens)))
31 return NULL;
33 state.tokens = tokens;
34 return pipe->create_vs_state(pipe, &state);
37 void *graw_parse_fragment_shader(struct pipe_context *pipe,
38 const char *text)
40 struct tgsi_token tokens[1024];
41 struct pipe_shader_state state;
43 if (!tgsi_text_translate(text, tokens, Elements(tokens)))
44 return NULL;
46 state.tokens = tokens;
47 return pipe->create_fs_state(pipe, &state);