From 97d5bc7de3c2e5554367dc27a7c03227074e9029 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 13 Jan 2021 15:48:36 -0800 Subject: [PATCH] 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 Part-of: --- 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);