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 <kenneth@whitecape.org> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user