OSDN Git Service

glsl2: Add EmitNoNoise flag, use it to remove noise opcodes
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 9 Sep 2010 22:25:32 +0000 (15:25 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 9 Sep 2010 22:39:52 +0000 (15:39 -0700)
src/mesa/drivers/dri/i915/i915_context.c
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/main/mtypes.h
src/mesa/main/shaderapi.c
src/mesa/program/ir_to_mesa.cpp

index 845ec2c..450e66e 100644 (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;
 
index daa281e..b8283b4 100644 (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);
index 96fd914..bcd324b 100644 (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;
 
index c32c09f..c25d2a1 100644 (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));
index 7307c85..6e7deae 100644 (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);