Compat: Remove single/double sincos path.

New implementation should work for both cases.
This commit is contained in:
Unknown W. Brackets committed 2021-04-25 07:09:50 -07:00
1 parent ad876f06f3
commit 07cb37c2c1
8 files changed
+12 -77

No files matched your search

-1
View File
@@ -75,7 +75,6 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
CheckSetting(iniFile, gameID, "MemstickFixedFree", &flags_.MemstickFixedFree);
CheckSetting(iniFile, gameID, "DateLimited", &flags_.DateLimited);
CheckSetting(iniFile, gameID, "ReinterpretFramebuffers", &flags_.ReinterpretFramebuffers);
CheckSetting(iniFile, gameID, "DoublePrecisionSinCos", &flags_.DoublePrecisionSinCos);
CheckSetting(iniFile, gameID, "ShaderColorBitmask", &flags_.ShaderColorBitmask);
CheckSetting(iniFile, gameID, "DisableFirstFrameReadback", &flags_.DisableFirstFrameReadback);
CheckSetting(iniFile, gameID, "DisableRangeCulling", &flags_.DisableRangeCulling);
-1
View File
@@ -73,7 +73,6 @@ struct CompatFlags {
bool MemstickFixedFree;
bool DateLimited;
bool ReinterpretFramebuffers;
bool DoublePrecisionSinCos;
bool ShaderColorBitmask;
bool DisableFirstFrameReadback;
bool DisableRangeCulling;
+5 -62
View File
@@ -885,58 +885,7 @@ float vfpu_rsqrt(float a) {
return val.f;
}
float vfpu_sin_single(float angle) {
angle -= floorf(angle * 0.25f) * 4.f;
if (angle == 0.0f || angle == 2.0f) {
return 0.0f;
} else if (angle == 1.0f) {
return 1.0f;
} else if (angle == 3.0f) {
return -1.0f;
}
angle *= (float)M_PI_2;
return sinf(angle);
}
float vfpu_cos_single(float angle) {
angle -= floorf(angle * 0.25f) * 4.f;
if (angle == 1.0f || angle == 3.0f) {
return 0.0f;
} else if (angle == 0.0f) {
return 1.0f;
} else if (angle == 2.0f) {
return -1.0f;
}
angle *= (float)M_PI_2;
return cosf(angle);
}
void vfpu_sincos_single(float angle, float &sine, float &cosine) {
angle -= floorf(angle * 0.25f) * 4.f;
if (angle == 0.0f) {
sine = 0.0f;
cosine = 1.0f;
} else if (angle == 1.0f) {
sine = 1.0f;
cosine = 0.0f;
} else if (angle == 2.0f) {
sine = 0.0f;
cosine = -1.0f;
} else if (angle == 3.0f) {
sine = -1.0f;
cosine = 0.0f;
} else {
angle *= (float)M_PI_2;
#if defined(__linux__)
sincosf(angle, &sine, &cosine);
#else
sine = sinf(angle);
cosine = cosf(angle);
#endif
}
}
float vfpu_sin_mod2(float a) {
float vfpu_sin(float a) {
float2int val;
val.f = a;
@@ -980,7 +929,7 @@ float vfpu_sin_mod2(float a) {
return val.f;
}
float vfpu_cos_mod2(float a) {
float vfpu_cos(float a) {
float2int val;
val.f = a;
bool negate = false;
@@ -1025,7 +974,7 @@ float vfpu_cos_mod2(float a) {
return negate ? -val.f : val.f;
}
void vfpu_sincos_mod2(float a, float &s, float &c) {
void vfpu_sincos(float a, float &s, float &c) {
float2int val;
val.f = a;
// For sin, negate the input, for cos negate the output.
@@ -1106,12 +1055,6 @@ void vfpu_sincos_mod2(float a, float &s, float &c) {
return ;
}
float (*vfpu_sin)(float);
float (*vfpu_cos)(float);
void (*vfpu_sincos)(float, float&, float&);
void InitVFPUSinCos(bool useDoublePrecision) {
vfpu_sin = useDoublePrecision ? vfpu_sin_mod2 : vfpu_sin_single;
vfpu_cos = useDoublePrecision ? vfpu_cos_mod2 : vfpu_cos_single;
vfpu_sincos = useDoublePrecision ? vfpu_sincos_mod2 : vfpu_sincos_single;
void InitVFPUSinCos() {
// TODO: Could prepare a CORDIC table here.
}
+4 -4
View File
@@ -50,9 +50,9 @@ inline int Xpose(int v) {
//
// Messing around with the modulo functions? try https://www.desmos.com/calculator.
extern float (*vfpu_sin)(float);
extern float (*vfpu_cos)(float);
extern void (*vfpu_sincos)(float, float&, float&);
extern float vfpu_sin(float);
extern float vfpu_cos(float);
extern void vfpu_sincos(float, float&, float&);
inline float vfpu_asin(float angle) {
return asinf(angle) / M_PI_2;
@@ -215,4 +215,4 @@ int GetVectorOverlap(int reg1, VectorSize size1, int reg2, VectorSize size2);
bool GetVFPUCtrlMask(int reg, u32 *mask);
float Float16ToFloat32(unsigned short l);
void InitVFPUSinCos(bool useDoublePrecision);
void InitVFPUSinCos();
+1 -1
View File
@@ -284,7 +284,7 @@ bool CPU_Init() {
// likely to collide with any commercial ones.
coreParameter.compat.Load(g_paramSFO.GetDiscID());
InitVFPUSinCos(true);
InitVFPUSinCos();
if (allowPlugins)
HLEPlugins::Init();
-6
View File
@@ -989,12 +989,6 @@ ULJM05533 = true
NPJH50006 = true
ULES01301 = true
[DoublePrecisionSinCos]
# Hitman Reborn Battle Arena 2 (#12900)
ULJS00218 = true
# Hitman Reborn Battle Arena
ULJS00157 = true
[DisableFirstFrameReadback]
# Wipeout Pure: Temporary workaround for lens flare flicker. See #13344
UCUS98612 = true
+1 -1
View File
@@ -92,7 +92,7 @@ static void SetupJitHarness() {
Memory::Init();
mipsr4k.Reset();
CoreTiming::Init();
InitVFPUSinCos(true);
InitVFPUSinCos();
}
static void DestroyJitHarness() {
+1 -1
View File
@@ -303,7 +303,7 @@ bool TestParsers() {
bool TestVFPUSinCos() {
float sine, cosine;
InitVFPUSinCos(false);
InitVFPUSinCos();
EXPECT_FALSE(vfpu_sincos == nullptr);
vfpu_sincos(0.0f, sine, cosine);
EXPECT_EQ_FLOAT(sine, 0.0f);