diff options
author | Brian Paul <[email protected]> | 2009-09-29 10:22:32 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-09-29 10:38:02 -0600 |
commit | cb0de06301cd086a02ca709917819119dc1a8fd9 (patch) | |
tree | a77293a5b5b52faf2b297643d2dc5b6590b69d88 | |
parent | c7aee65bb96df3f8e8421b5125dca84c028e9073 (diff) |
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.
-rw-r--r-- | src/mesa/main/mtypes.h | 2 | ||||
-rw-r--r-- | src/mesa/shader/shader_api.c | 4 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_compile.c | 10 |
3 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d7bf7689f3c..d0050646454 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -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 */ /** diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 178b7d0dbaf..6b19b4c46b3 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -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")) diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index c1b97c7cb70..a2708884437 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -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) { |