From d98e5bfc97843948e4e1a0a078989a380c9a51ef Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 3 Jan 2022 06:43:48 -0800 Subject: [PATCH] softgpu: Improve usage of SSE for lighting. Gives about a 2% improvement in many places. --- GPU/Software/Lighting.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/GPU/Software/Lighting.cpp b/GPU/Software/Lighting.cpp index 5c60bd66dc..d4d7a020ee 100644 --- a/GPU/Software/Lighting.cpp +++ b/GPU/Software/Lighting.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "ppsspp_config.h" #include "Common/CPUDetect.h" #include "GPU/GPUState.h" #include "GPU/Software/Lighting.h" @@ -22,7 +23,13 @@ namespace Lighting { static inline Vec3f GetLightVec(u32 lparams[12], int light) { +#if defined(_M_SSE) && !PPSSPP_ARCH(X86) + __m128i values = _mm_loadu_si128((__m128i *)&lparams[3 * light]); + __m128i from24 = _mm_slli_epi32(values, 8); + return _mm_castsi128_ps(from24); +#else return Vec3(getFloat24(lparams[3 * light]), getFloat24(lparams[3 * light + 1]), getFloat24(lparams[3 * light + 2])); +#endif } static inline float pspLightPow(float v, float e) {