summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glsl/loop_unroll.cpp12
-rw-r--r--src/mesa/main/mtypes.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/glsl/loop_unroll.cpp b/src/glsl/loop_unroll.cpp
index 635e1dd99cd..7a00fb8fea8 100644
--- a/src/glsl/loop_unroll.cpp
+++ b/src/glsl/loop_unroll.cpp
@@ -100,6 +100,18 @@ public:
virtual ir_visitor_status visit_enter(ir_dereference_array *ir)
{
+ /* Force unroll in case of dynamic indexing with sampler arrays
+ * when EmitNoIndirectSampler is set.
+ */
+ if (options->EmitNoIndirectSampler) {
+ if ((ir->array->type->is_array() &&
+ ir->array->type->contains_sampler()) &&
+ !ir->array_index->constant_expression_value()) {
+ unsupported_variable_indexing = true;
+ return visit_continue;
+ }
+ }
+
/* Check for arrays variably-indexed by a loop induction variable.
* Unrolling the loop may convert that access into constant-indexing.
*
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 983b9dc307b..7b55677de30 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2881,6 +2881,7 @@ struct gl_shader_compiler_options
GLboolean EmitNoIndirectOutput; /**< No indirect addressing of outputs */
GLboolean EmitNoIndirectTemp; /**< No indirect addressing of temps */
GLboolean EmitNoIndirectUniform; /**< No indirect addressing of constants */
+ GLboolean EmitNoIndirectSampler; /**< No indirect addressing of samplers */
/*@}*/
GLuint MaxIfDepth; /**< Maximum nested IF blocks */