diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2018-06-26 16:26:46 -0700 |
---|---|---|
committer | Caio Marcelo de Oliveira Filho <[email protected]> | 2018-07-19 10:00:59 -0700 |
commit | 507a8037a731892c1b8cd6e9a8534d4a5447d5c5 (patch) | |
tree | 3cd08b945dc0122f5348ddc1fcbe4f6296bd4a20 /src/mesa/drivers/dri/i965/brw_gs_surface_state.c | |
parent | e4f32dec23af18fa24fde56776150be713fc509e (diff) |
glsl: don't let an 'if' then-branch kill copy propagation (elements) for else-branch
When handling 'if' in copy propagation elements, if a certain variable
was killed when processing the first branch of the 'if', then the
second would get any propagation from previous nodes.
x = y;
if (...) {
z = x; // This would turn into z = y.
x = 22; // x gets killed.
} else {
w = x; // This would NOT turn into w = y.
}
With the change, we let copy propagation happen independently in the
two branches and only then apply the killed values for the subsequent
code.
One example in shader-db part of shaders/unity/8.shader_test:
(assign (xyz) (var_ref col_1) (var_ref tmpvar_8) )
(if (expression bool < (swiz y (var_ref xlv_TEXCOORD0) )(constant float (0.000000)) ) (
(assign (xyz) (var_ref col_1) (expression vec3 + (var_ref tmpvar_8) ... ) ... )
)
(
(assign (xyz) (var_ref col_1) (expression vec3 lrp (var_ref col_1) ... ) ... )
))
The variable col_1 was replaced by tmpvar_8 in the then-part but not
in the else-part.
NIR deals well with copy propagation, so it already covered for the
missing ones that this patch fixes.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_gs_surface_state.c')
0 files changed, 0 insertions, 0 deletions