nir: fix nir_remove_unused_varyings()
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 25 Apr 2019 01:17:42 +0000 (11:17 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Thu, 25 Apr 2019 06:37:36 +0000 (16:37 +1000)
commitb155f74d7bfc9daec7794074c4f644025fbddf8b
treea4002950bbee06d002e009f153ab09a33b9588b7
parentf15409ee5539579c227fa916d410945b0516d712
nir: fix nir_remove_unused_varyings()

We were only setting the used mask for the first component of a
varying. Since the linking opts split vectors into scalars this
has mostly worked ok.

However this causes an issue where for example if we split a
struct on one side of the interface but not the other, then we
can possibly end up removing the first components on the side
that was split and then incorrectly remove the whole struct
on the other side of the varying.

With this change we simply mark all 4 components for each slot
used by a struct. We could possibly make this more fine gained
but that would require a more complex change.

This fixes a bug in Strange Brigade on RADV when tessellation
is enabled, all credit goes to Samuel Pitoiset for tracking down
the cause of the bug.

Fixes: f1eb5e639997 ("nir: add component level support to remove_unused_io_vars()")

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/compiler/nir/nir_linking_helpers.c