glsl: Fix incorrect pattern matching in ir_set_program_inouts
authorPaul Berry <stereotype441@gmail.com>
Fri, 9 Aug 2013 14:58:43 +0000 (07:58 -0700)
committerPaul Berry <stereotype441@gmail.com>
Wed, 14 Aug 2013 17:53:47 +0000 (10:53 -0700)
commit98d2498404ba69a3efc1c765b1a1885d151181ed
tree6b3fc8d02e8f845c39e0372e1f54a0464b0a52a1
parentd1ba1055d98c246d1ee9d9c14706bb9fba6a98c7
glsl: Fix incorrect pattern matching in ir_set_program_inouts

In commit 8fc41df (glsl: Modify ir_set_program_inouts to handle
geometry shaders), when attempting to pattern match the "foo" part of
expressions such as:

   foo[i][j]
   foo[i]

I incorrectly called as_dereference_variable() on the subexpression
foo[i] instead of foo.  As a result, the pattern never matched, so
ir_set_program_inouts would fall back on marking the entire variable
as used, rather than just the portion indexed by the array.

This didn't result in incorrect behaviour, but it could have resulted
in inefficiency by causing the back-end to allocate resources for
unused parts of an input or output array.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ir_set_program_inouts.cpp