frontend/nine: Fix ff position_t fallback when w = 0

For post-transformed vertices, w = 0 is similar to
w = 1. Replace the value to fix rcp(w).

It is common for apps to pass w = 0 for
position_t.

cc: mesa-stable

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18021>
(cherry picked from commit b5df20568a)
This commit is contained in:
Axel Davy
2022-07-28 22:55:40 +02:00
committed by Dylan Baker
parent 499a65e88d
commit 30ef443d23
2 changed files with 4 additions and 1 deletions

View File

@@ -904,7 +904,7 @@
"description": "frontend/nine: Fix ff position_t fallback when w = 0",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View File

@@ -455,6 +455,9 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
ureg_ADD(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XY), ureg_src(tmp), ureg_imm1f(ureg, -1.0f));
/* Y needs to be reversed */
ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Y), ureg_negate(ureg_src(tmp)));
/* Replace w by 1 if it equals to 0 */
ureg_CMP(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), ureg_negate(ureg_abs(ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_W))),
ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_W), ureg_imm1f(ureg, 1.0f));
/* inverse rhw */
ureg_RCP(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), _W(tmp));
/* multiply X, Y, Z by w */