diff options
author | Chad Versace <chad.versace@intel.com> | 2010-11-17 15:28:36 -0800 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2010-11-17 15:44:41 -0800 |
commit | 7819435f2ef484696560547fbc1325cb97c7174b (patch) | |
tree | 49bdd03d06aa4f831826a8fe500a8bde7372fb7f /src | |
parent | 007f4881503b69055d65cfb20bd237673779786b (diff) |
glsl: Improve usage message for glsl_compiler
The new usage message lists possible command line options. (Newcomers to Mesa
currently have to trawl through the source to find the command line options,
and we should save them from that trouble.)
Example Output
--------------
usage: ./glsl_compiler [options] <file.vert | file.geom | file.frag>
Possible options are:
--glsl-es
--dump-ast
--dump-hir
--dump-lir
--link
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/main.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 08a44c96e5..3302851264 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -146,15 +146,6 @@ load_text_file(void *ctx, const char *file_name) return text; } - -void -usage_fail(const char *name) -{ - printf("%s <filename.frag|filename.vert>\n", name); - exit(EXIT_FAILURE); -} - - int glsl_es = 0; int dump_ast = 0; int dump_hir = 0; @@ -170,6 +161,25 @@ const struct option compiler_opts[] = { { NULL, 0, NULL, 0 } }; +/** + * \brief Print proper usage and exit with failure. + */ +void +usage_fail(const char *name) +{ + + const char *header = + "usage: %s [options] <file.vert | file.geom | file.frag>\n" + "\n" + "Possible options are:\n"; + printf(header, name, name); + for (const struct option *o = compiler_opts; o->name != 0; ++o) { + printf(" --%s\n", o->name); + } + exit(EXIT_FAILURE); +} + + void compile_shader(struct gl_context *ctx, struct gl_shader *shader) { |