Module: Mesa Branch: main Commit: 451df66ea03689c3f119dc5c700d19933444e9c4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=451df66ea03689c3f119dc5c700d19933444e9c4
Author: Ian Romanick <[email protected]> Date: Tue Jun 14 21:57:43 2022 -0700 ntt: Add support for fcsel_gt and fcsel_ge opcodes 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 <[email protected]> Reviewed-by: Pavel Ondračka <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20162> --- 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. */
