On Sat, Aug 9, 2014 at 7:14 PM, Chris Forbes <chr...@ijw.co.nz> wrote: > Signed-off-by: Chris Forbes <chr...@ijw.co.nz> > --- > src/glsl/ast_array_index.cpp | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp > index 50f9987..f8dca80 100644 > --- a/src/glsl/ast_array_index.cpp > +++ b/src/glsl/ast_array_index.cpp > @@ -213,6 +213,9 @@ _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. > */ > if (array->type->element_type()->is_sampler()) { > if (!state->is_version(130, 100)) { > @@ -227,7 +230,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 " > --
I was initially confused, expecting a check that the index is a uniform. But all that's required is that it's a uniform *expression*, which is much more difficult to determine. And the spec says that non-uniform expressions just yield undefined results. Maybe extend the comment to note that, but maybe don't worry about it. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev