ARB prog lexer: Fix lexer to eat both DOS and Unix line endings
[mesa.git] / src / mesa / shader / shader_api.c
index 61289db2d2e6278a497b219624d271a416ca09f7..cf0a9023894a7df8da0fe4a065671edbc50d447d 100644 (file)
 #include "glapi/dispatch.h"
 
 
-#ifndef GL_PROGRAM_BINARY_LENGTH_OES
-#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
-#endif
-
-
 /**
  * Allocate a new gl_shader_program object, initialize it.
  */
@@ -407,6 +402,7 @@ _mesa_init_shader_state(GLcontext * ctx)
     * are generated by the GLSL compiler.
     */
    ctx->Shader.EmitHighLevelInstructions = GL_TRUE;
+   ctx->Shader.EmitContReturn = GL_TRUE;
    ctx->Shader.EmitCondCodes = GL_FALSE;
    ctx->Shader.EmitComments = GL_FALSE;
    ctx->Shader.Flags = get_shader_flags();
@@ -889,7 +885,7 @@ _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
 static struct gl_program_parameter *
 get_uniform_parameter(const struct gl_shader_program *shProg, GLuint index)
 {
-   const struct gl_program *prog;
+   const struct gl_program *prog = NULL;
    GLint progPos;
 
    progPos = shProg->Uniforms->Uniforms[index].VertPos;
@@ -919,7 +915,7 @@ _mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index,
                          GLenum *type, GLchar *nameOut)
 {
    const struct gl_shader_program *shProg;
-   const struct gl_program *prog;
+   const struct gl_program *prog = NULL;
    const struct gl_program_parameter *param;
    GLint progPos;
 
@@ -1435,6 +1431,9 @@ _mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source)
    }
    sh->Source = source;
    sh->CompileStatus = GL_FALSE;
+#ifdef DEBUG
+   sh->SourceChecksum = _mesa_str_checksum(sh->Source);
+#endif
 }
 
 
@@ -1492,7 +1491,7 @@ _mesa_use_program(GLcontext *ctx, GLuint program)
       return;
    }
 
-   FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+   FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
 
    if (program) {
       shProg = _mesa_lookup_shader_program_err(ctx, program, "glUseProgram");
@@ -1510,10 +1509,15 @@ _mesa_use_program(GLcontext *ctx, GLuint program)
          GLuint i;
          _mesa_printf("Use Shader %u\n", shProg->Name);
          for (i = 0; i < shProg->NumShaders; i++) {
-            _mesa_printf(" shader %u, type 0x%x\n",
+            _mesa_printf(" shader %u, type 0x%x, checksum %u\n",
                          shProg->Shaders[i]->Name,
-                         shProg->Shaders[i]->Type);
+                         shProg->Shaders[i]->Type,
+                         shProg->Shaders[i]->SourceChecksum);
          }
+         if (shProg->VertexProgram)
+            printf(" vert prog %u\n", shProg->VertexProgram->Base.Id);
+         if (shProg->FragmentProgram)
+            printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id);
       }
    }
    else {
@@ -1794,7 +1798,7 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
       return;
    }
 
-   FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+   FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
 
    uniform = &shProg->Uniforms->Uniforms[location];
 
@@ -1902,7 +1906,7 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program,
  */
 static void
 _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
-                     GLenum matrixType, GLint location, GLsizei count,
+                     GLint location, GLsizei count,
                      GLboolean transpose, const GLfloat *values)
 {
    struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
@@ -1934,7 +1938,7 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
       return;
    }
 
-   FLUSH_VERTICES(ctx, _NEW_PROGRAM);
+   FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
 
    uniform = &shProg->Uniforms->Uniforms[location];