From 2fe2056807d1304de86deb2b59992d51d9252ad0 Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 26 Jun 2013 15:01:24 +0200 Subject: libXext mesa git update 29 June 20013 libXext commit 7378d4bdbd33ed49ed6cfa5c4f73d7527982aab4 mesa commit 9aebad618c0aab527a0b838ce0a79ffa6dd426bb --- mesalib/src/mesa/main/shaderapi.c | 60 ++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 19 deletions(-) (limited to 'mesalib/src/mesa/main/shaderapi.c') diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 8cb02760b..4cc0357b1 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -48,11 +48,14 @@ #include "main/transformfeedback.h" #include "main/uniforms.h" #include "program/program.h" +#include "program/prog_print.h" #include "program/prog_parameter.h" #include "ralloc.h" #include #include "../glsl/glsl_parser_extras.h" +#include "../glsl/ir.h" #include "../glsl/ir_uniform.h" +#include "../glsl/program.h" /** Define this to enable shader substitution (see below) */ #define SHADER_SUBST 0 @@ -743,10 +746,42 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj) /* set default pragma state for shader */ sh->Pragmas = options->DefaultPragmas; - /* this call will set the sh->CompileStatus field to indicate if - * compilation was successful. - */ - _mesa_glsl_compile_shader(ctx, sh); + if (!sh->Source) { + /* If the user called glCompileShader without first calling + * glShaderSource, we should fail to compile, but not raise a GL_ERROR. + */ + sh->CompileStatus = GL_FALSE; + } else { + if (ctx->Shader.Flags & GLSL_DUMP) { + printf("GLSL source for %s shader %d:\n", + _mesa_glsl_shader_target_name(sh->Type), sh->Name); + printf("%s\n", sh->Source); + } + + /* this call will set the shader->CompileStatus field to indicate if + * compilation was successful. + */ + _mesa_glsl_compile_shader(ctx, sh, false, false); + + if (ctx->Shader.Flags & GLSL_LOG) { + _mesa_write_shader_to_file(sh); + } + + if (ctx->Shader.Flags & GLSL_DUMP) { + if (sh->CompileStatus) { + printf("GLSL IR for shader %d:\n", sh->Name); + _mesa_print_ir(sh->ir, NULL); + printf("\n\n"); + } else { + printf("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); + } + } + + } if (sh->CompileStatus == GL_FALSE && (ctx->Shader.Flags & GLSL_REPORT_ERRORS)) { @@ -816,21 +851,8 @@ print_shader_info(const struct gl_shader_program *shProg) printf("Mesa: glUseProgram(%u)\n", shProg->Name); for (i = 0; i < shProg->NumShaders; i++) { - const char *s; - switch (shProg->Shaders[i]->Type) { - case GL_VERTEX_SHADER: - s = "vertex"; - break; - case GL_FRAGMENT_SHADER: - s = "fragment"; - break; - case GL_GEOMETRY_SHADER: - s = "geometry"; - break; - default: - s = ""; - } - printf(" %s shader %u, checksum %u\n", s, + printf(" %s shader %u, checksum %u\n", + _mesa_glsl_shader_target_name(shProg->Shaders[i]->Type), shProg->Shaders[i]->Name, shProg->Shaders[i]->SourceChecksum); } -- cgit v1.2.3