mesa: added nopfrag/nopvert options for MESA_GLSL

These options can be used to force vertex/fragment shaders to be no-op
shaders (actually, simple pass-through shaders).  For debug/test purposes.
This commit is contained in:
Brian Paul
2009-09-29 10:22:32 -06:00
parent c7aee65bb9
commit cb0de06301
3 changed files with 16 additions and 0 deletions
+2
View File
@@ -2066,6 +2066,8 @@ struct gl_shader_program
#define GLSL_OPT 0x4 /**< Force optimizations (override pragmas) */
#define GLSL_NO_OPT 0x8 /**< Force no optimizations (override pragmas) */
#define GLSL_UNIFORMS 0x10 /**< Print glUniform calls */
#define GLSL_NOP_VERT 0x20 /**< Force no-op vertex shaders */
#define GLSL_NOP_FRAG 0x40 /**< Force no-op fragment shaders */
/**
+4
View File
@@ -380,6 +380,10 @@ 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"))
+10
View File
@@ -2814,6 +2814,16 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
(ctx->Shader.Flags & GLSL_NO_OPT) == 0) {
_mesa_optimize_program(ctx, shader->Program);
}
if ((ctx->Shader.Flags & GLSL_NOP_VERT) &&
shader->Program->Target == GL_VERTEX_PROGRAM_ARB) {
_mesa_nop_vertex_program(ctx,
(struct gl_vertex_program *) shader->Program);
}
if ((ctx->Shader.Flags & GLSL_NOP_FRAG) &&
shader->Program->Target == GL_FRAGMENT_PROGRAM_ARB) {
_mesa_nop_fragment_program(ctx,
(struct gl_fragment_program *) shader->Program);
}
}
if (ctx->Shader.Flags & GLSL_LOG) {