diff options
author | Paul Berry <[email protected]> | 2012-05-19 08:59:36 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2012-05-23 14:21:48 -0700 |
commit | aa173e16a07566b7549b00946840ea16ac17a380 (patch) | |
tree | 068027d556c71e1d4be41b171780a3d971d158fc /src/glsl/opt_dead_functions.cpp | |
parent | b45052b3f761deb980bcca405f25e543892a93ee (diff) |
glsl/constant propagation: kill whole var if LHS involves array indexing.
When considering which components of a variable were killed by an
assignment, constant propagation would previously just use the write
mask of the assignment. This worked if the LHS of the assignment was
simple, e.g.:
v.xy = ...; // (assign (xy) (var_ref v) ...)
But it did the wrong thing if the LHS of the assignment involved an
array indexing operator, since in this case the write mask is always
(x):
v[i] = ...; // (assign (x) (deref_array (var_ref v) (var_ref i)) ...)
In general, we can't predict which vector component will be selected
by array indexing, so the only safe thing to do in this case is to
kill the entire variable.
Fixes piglit tests {fs,vs}-vector-indexing-kills-all-channels.shader_test.
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/glsl/opt_dead_functions.cpp')
0 files changed, 0 insertions, 0 deletions