See https://github.com/hrydgard/ppsspp/pull/20902#issuecomment-3429764588 for details.
WARNING: not at all tested in actual PPSSPP, only godbolt for relevant snippet. Verification that it works would be good.
Again, this should be slightly slower than the current version, which shouldn't matter. The goal is accuracy/consistency here.
This makes SSE2 version match the (correctly-rounded)
scalar reference (which the current version doesn't:
see https://godbolt.org/z/hK5938jda).
The new implementation uses the same idea as mentioned in
https://github.com/hrydgard/ppsspp/pull/20870#issuecomment-3413134437
It may be a bit slower than current implementation (which
simply truncates?), but correctness/consistency is
probably worth it.
The difference is slight (by 1 in RGB color channels),
but observable in synthetic examples (in particular the
current implementation darkens completely opaque parts,
including `0xFFFFFFFF` -> `0xFFFEFEFE`, and, more
strikingly,`0xFF010101` -> `0xFF000000`).
This doesn't touch NEON part at all (so "vibe-coded" comment
stays for now), but it shouldn't be too hard to port.
Optimization for God of War on low-end platforms. Avoids calling a color
conversion function that's currently only SIMD-optimized on x86, so will
also benefit ARM a little bit.
We no longer support non-NEON ARM.
It's nice also to have the NEON and SSE implementations "close" to each
other, easier to port optimizations back and forth etc.