Require the shader target be specified to the driver program
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 10 Mar 2010 17:31:30 +0000 (09:31 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 10 Mar 2010 17:31:30 +0000 (09:31 -0800)
glsl_parser_extras.cpp

index caa221f921201fb0bb8d900f56aad3d947219f32..222f06b5263028898828a2725d251be15b890a08 100644 (file)
@@ -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);