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
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;
{ 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)
{