Skip to content
Snippets Groups Projects
Commit e6be6385 authored by Axel Davy's avatar Axel Davy Committed by Dylan Baker
Browse files

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: default avatarAxel Davy <davyaxel0@gmail.com>
Acked-by: default avatarDavid Heidelberg <david.heidelberg@collabora.com>
Part-of: <mesa/mesa!18021>
(cherry picked from commit b5df2056)
parent d1a556a5
No related branches found
No related tags found
No related merge requests found
......@@ -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
},
......@@ -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 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment