Mesa (main): radv: Fix the t comparison for triangles

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 29 00:57:29 UTC 2022


Module: Mesa
Branch: main
Commit: 9196fd3e1f551328f2d47a18471aa4fcbffee683
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9196fd3e1f551328f2d47a18471aa4fcbffee683

Author: Konstantin Seurer <konstantin.seurer at gmail.com>
Date:   Sat Jun 18 12:22:01 2022 +0200

radv: Fix the t comparison for triangles

The accept range is defined like this:
Triangles: tmin < t < tmax
AABBs: tmin <= t <= tmax

(See https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#ray-intersection-candidate-determination)

Signed-off-by: Konstantin Seurer <konstantin.seurer at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17123>

---

 src/amd/vulkan/radv_pipeline_rt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c
index 8631006992a..8994a7350c8 100644
--- a/src/amd/vulkan/radv_pipeline_rt.c
+++ b/src/amd/vulkan/radv_pipeline_rt.c
@@ -1160,8 +1160,8 @@ insert_traversal_triangle_case(struct radv_device *device,
                      0)));
 
    nir_push_if(b, nir_iand(b,
-                           nir_iand(b, nir_fge(b, nir_load_var(b, vars->tmax), dist),
-                                    nir_fge(b, dist, nir_load_var(b, vars->tmin))),
+                           nir_iand(b, nir_flt(b, dist, nir_load_var(b, vars->tmax)),
+                                    nir_flt(b, nir_load_var(b, vars->tmin), dist)),
                            not_cull));
    {
 



More information about the mesa-commit mailing list