nir_to_tgsi: Make !native_integers front face input match glsl_to_tgsi.

Avoids regression on r300, which has 0.0 vs 1.0 frontface despite what
tgsi.rst says.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14096>
This commit is contained in:
Emma Anholt 2021-12-07 15:12:14 -08:00 committed by Marge Bot
parent f1647525ab
commit 495a4cfbc3

View file

@ -374,8 +374,21 @@ ntt_setup_inputs(struct ntt_compile *c)
if (semantic_name == TGSI_SEMANTIC_FACE) {
struct ureg_dst temp = ureg_DECL_temporary(c->ureg);
/* NIR is ~0 front and 0 back, while TGSI is +1 front */
ureg_SGE(c->ureg, temp, decl, ureg_imm1f(c->ureg, 0));
if (c->native_integers) {
/* NIR is ~0 front and 0 back, while TGSI is +1 front */
ureg_SGE(c->ureg, temp, decl, ureg_imm1f(c->ureg, 0));
} else {
/* tgsi docs say that floating point FACE will be positive for
* frontface and negative for backface, but realistically
* GLSL-to-TGSI had been doing MOV_SAT to turn it into 0.0 vs 1.0.
* Copy that behavior, since some drivers (r300) have been doing a
* 0.0 vs 1.0 backface (and I don't think anybody has a non-1.0
* front face).
*/
temp.Saturate = true;
ureg_MOV(c->ureg, temp, decl);
}
decl = ureg_src(temp);
}