[Mesa-dev] [PATCH 3/5] glsl: add just-log option for the standalone compiler.

Alejandro PiƱeiro apinheiro at igalia.com
Tue May 10 07:13:27 UTC 2016


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");
+      }
 
       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++)
-- 
2.7.4



More information about the mesa-dev mailing list