Mesa (master): gallium/ntt: Work around virglrenderer UIF handling bug.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jan 8 22:47:45 UTC 2021
Module: Mesa
Branch: master
Commit: 111e4be698a1940b05c1a9d0d8b269b96be75e1d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=111e4be698a1940b05c1a9d0d8b269b96be75e1d
Author: Eric Anholt <eric at anholt.net>
Date: Wed Jan 6 16:05:59 2021 -0800
gallium/ntt: Work around virglrenderer UIF handling bug.
Until just recently ("vrend: Fix TGSI UIF/IF behavior"), virgl does "if
(any(bvec4(src0)))" instead of "if (src0.x != 0)", despite the tgsi.rst
documentation and tgsi_exec agreeing on the second form. It's harmless to
work around it, since apparently NTT was the only one to not have scalar
swizzled the if condition.
Reviewed-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8373>
---
src/gallium/auxiliary/nir/nir_to_tgsi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c
index 414bac858a2..88ba7d4bec2 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c
@@ -2137,10 +2137,13 @@ ntt_emit_block(struct ntt_compile *c, nir_block *block)
/* Set up the if condition for ntt_emit_if(), which we have to do before
* freeing up the temps (the "if" is treated as inside the block for liveness
* purposes, despite not being an instruction)
+ *
+ * Note that, while IF and UIF are supposed to look at only .x, virglrenderer
+ * looks at all of .xyzw. No harm in working around the bug.
*/
nir_if *nif = nir_block_get_following_if(block);
if (nif)
- c->if_cond = ntt_get_src(c, nif->condition);
+ c->if_cond = ureg_scalar(ntt_get_src(c, nif->condition), TGSI_SWIZZLE_X);
/* Free up any SSA temps that are unused at the end of the block. */
unsigned index;
More information about the mesa-commit
mailing list