From: Kenneth Graunke Date: Sat, 1 Mar 2014 08:11:18 +0000 (-0800) Subject: mesa: Move MESA_GLSL=dump output to stderr. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c95ec27a4afbc43a226c3be2892598500ab906f7;p=mesa.git mesa: Move MESA_GLSL=dump output to stderr. i965 recently moved debug printfs to use stderr, including ones which trigger on MESA_GLSL=dump. This resulted in scrambled output. For drivers using ir_to_mesa, print_program was already using stderr, yet all the code around it was using stdout. Signed-off-by: Kenneth Graunke Reviewed-by: Brian Paul Reviewed-by: Matt Turner --- diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index cbf83900d72..e2f3462af2b 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -838,9 +838,10 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj) sh->CompileStatus = GL_FALSE; } else { if (ctx->Shader.Flags & GLSL_DUMP) { - printf("GLSL source for %s shader %d:\n", - _mesa_shader_stage_to_string(sh->Stage), sh->Name); - printf("%s\n", sh->Source); + fprintf(stderr, "GLSL source for %s shader %d:\n", + _mesa_shader_stage_to_string(sh->Stage), sh->Name); + fprintf(stderr, "%s\n", sh->Source); + fflush(stderr); } /* this call will set the shader->CompileStatus field to indicate if @@ -854,16 +855,17 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj) if (ctx->Shader.Flags & GLSL_DUMP) { if (sh->CompileStatus) { - printf("GLSL IR for shader %d:\n", sh->Name); - _mesa_print_ir(stdout, sh->ir, NULL); - printf("\n\n"); + fprintf(stderr, "GLSL IR for shader %d:\n", sh->Name); + _mesa_print_ir(stderr, sh->ir, NULL); + fprintf(stderr, "\n\n"); } else { - printf("GLSL shader %d failed to compile.\n", sh->Name); + fprintf(stderr, "GLSL shader %d failed to compile.\n", sh->Name); } if (sh->InfoLog && sh->InfoLog[0] != 0) { - printf("GLSL shader %d info log:\n", sh->Name); - printf("%s\n", sh->InfoLog); + fprintf(stderr, "GLSL shader %d info log:\n", sh->Name); + fprintf(stderr, "%s\n", sh->InfoLog); } + fflush(stderr); } } diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 06df41f897a..9919874a668 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2918,16 +2918,17 @@ get_mesa_program(struct gl_context *ctx, set_branchtargets(&v, mesa_instructions, num_instructions); if (ctx->Shader.Flags & GLSL_DUMP) { - printf("\n"); - printf("GLSL IR for linked %s program %d:\n", target_string, - shader_program->Name); - _mesa_print_ir(stdout, shader->ir, NULL); - printf("\n"); - printf("\n"); - printf("Mesa IR for linked %s program %d:\n", target_string, - shader_program->Name); + fprintf(stderr, "\n"); + fprintf(stderr, "GLSL IR for linked %s program %d:\n", target_string, + shader_program->Name); + _mesa_print_ir(stderr, shader->ir, NULL); + fprintf(stderr, "\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "Mesa IR for linked %s program %d:\n", target_string, + shader_program->Name); print_program(mesa_instructions, mesa_instruction_annotation, num_instructions); + fflush(stderr); } prog->Instructions = mesa_instructions; @@ -3097,12 +3098,12 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) if (ctx->Shader.Flags & GLSL_DUMP) { if (!prog->LinkStatus) { - printf("GLSL shader program %d failed to link\n", prog->Name); + fprintf(stderr, "GLSL shader program %d failed to link\n", prog->Name); } if (prog->InfoLog && prog->InfoLog[0] != 0) { - printf("GLSL shader program %d info log:\n", prog->Name); - printf("%s\n", prog->InfoLog); + fprintf(stderr, "GLSL shader program %d info log:\n", prog->Name); + fprintf(stderr, "%s\n", prog->InfoLog); } } }