3 ms·
A while back, I was working on a fun little video game side project which used BMI2 instructions to compute Morton codes on the critical path. Voxels were stor
by DowsingSpoon 8y ago
A while back, I was working on a fun little video game side project which used BMI2 instructions to compute Morton codes on the critical path.
Voxels were stored in a buffer sorted in Morton order. The idea was to balance performance improvements realized by increased spatial locality against the cost of computing the Morton codes. The trade-off was only worthwhile on Intel because of the use of pdep/pext in optimized encode/decode functions.
I imagine something similar would probably apply to texture lookups in a software 3D renderer.
- vardump 8y ago> I imagine something similar would probably apply to texture lookups in a software 3D renderer. Except that for a 3D rasterizer you'd probably be better off calculating Morton code for 8 pixels at once in a SIMD register and then using vpgatherdd to fetch 8 ARGB pixel values "in parallel" (in theory, in practice AVX2 gather might not be any faster than scalar loads). https://www.felixcloutier.com/x86/vpgatherdd:vpgatherqd https://www.felixcloutier.com/x86/vpgatherdd:vpgatherqd