summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-09-16 14:40:26 +0200
committerIan Romanick <ian.d.romanick@intel.com>2010-09-17 11:00:24 +0200
commita6ecd1c3724a78b76ab9e81ea39632f1279021f8 (patch)
treecc42484babe94e40d020f04f4c0082da98027540 /src/mesa
parent6e4fe39da26bf101f5fe1103ba426c0903445352 (diff)
glsl2: Add flags to enable variable index lowering
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c7
-rw-r--r--src/mesa/main/mtypes.h10
-rw-r--r--src/mesa/program/ir_to_mesa.cpp13
3 files changed, 30 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index de78400d42..d08538ec20 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -116,6 +116,13 @@ GLboolean brwCreateContext( int api,
ctx->ShaderCompilerOptions[i].EmitNVTempInitialization = GL_TRUE;
ctx->ShaderCompilerOptions[i].EmitNoNoise = GL_TRUE;
ctx->ShaderCompilerOptions[i].EmitNoMainReturn = GL_TRUE;
+ ctx->ShaderCompilerOptions[i].EmitNoIndirectInput = GL_TRUE;
+ ctx->ShaderCompilerOptions[i].EmitNoIndirectOutput = GL_TRUE;
+
+ ctx->ShaderCompilerOptions[i].EmitNoIndirectUniform =
+ (i == MESA_SHADER_FRAGMENT);
+ ctx->ShaderCompilerOptions[i].EmitNoIndirectTemp =
+ (i == MESA_SHADER_FRAGMENT);
}
ctx->Const.VertexProgram.MaxNativeInstructions = (16 * 1024);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 864805af0e..fdf8100c8c 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2191,6 +2191,16 @@ struct gl_shader_compiler_options
GLboolean EmitNoMainReturn; /**< Emit CONT/RET opcodes? */
GLboolean EmitNoNoise; /**< Emit NOISE opcodes? */
+ /**
+ * \name Forms of indirect addressing the driver cannot do.
+ */
+ /*@{*/
+ GLboolean EmitNoIndirectInput; /**< No indirect addressing of inputs */
+ GLboolean EmitNoIndirectOutput; /**< No indirect addressing of outputs */
+ GLboolean EmitNoIndirectTemp; /**< No indirect addressing of temps */
+ GLboolean EmitNoIndirectUniform; /**< No indirect addressing of constants */
+ /*@}*/
+
GLuint MaxUnrollIterations;
struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 227dfdbd50..29b92821f6 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2745,6 +2745,19 @@ _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog)
if (options->EmitNoNoise)
progress = lower_noise(ir) || progress;
+ /* If there are forms of indirect addressing that the driver
+ * cannot handle, perform the lowering pass.
+ */
+ if (options->EmitNoIndirectInput || options->EmitNoIndirectOutput
+ || options->EmitNoIndirectTemp || options->EmitNoIndirectUniform)
+ progress =
+ lower_variable_index_to_cond_assign(ir,
+ options->EmitNoIndirectInput,
+ options->EmitNoIndirectOutput,
+ options->EmitNoIndirectTemp,
+ options->EmitNoIndirectUniform)
+ || progress;
+
progress = do_vec_index_to_cond_assign(ir) || progress;
} while (progress);