scons: Revamp how to specify targets to build.
[mesa.git] / src / gallium / targets / graw-null / graw_util.c
1
2 #include "pipe/p_compiler.h"
3 #include "pipe/p_context.h"
4 #include "pipe/p_state.h"
5 #include "tgsi/tgsi_text.h"
6 #include "util/u_memory.h"
7 #include "state_tracker/graw.h"
8
9
10 /* Helper functions. These are the same for all graw implementations.
11 */
12 PUBLIC void *
13 graw_parse_geometry_shader(struct pipe_context *pipe,
14 const char *text)
15 {
16 struct tgsi_token tokens[1024];
17 struct pipe_shader_state state;
18
19 if (!tgsi_text_translate(text, tokens, Elements(tokens)))
20 return NULL;
21
22 state.tokens = tokens;
23 return pipe->create_gs_state(pipe, &state);
24 }
25
26 PUBLIC void *
27 graw_parse_vertex_shader(struct pipe_context *pipe,
28 const char *text)
29 {
30 struct tgsi_token tokens[1024];
31 struct pipe_shader_state state;
32
33 if (!tgsi_text_translate(text, tokens, Elements(tokens)))
34 return NULL;
35
36 state.tokens = tokens;
37 return pipe->create_vs_state(pipe, &state);
38 }
39
40 PUBLIC void *
41 graw_parse_fragment_shader(struct pipe_context *pipe,
42 const char *text)
43 {
44 struct tgsi_token tokens[1024];
45 struct pipe_shader_state state;
46
47 if (!tgsi_text_translate(text, tokens, Elements(tokens)))
48 return NULL;
49
50 state.tokens = tokens;
51 return pipe->create_fs_state(pipe, &state);
52 }
53