Tapani Pälli <tapani.pa...@intel.com> writes:

> From: Kalyan Kondapally <kalyan.kondapa...@intel.com>
>
> Dynamic indexing of sampler arrays is prohibited by GLSL ES 3.00.
> Earlier versions allow 'constant-index-expression' indexing, where
> index can contain a loop induction variable.
>
> Patch allows dynamic indexing for sampler arrays when GLSL ES < 3.00.
> This change makes 'sampler-array-index.frag' parser test in Piglit
> pass + fishgl.com works when running Chrome on OpenGL ES 2.0 backend.
>
> v2: small change and some more commit message (Tapani)
>
> Signed-off-by: Kalyan Kondapally <kalyan.kondapa...@intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84225

Looks good, but did you check what happens now if the shader uses actual
variable indexing (i.e. which lowering cannot turn into a constant) on
an implementation that doesn't support it?  Hopefully no crashes or
hangs?

> ---
>  src/glsl/ast_array_index.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp
> index ecef651..b2609b6 100644
> --- a/src/glsl/ast_array_index.cpp
> +++ b/src/glsl/ast_array_index.cpp
> @@ -226,7 +226,7 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
>         * dynamically uniform expression is undefined.
>         */
>        if (array->type->element_type()->is_sampler()) {
> -      if (!state->is_version(130, 100)) {
> +      if (!state->is_version(130, 300)) {
>           if (state->es_shader) {
>              _mesa_glsl_warning(&loc, state,
>                                 "sampler arrays indexed with non-constant "
> -- 
> 2.1.0

Attachment: signature.asc
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to