Browse Source

glsl2: Add EmitNoNoise flag, use it to remove noise opcodes

tags/mesa-7.9-rc1
Ian Romanick 15 years ago
parent
commit
2b70dbfe09

+ 1
- 0
src/mesa/drivers/dri/i915/i915_context.c View File

@@ -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;


+ 1
- 0
src/mesa/drivers/dri/i965/brw_context.c View File

@@ -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);

+ 1
- 0
src/mesa/main/mtypes.h View File

@@ -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;


+ 2
- 11
src/mesa/main/shaderapi.c View File

@@ -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));

+ 3
- 0
src/mesa/program/ir_to_mesa.cpp View File

@@ -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);


Loading…
Cancel
Save