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 <emma@anholt.net>
Reviewed-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20162>
This commit is contained in:
Ian Romanick 2022-06-14 21:57:43 -07:00 committed by Marge Bot
parent fd927737f5
commit 451df66ea0

View file

@ -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.
*/