Mesa (master): gallium/ntt: Don't vectorize IBFE/UBFE/BFI.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 15 00:25:46 UTC 2021


Module: Mesa
Branch: master
Commit: 97d5bc7de3c2e5554367dc27a7c03227074e9029
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=97d5bc7de3c2e5554367dc27a7c03227074e9029

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jan 13 15:48:36 2021 -0800

gallium/ntt: Don't vectorize IBFE/UBFE/BFI.

Since our source language only allows scalar offset/bits arguments,
virglrenderer only handled scalar values too.  Just refuse to vectorize
these to prevent breakage.

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

---

 src/gallium/auxiliary/nir/nir_to_tgsi.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c
index 8a80af0a41b..6fac47b5353 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c
@@ -2215,6 +2215,22 @@ ntt_should_vectorize_instr(const nir_instr *instr, void *data)
 
    nir_alu_instr *alu = nir_instr_as_alu(instr);
 
+   switch (alu->op) {
+   case nir_op_ibitfield_extract:
+   case nir_op_ubitfield_extract:
+   case nir_op_bitfield_insert:
+      /* virglrenderer only looks at the .x channel of the offset/bits operands
+       * when translating to GLSL.  tgsi.rst doesn't seem to require scalar
+       * offset/bits operands.
+       *
+       * https://gitlab.freedesktop.org/virgl/virglrenderer/-/issues/195
+       */
+      return false;
+
+   default:
+      break;
+   }
+
    unsigned num_components = alu->dest.dest.ssa.num_components;
 
    int src_bit_size = nir_src_bit_size(alu->src[0].src);



More information about the mesa-commit mailing list