From 451df66ea03689c3f119dc5c700d19933444e9c4 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 14 Jun 2022 21:57:43 -0700 Subject: [PATCH] ntt: Add support for fcsel_gt and fcsel_ge opcodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These match the TGSI CMP opcode very nicely. Every driver that uses NTT for its fragment shader path should be able to enable these opcodes now. Reviewed-by: Emma Anholt Reviewed-by: Pavel Ondračka Part-of: --- src/gallium/auxiliary/nir/nir_to_tgsi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c index bcf0fa94faf..f3d69c09ed0 100644 --- a/src/gallium/auxiliary/nir/nir_to_tgsi.c +++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c @@ -1667,6 +1667,25 @@ ntt_emit_alu(struct ntt_compile *c, nir_alu_instr *instr) } break; + case nir_op_fcsel_gt: + /* If CMP isn't supported, then the flags that enable NIR to generate + * these opcodes should also not be set. + */ + assert(!c->options->lower_cmp); + + ntt_CMP(c, dst, ureg_negate(src[0]), src[1], src[2]); + break; + + case nir_op_fcsel_ge: + /* If CMP isn't supported, then the flags that enable NIR to generate + * these opcodes should also not be set. + */ + assert(!c->options->lower_cmp); + + /* Implement this as if !(src0 < 0.0) was identical to src0 >= 0.0. */ + ntt_CMP(c, dst, src[0], src[2], src[1]); + break; + /* It would be nice if we could get this left as scalar in NIR, since * the TGSI op is scalar. */