On 05/10/2016 12:13 AM, Alejandro Piñeiro wrote:
> 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.
> ---
>  src/compiler/glsl/main.cpp | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/src/compiler/glsl/main.cpp b/src/compiler/glsl/main.cpp
> index d253575..727f67c 100644
> --- a/src/compiler/glsl/main.cpp
> +++ b/src/compiler/glsl/main.cpp
> @@ -274,12 +274,14 @@ int dump_ast = 0;
>  int dump_hir = 0;
>  int dump_lir = 0;
>  int do_link = 0;
> +int just_log = 0;
>  
>  const struct option compiler_opts[] = {
>     { "dump-ast", no_argument, &dump_ast, 1 },
>     { "dump-hir", no_argument, &dump_hir, 1 },
>     { "dump-lir", no_argument, &dump_lir, 1 },
>     { "link",     no_argument, &do_link,  1 },
> +   { "just-log", no_argument, &just_log,  1 },
>     { "version",  required_argument, NULL, 'v' },
>     { NULL, 0, NULL, 0 }
>  };
> @@ -414,8 +416,13 @@ main(int argc, char **argv)
>  
>        compile_shader(ctx, shader);
>  
> -      if (strlen(shader->InfoLog) > 0)
> -      printf("Info log for %s:\n%s\n", argv[optind], shader->InfoLog);
> +      if (strlen(shader->InfoLog) > 0) {
> +         if (!just_log)
> +            printf("Info log for %s:\n", argv[optind]);
> +
> +         printf("%s", shader->InfoLog);
> +         if (!just_log) printf("\n");

The printf goes on its own line.  With that fixed here and below, this
patch is

Reviewed-by: Ian Romanick <ian.d.roman...@intel.com>

> +      }
>  
>        if (!shader->CompileStatus) {
>        status = EXIT_FAILURE;
> @@ -429,8 +436,13 @@ main(int argc, char **argv)
>        link_shaders(ctx, whole_program);
>        status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
>  
> -      if (strlen(whole_program->InfoLog) > 0)
> -      printf("Info log for linking:\n%s\n", whole_program->InfoLog);
> +      if (strlen(whole_program->InfoLog) > 0) {
> +         printf("\n");
> +         if (!just_log)
> +            printf("Info log for linking:\n");
> +         printf("%s", whole_program->InfoLog);
> +         if (!just_log) printf("\n");
> +      }
>     }
>  
>     for (unsigned i = 0; i < MESA_SHADER_STAGES; i++)
> 

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to