nir_to_tgsi: Don't vectorize 64-bit instructions, to keep virgl happy.

virglrenderer makes invalid shaders when faced with vector 64-bit
instructions, which GLSL-to-TGSI never produced.  While this doesn't fix
everything, it does get more tests running, and virgl probably the primary
consumer of 64-bit TGSI.  virgl may be deprecating its host 64-bit
support, at which point we can drop this workaround.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15014>
This commit is contained in:
Emma Anholt 2021-10-08 11:51:48 -07:00 committed by Marge Bot
parent 036d7172c2
commit eaf6e3d3af

View file

@ -2990,14 +2990,18 @@ ntt_should_vectorize_instr(const nir_instr *instr, void *data)
break;
}
unsigned num_components = alu->dest.dest.ssa.num_components;
int src_bit_size = nir_src_bit_size(alu->src[0].src);
int dst_bit_size = nir_dest_bit_size(alu->dest.dest);
if (src_bit_size == 64 || dst_bit_size == 64) {
if (num_components > 1)
return false;
/* Avoid vectorizing 64-bit instructions at all. Despite tgsi.rst
* claiming support, virglrenderer generates bad shaders on the host when
* presented with them. Maybe we can make virgl avoid tickling the
* virglrenderer bugs, but given that glsl-to-TGSI didn't generate vector
* 64-bit instrs in the first place, I don't see much reason to care about
* this.
*/
return false;
}
return true;