diff options
author | Tapani Pälli <[email protected]> | 2015-06-09 13:33:39 +0300 |
---|---|---|
committer | Tapani Pälli <[email protected]> | 2015-06-30 11:12:43 +0300 |
commit | e4512e1581cf90f56d13cfa6a809832ef3517283 (patch) | |
tree | 2973c51b7bc7656b0b50cd92ca6b6c94bc7c7486 /src/glsl/loop_unroll.cpp | |
parent | edb8383c98ee23385731d0fc23a6b6673528a8ec (diff) |
mesa/glsl: new compiler option EmitNoIndirectSampler
Patch provides new compiler option for backend to force unroll loops
that have non-constant expression indexing on sampler arrays.
This makes sure that we can never end up with a shader that uses loop
induction variable as sampler array index but does not unroll because
of having too much instructions. This would not work without dynamic
indexing support.
v2: change option name as EmitNoIndirectSampler
Signed-off-by: Tapani Pälli <[email protected]>
Reviewed-by: Francisco Jerez <[email protected]>
Cc: "10.5" and "10.6" <[email protected]>
Diffstat (limited to 'src/glsl/loop_unroll.cpp')
-rw-r--r-- | src/glsl/loop_unroll.cpp | 12 |
1 files changed, 12 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. * |