diff options
author | Ian Romanick <[email protected]> | 2010-09-09 15:25:32 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-09-09 15:39:52 -0700 |
commit | 2b70dbfe091af5ae7c788e16275e1af2cb1c284c (patch) | |
tree | a871cba91b90dfba4399b9ff366b8083b11c9acf /src/mesa | |
parent | 547131ac8750acabd030972fc768705c13d19ef7 (diff) |
glsl2: Add EmitNoNoise flag, use it to remove noise opcodes
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_context.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 1 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 1 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.c | 13 | ||||
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 3 |
5 files changed, 8 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 845ec2c3c4a..450e66e0d33 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -179,6 +179,7 @@ i915CreateContext(int api, */ ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitCondCodes = GL_TRUE; ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT].EmitNoIfs = GL_TRUE; + ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT].EmitNoNoise = GL_TRUE; ctx->Const.MaxDrawBuffers = 1; diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index daa281ece46..b8283b4605b 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -114,6 +114,7 @@ GLboolean brwCreateContext( int api, for (i = 0; i <= MESA_SHADER_FRAGMENT; i++) { ctx->ShaderCompilerOptions[i].EmitCondCodes = GL_TRUE; ctx->ShaderCompilerOptions[i].EmitNVTempInitialization = GL_TRUE; + ctx->ShaderCompilerOptions[i].EmitNoNoise = GL_TRUE; } ctx->Const.VertexProgram.MaxNativeInstructions = (16 * 1024); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 96fd9141902..bcd324b4432 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2199,6 +2199,7 @@ struct gl_shader_compiler_options GLboolean EmitNoFunctions; GLboolean EmitNoCont; /**< Emit CONT opcode? */ GLboolean EmitNoMainReturn; /**< Emit CONT/RET opcodes? */ + GLboolean EmitNoNoise; /**< Emit NOISE opcodes? */ GLuint MaxUnrollIterations; diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index c32c09f8d4b..c25d2a19747 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -96,21 +96,12 @@ _mesa_init_shader_state(GLcontext *ctx) */ struct gl_shader_compiler_options options; GLuint i; - options.EmitHighLevelInstructions = GL_TRUE; - options.EmitCondCodes = GL_FALSE; - options.EmitComments = GL_FALSE; - options.EmitNoIfs = GL_FALSE; - options.EmitNoLoops = GL_FALSE; - options.EmitNoFunctions = GL_FALSE; - options.EmitNoCont = GL_FALSE; - options.EmitNoMainReturn = GL_FALSE; + + memset(&options, 0, sizeof(options)); options.MaxUnrollIterations = 32; /* Default pragma settings */ - options.DefaultPragmas.IgnoreOptimize = GL_FALSE; - options.DefaultPragmas.IgnoreDebug = GL_FALSE; options.DefaultPragmas.Optimize = GL_TRUE; - options.DefaultPragmas.Debug = GL_FALSE; for(i = 0; i < MESA_SHADER_TYPES; ++i) memcpy(&ctx->ShaderCompilerOptions[i], &options, sizeof(options)); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 7307c8506c0..6e7deae4331 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2734,6 +2734,9 @@ _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog) if (options->EmitNoIfs) progress = do_if_to_cond_assign(ir) || progress; + if (options->EmitNoNoise) + progress = lower_noise(ir) || progress; + progress = do_vec_index_to_cond_assign(ir) || progress; } while (progress); |