[Mesa-stable] [Mesa-dev] [PATCH] glsl: Avoid calling get_array_element for scalar constants

Andres Gomez agomez at igalia.com
Thu Aug 16 06:36:30 UTC 2018


Just Ccing Dylan ...

On Thu, 2018-08-16 at 07:47 +0300, Tapani Pälli wrote:
> 
> On 08/16/2018 02:21 AM, Andres Gomez wrote:
> > Danylo, should we also include this in the stable queues ?
> 
> Yep makes sense, it's simple and fixes a crasher.
> 
> > 
> > On Mon, 2018-08-13 at 18:57 +0300, Danylo Piliaiev wrote:
> > > Accessing scalar constant as an array in function call or
> > > initializer list triggered assert in get_array_element.
> > > Examples:
> > >     func(0[0]);
> > >     vec2 t = { 0[0], 0 };
> > > 
> > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107550
> > > 
> > > Signed-off-by: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
> > > ---
> > >   src/compiler/glsl/ir_constant_expression.cpp | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/src/compiler/glsl/ir_constant_expression.cpp b/src/compiler/glsl/ir_constant_expression.cpp
> > > index 4a0aff72c6..c9788c7053 100644
> > > --- a/src/compiler/glsl/ir_constant_expression.cpp
> > > +++ b/src/compiler/glsl/ir_constant_expression.cpp
> > > @@ -826,7 +826,7 @@ ir_dereference_array::constant_expression_value(void *mem_ctx,
> > >            const unsigned component = idx->value.u[0];
> > >   
> > >            return new(mem_ctx) ir_constant(array, component);
> > > -      } else {
> > > +      } else if (array->type->is_array()) {
> > >            const unsigned index = idx->value.u[0];
> > >            return array->get_array_element(index)->clone(mem_ctx, NULL);
> > >         }
> 
> _______________________________________________
> mesa-stable mailing list
> mesa-stable at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-stable
-- 
Br,

Andres


More information about the mesa-stable mailing list