aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/shaderapi.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-06-26 15:01:24 +0200
committermarha <marha@users.sourceforge.net>2013-06-26 15:01:24 +0200
commit2fe2056807d1304de86deb2b59992d51d9252ad0 (patch)
tree665d730ee19df03e4dfca01371009ec778a343af /mesalib/src/mesa/main/shaderapi.c
parentfa791414601df61d20d860299dba80fdb62565df (diff)
downloadvcxsrv-2fe2056807d1304de86deb2b59992d51d9252ad0.tar.gz
vcxsrv-2fe2056807d1304de86deb2b59992d51d9252ad0.tar.bz2
vcxsrv-2fe2056807d1304de86deb2b59992d51d9252ad0.zip
libXext mesa git update 29 June 20013
libXext commit 7378d4bdbd33ed49ed6cfa5c4f73d7527982aab4 mesa commit 9aebad618c0aab527a0b838ce0a79ffa6dd426bb
Diffstat (limited to 'mesalib/src/mesa/main/shaderapi.c')
-rw-r--r--mesalib/src/mesa/main/shaderapi.c60
1 files changed, 41 insertions, 19 deletions
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 <stdbool.h>
#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);
}