logoalt Hacker News

pkaleryesterday at 6:58 PM1 replyview on HN

SIMD and data locality. You probably want to check across three vectors simultaneously and load the coordinates next to each other.

I'm guessing here. I haven't written video games in 20 years but struct packing/alignment was super important on the Sony PSP back then.


Replies

shihabyesterday at 7:57 PM

For SIMD at least, the {mins[3], maxs[3]} representation aligns more naturally with actual instructions on x86. To compute a new bounding box:

new_box.mins = _mm_min_ps(a.mins[3], b.mins[3]);

show 2 replies