diff options
author | marha <marha@users.sourceforge.net> | 2010-03-07 13:28:57 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-03-07 13:28:57 +0000 |
commit | 14b1cb8d5a27ec9716d3f790fce95f0469e35605 (patch) | |
tree | 6c94dc9f37b19b995bec603141442b1b93e8c9d2 /mesalib/src/mesa/shader/shader_api.c | |
parent | 93c85587c691f9b91e7c2d8bda50f453e0f6674d (diff) | |
download | vcxsrv-14b1cb8d5a27ec9716d3f790fce95f0469e35605.tar.gz vcxsrv-14b1cb8d5a27ec9716d3f790fce95f0469e35605.tar.bz2 vcxsrv-14b1cb8d5a27ec9716d3f790fce95f0469e35605.zip |
Updated to Mesa 7.7
Diffstat (limited to 'mesalib/src/mesa/shader/shader_api.c')
-rw-r--r-- | mesalib/src/mesa/shader/shader_api.c | 63 |
1 files changed, 47 insertions, 16 deletions
diff --git a/mesalib/src/mesa/shader/shader_api.c b/mesalib/src/mesa/shader/shader_api.c index b282d7af6..453cd3964 100644 --- a/mesalib/src/mesa/shader/shader_api.c +++ b/mesalib/src/mesa/shader/shader_api.c @@ -380,12 +380,18 @@ get_shader_flags(void) flags |= GLSL_DUMP; if (_mesa_strstr(env, "log")) flags |= GLSL_LOG; + if (_mesa_strstr(env, "nopvert")) + flags |= GLSL_NOP_VERT; + if (_mesa_strstr(env, "nopfrag")) + flags |= GLSL_NOP_FRAG; if (_mesa_strstr(env, "nopt")) flags |= GLSL_NO_OPT; else if (_mesa_strstr(env, "opt")) flags |= GLSL_OPT; if (_mesa_strstr(env, "uniform")) flags |= GLSL_UNIFORMS; + if (_mesa_strstr(env, "useprog")) + flags |= GLSL_USE_PROG; } return flags; @@ -1493,6 +1499,41 @@ _mesa_link_program(GLcontext *ctx, GLuint program) /** + * Print basic shader info (for debug). + */ +static void +print_shader_info(const struct gl_shader_program *shProg) +{ + GLuint i; + + _mesa_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 = ""; + } + _mesa_printf(" %s shader %u, checksum %u\n", s, + shProg->Shaders[i]->Name, + shProg->Shaders[i]->SourceChecksum); + } + if (shProg->VertexProgram) + _mesa_printf(" vert prog %u\n", shProg->VertexProgram->Base.Id); + if (shProg->FragmentProgram) + _mesa_printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id); +} + + +/** * Called via ctx->Driver.UseProgram() */ void @@ -1506,8 +1547,6 @@ _mesa_use_program(GLcontext *ctx, GLuint program) return; } - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); - if (program) { shProg = _mesa_lookup_shader_program_err(ctx, program, "glUseProgram"); if (!shProg) { @@ -1520,26 +1559,18 @@ _mesa_use_program(GLcontext *ctx, GLuint program) } /* debug code */ - if (0) { - GLuint i; - _mesa_printf("Use Shader %u\n", shProg->Name); - for (i = 0; i < shProg->NumShaders; i++) { - _mesa_printf(" shader %u, type 0x%x, checksum %u\n", - shProg->Shaders[i]->Name, - 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); + if (ctx->Shader.Flags & GLSL_USE_PROG) { + print_shader_info(shProg); } } else { shProg = NULL; } - _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram, shProg); + if (ctx->Shader.CurrentProgram != shProg) { + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram, shProg); + } } |