Mesa (main): nir_to_tgsi: Force the TXQ LOD argument to be scalar.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 6 04:34:01 UTC 2021


Module: Mesa
Branch: main
Commit: 4e3e149ffdae8e3c8edd3794b162e4c528e61ad1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e3e149ffdae8e3c8edd3794b162e4c528e61ad1

Author: Emma Anholt <emma at anholt.net>
Date:   Mon Aug  2 16:17:08 2021 -0700

nir_to_tgsi: Force the TXQ LOD argument to be scalar.

Otherwise, older virglrenderer fails all the texturesize tests.

Acked-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

---

 src/gallium/auxiliary/nir/nir_to_tgsi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c
index 01bf035cf5d..50b55a6f14c 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c
@@ -2157,7 +2157,13 @@ ntt_emit_texture(struct ntt_compile *c, nir_tex_instr *instr)
    ntt_push_tex_arg(c, instr, nir_tex_src_backend2, &s);
 
    /* non-coord arg for TXQ */
-   ntt_push_tex_arg(c, instr, nir_tex_src_lod, &s);
+   if (tex_opcode == TGSI_OPCODE_TXQ) {
+      ntt_push_tex_arg(c, instr, nir_tex_src_lod, &s);
+      /* virglrenderer mistakenly looks at .w instead of .x, so make sure it's
+       * scalar
+       */
+      s.srcs[s.i - 1] = ureg_scalar(s.srcs[s.i - 1], 0);
+   }
 
    if (s.i > 1) {
       if (tex_opcode == TGSI_OPCODE_TEX)



More information about the mesa-commit mailing list