diff options
author | Chris Forbes <[email protected]> | 2014-08-03 17:57:05 +1200 |
---|---|---|
committer | Chris Forbes <[email protected]> | 2014-08-12 19:17:56 +1200 |
commit | 1b4761bc27a50208dba2bc028c9835fed572e696 (patch) | |
tree | 3e2d3f56e96f305606d8918b273cc01ef01a06b9 /src/glsl/ast_array_index.cpp | |
parent | f525bd01d1430a5e33f57805f50fe4e89aa86ae8 (diff) |
glsl: Allow dynamically uniform sampler array indexing with 4.0/gs5
V2: Expand comment to explain what dynamically uniform expressions are
about.
Signed-off-by: Chris Forbes <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/glsl/ast_array_index.cpp')
-rw-r--r-- | src/glsl/ast_array_index.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp index 50f9987c8af..5ca85f6ab3f 100644 --- a/src/glsl/ast_array_index.cpp +++ b/src/glsl/ast_array_index.cpp @@ -213,6 +213,13 @@ _mesa_ast_array_index_to_hir(void *mem_ctx, * as using a loop counter as the index to an array of samplers. If the * loop in unrolled, the code should compile correctly. Instead, emit a * warning. + * + * In GLSL 4.00 / ARB_gpu_shader5, this requirement is relaxed again to allow + * indexing with dynamically uniform expressions. Note that these are not + * required to be uniforms or expressions based on them, but merely that the + * values must not diverge between shader invocations run together. If the + * values *do* diverge, then the behavior of the operation requiring a + * dynamically uniform expression is undefined. */ if (array->type->element_type()->is_sampler()) { if (!state->is_version(130, 100)) { @@ -227,7 +234,7 @@ _mesa_ast_array_index_to_hir(void *mem_ctx, "expressions will be forbidden in GLSL 1.30 " "and later"); } - } else { + } else if (!state->is_version(400, 0) && !state->ARB_gpu_shader5_enable) { _mesa_glsl_error(&loc, state, "sampler arrays indexed with non-constant " "expressions is forbidden in GLSL 1.30 and " |