glsl: Fallback gracefully if ir_set_program_inouts sees unexpected indexing.
authorPaul Berry <stereotype441@gmail.com>
Wed, 31 Jul 2013 17:57:22 +0000 (10:57 -0700)
committerPaul Berry <stereotype441@gmail.com>
Fri, 2 Aug 2013 03:19:35 +0000 (20:19 -0700)
commit1c789d8087327203d3dcf5c140bf9d9c65b86086
tree2cd9aec625f1e9957ca8ceb982b140e5bc9cd70a
parentd5a333a06f4dd8e084666e82019dde7cb40f9643
glsl: Fallback gracefully if ir_set_program_inouts sees unexpected indexing.

The code in ir_set_program_inouts that marks just a portion of a
variable as used (rather than the whole variable) only works on a few
kinds of indexing operations:

- Indexing into matrices
- Indexing into arrays of matrices, vectors, or scalars.

Fortunately these are the only kinds of indexing operations that we
expect to see; everything else is either handled by a
previously-executed lowering pass or prohibited by GLSL.

However, that could conceivably change in the future (the GLSL rules
might change, or we might modify the lowering passes).  To avoid
mysterious bugs in the future, let's have ir_set_program_inouts report
an assertion failure if it ever encounters an unexpected kind of
indexing operation (and in release builds, fall back to just marking
the whole variable as used).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ir_set_program_inouts.cpp