OSDN Git Service

glsl/opt_array_splitting: Fix crash when doing array indexing into other arrays
authorIago Toral Quiroga <itoral@igalia.com>
Thu, 3 Mar 2016 08:02:30 +0000 (09:02 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Thu, 3 Mar 2016 08:02:30 +0000 (09:02 +0100)
commit4a600024242be2b8684ab2cc215171f31db594b0
tree2640809b5122e7d8c77f09824777a64e9f69467f
parent914d4967d723c58ec073eef677237798c2dc9751
glsl/opt_array_splitting: Fix crash when doing array indexing into other arrays

When we find indirect indexing into an array, the current implementation
of the array spliiting optimization pass does not look further into the
expression tree. However, if the variable expression involves variable
indexing into other arrays, we can miss that these other arrays also have
variable indexing. If that happens, the pass will crash later on after
hitting an assertion put there to ensure that split arrays are in fact
always indexed via constants:

shader_runner: opt_array_splitting.cpp:296:
void ir_array_splitting_visitor::split_deref(ir_dereference**): Assertion `constant' failed.

This patch fixes the problem by letting the pass step into the variable
index expression to identify these cases properly.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89607
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
src/compiler/glsl/opt_array_splitting.cpp