summaryrefslogtreecommitdiffstats
path: root/glsl_parser_extras.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-03-10 09:31:30 -0800
committerIan Romanick <[email protected]>2010-03-10 09:31:30 -0800
commit8e6cd3bf54132d64a1f39df05c9392b46eece2a1 (patch)
tree27e2cd184e8b258f2933cfba10c4455a3760f141 /glsl_parser_extras.cpp
parent1c4156ffac393a1379ea1674d363e64f0da4a40b (diff)
Require the shader target be specified to the driver program
Diffstat (limited to 'glsl_parser_extras.cpp')
-rw-r--r--glsl_parser_extras.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp
index caa221f9212..222f06b5263 100644
--- a/glsl_parser_extras.cpp
+++ b/glsl_parser_extras.cpp
@@ -684,8 +684,27 @@ main(int argc, char **argv)
struct simple_node *ptr;
exec_list instructions;
- (void) argc;
- shader = load_text_file(argv[1], & shader_len);
+ if (argc < 3) {
+ printf("Usage: %s [v|g|f] <shader_file>\n", argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ switch (argv[1][0]) {
+ case 'v':
+ state.target = vertex_shader;
+ break;
+ case 'g':
+ state.target = geometry_shader;
+ break;
+ case 'f':
+ state.target = fragment_shader;
+ break;
+ default:
+ printf("Usage: %s [v|g|f] <shader_file>\n", argv[0]);
+ return EXIT_FAILURE;
+ }
+
+ shader = load_text_file(argv[2], & shader_len);
state.scanner = NULL;
make_empty_list(& state.translation_unit);