HOLY. I just GAINZed the SHIT out of transforming by 4x4 rotation matrices, given Euler angle triplets (technically intrinsic Tait-Bryan angles, for all you math nerds)... This is for SH4ZAM, my SH4 assembly optimized fast math library for the Sega Dreamcast.
I had previously been applying these types of rotations by simply concatenating rotation matrices about the principal axes (X, Y, Z) in different orders, with one for every angle of the Euler triplet... and this was still so fast that I didn't have much incentive to gain further for quite some time.
...but I finally realized that I could actually optimize these types of rotations further, by creating single, dedicated routines, which operate entirely within the XMTRX 4x4 back-bank of floating-point registers directly, rather than round-tripping to and from memory, potentially paying a dcache stall penalty due to register spillage should pushing onto the stack cause a cache miss...
So for the price of more FPU work, and a few more total instructions, I'm basically eliminating virtually all intermediate memory accesses, by performing all of the work directly within register-space... but this price is worth it, because the extra instructions are all dual-dispatching superscalar pairs that pipeline extremely nicely...
So what are the GAINZ? This routine is now 35% faster than concatenating individual transform matrices about the X + Y + Z axes to perform the same operation... while it's a whole-ass 305-474% faster than the fastest you can do in plain C with the CGLM library! 💪
PS: OMG OMG OMG what TF is the screenshot? ...no comment. Helping Lobotomy out with his latest epic surprise port, which is a certain fighting game starring big-N characters from a certain purple cube console...
Footage coming soon of it running on the Dreamcast, once it's not running like dog shit and running out of VRAM constantly! 🤣
(10) Wirklich bemerkenswert so viele #Dreamcast Spiele präsentiert zu bekommen 🥰 Virtua Tennis 2, Power Stone 2, Shenmue, Super Runabout ... ach ja, ich sollte meine Dreamcast auch mal wieder aufbauen.