diff options
author | Kenneth Graunke <[email protected]> | 2015-07-22 20:08:23 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-07-28 22:56:10 -0700 |
commit | e235ca159f5f6de2bd29616fdda5c02dc69b0d7f (patch) | |
tree | e4615b82fdf142a6202bf66c14b37200efffbe4e /src/glsl/ast_expr.cpp | |
parent | e17056f5a20beb752a530180fce1aba0e68877b6 (diff) |
glsl: Fix a bug where LHS swizzles of swizzles were too small.
A simple shader such as
vec4 color;
color.xy.x = 1.0;
would cause ir_assignment::set_lhs() to generate bogus IR:
(swiz xy (swiz x (constant float (1.0))))
We were setting the number of components of each new RHS swizzle based
on the highest channel used in the LHS swizzle. So, .xy.y would
generate (swiz xy (swiz xx ...)), while .xy.x would break.
Our existing Piglit test happened to use .xzy.z, which worked, since
'z' is the third component, resulting in an xxx swizzle.
This patch sets the number of swizzle components based on the size of
the LHS swizzle's inner value, so we always have the correct number
at each step.
Fixes new Piglit tests glsl-vs-swizzle-swizzle-lhs-[23].
Fixes ir_validate assertions in in Metro 2033 Redux.
v2: Move num_components updating completely out of update_rhs_swizzle
(suggested by Timothy Arceri). Simplify.
Cc: [email protected]
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/glsl/ast_expr.cpp')
0 files changed, 0 insertions, 0 deletions