From 479a849ad606482c3cf67157b77af94ecd450ace Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Mon, 13 Aug 2018 18:57:38 +0300 Subject: [PATCH] glsl: Avoid calling get_array_element for scalar constants MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Tapani Pälli --- 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 4a0aff72c6f..c9788c70535 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); } -- 2.30.2