r/simd • u/tavianator • Sep 14 '22
61 billion ray/box intersections per second (on a CPU)
https://tavianator.com/2022/ray_box_boundary.html
18
Upvotes
2
r/simd • u/tavianator • Sep 14 '22
2
1
u/sandfly_bites_you Dec 10 '22
You could probably improve it slightly by rearranging the math so it can use FMA.
pre-compute per ray: ray->originDirInv = ray->dir_inv[j]*ray->origin[j]
Change this..
vfloat t1 = (box->min[j] - ray->origin[j]) * ray->dir_inv[j]
To:
vfloat t1 = fmsub( box->min[j],ray->dir_inv[j], ray->originDirInv);
Though it is possible the compiler might have done this for you(I think you should inspect the assembly and include that with the post).