From dccd6f495a38196ca37edeb562a0e8f0ee9600cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Sun, 7 Aug 2022 12:23:10 +0200 Subject: [PATCH] ac/nir/cull: Fix typo in bounding box culling. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bounding box culling is only viable when the W of all vertices are positive. Always accept triangles whose any W is negative. Fixes: 0d527bb1aa720bf8e5735afdf8e9b70772e1ec23 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7018 Signed-off-by: Timur Kristóf Reviewed-by: Marek Olšák Reviewed-by: Qiang Yu Part-of: --- src/amd/common/ac_nir_cull.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/common/ac_nir_cull.c b/src/amd/common/ac_nir_cull.c index 232edee282c..70f335cb766 100644 --- a/src/amd/common/ac_nir_cull.c +++ b/src/amd/common/ac_nir_cull.c @@ -157,7 +157,7 @@ ac_nir_cull_triangle(nir_builder *b, nir_ssa_def *prim_outside_view = cull_frustrum(b, bbox_min, bbox_max); nir_ssa_def *prim_invisible = cull_small_primitive(b, bbox_min, bbox_max, prim_outside_view); - accepted = nir_iand(b, nir_inot(b, prim_invisible), nir_inot(b, w_info.any_w_negative)); + accepted = nir_ior(b, nir_inot(b, prim_invisible), w_info.any_w_negative); nir_if *if_still_accepted = nir_push_if(b, accepted); { accept_func(b, state);