glsl: add just-log option for the standalone compiler.
Add an option in order to ask to just print the InfoLog, without any header or separator. Useful if we want to use the standalone compiler to track only the warning/error messages. v2: all printfs goes on its own line (Ian Romanick) v3: rebasing: move just_log to standalone.h/cpp Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
@@ -43,6 +43,7 @@ const struct option compiler_opts[] = {
|
|||||||
{ "dump-hir", no_argument, &options.dump_hir, 1 },
|
{ "dump-hir", no_argument, &options.dump_hir, 1 },
|
||||||
{ "dump-lir", no_argument, &options.dump_lir, 1 },
|
{ "dump-lir", no_argument, &options.dump_lir, 1 },
|
||||||
{ "link", no_argument, &options.do_link, 1 },
|
{ "link", no_argument, &options.do_link, 1 },
|
||||||
|
{ "just-log", no_argument, &options.just_log, 1 },
|
||||||
{ "version", required_argument, NULL, 'v' },
|
{ "version", required_argument, NULL, 'v' },
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
@@ -381,8 +381,14 @@ standalone_compile_shader(const struct standalone_options *_options,
|
|||||||
|
|
||||||
compile_shader(ctx, shader);
|
compile_shader(ctx, shader);
|
||||||
|
|
||||||
if (strlen(shader->InfoLog) > 0)
|
if (strlen(shader->InfoLog) > 0) {
|
||||||
printf("Info log for %s:\n%s\n", files[i], shader->InfoLog);
|
if (!options->just_log)
|
||||||
|
printf("Info log for %s:\n", files[i]);
|
||||||
|
|
||||||
|
printf("%s", shader->InfoLog);
|
||||||
|
if (!options->just_log)
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (!shader->CompileStatus) {
|
if (!shader->CompileStatus) {
|
||||||
status = EXIT_FAILURE;
|
status = EXIT_FAILURE;
|
||||||
@@ -396,8 +402,14 @@ standalone_compile_shader(const struct standalone_options *_options,
|
|||||||
link_shaders(ctx, whole_program);
|
link_shaders(ctx, whole_program);
|
||||||
status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
|
status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
|
|
||||||
if (strlen(whole_program->InfoLog) > 0)
|
if (strlen(whole_program->InfoLog) > 0) {
|
||||||
printf("Info log for linking:\n%s\n", whole_program->InfoLog);
|
printf("\n");
|
||||||
|
if (!options->just_log)
|
||||||
|
printf("Info log for linking:\n");
|
||||||
|
printf("%s", whole_program->InfoLog);
|
||||||
|
if (!options->just_log)
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
|
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
|
||||||
struct gl_shader *shader = whole_program->_LinkedShaders[i];
|
struct gl_shader *shader = whole_program->_LinkedShaders[i];
|
||||||
|
@@ -34,6 +34,7 @@ struct standalone_options {
|
|||||||
int dump_hir;
|
int dump_hir;
|
||||||
int dump_lir;
|
int dump_lir;
|
||||||
int do_link;
|
int do_link;
|
||||||
|
int just_log;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gl_shader_program;
|
struct gl_shader_program;
|
||||||
|
Reference in New Issue
Block a user