Compile multiple shaders listed on the command line
This commit is contained in:
22
main.cpp
22
main.cpp
@@ -164,7 +164,7 @@ compile_shader(struct glsl_program *prog)
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct _mesa_glsl_parse_state state;
|
int status = EXIT_SUCCESS;
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
@@ -175,9 +175,21 @@ main(int argc, char **argv)
|
|||||||
if (argc <= optind)
|
if (argc <= optind)
|
||||||
usage_fail(argv[0]);
|
usage_fail(argv[0]);
|
||||||
|
|
||||||
|
struct glsl_program **prog_list = NULL;
|
||||||
|
unsigned prog_list_len = 0;
|
||||||
|
|
||||||
|
for (/* empty */; argc > optind; optind++) {
|
||||||
|
prog_list = (struct glsl_program **)
|
||||||
|
realloc(prog_list,
|
||||||
|
sizeof(struct glsl_program *) * (prog_list_len + 1));
|
||||||
|
assert(prog_list != NULL);
|
||||||
|
|
||||||
struct glsl_program *prog = new glsl_program;
|
struct glsl_program *prog = new glsl_program;
|
||||||
memset(prog, 0, sizeof(*prog));
|
memset(prog, 0, sizeof(*prog));
|
||||||
|
|
||||||
|
prog_list[prog_list_len] = prog;
|
||||||
|
prog_list_len++;
|
||||||
|
|
||||||
const unsigned len = strlen(argv[optind]);
|
const unsigned len = strlen(argv[optind]);
|
||||||
if (len < 6)
|
if (len < 6)
|
||||||
usage_fail(argv[0]);
|
usage_fail(argv[0]);
|
||||||
@@ -196,5 +208,11 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
compile_shader(prog);
|
compile_shader(prog);
|
||||||
|
|
||||||
return prog->CompileStatus ? EXIT_SUCCESS : EXIT_FAILURE;
|
if (!prog->CompileStatus) {
|
||||||
|
status = EXIT_FAILURE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user