mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-10-23 18:03:31 -05:00
PowerPC: Set host CPU rounding mode on init and savestate
Not doing this can cause desyncs when TASing. (I don't know how common such desyncs would be, though. For games that don't change rounding modes, they shouldn't be a problem.)
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HW/CPU.h"
|
||||
#include "Core/HW/SystemTimers.h"
|
||||
@@ -129,6 +130,7 @@ void DoState(PointerWrap& p)
|
||||
|
||||
if (p.GetMode() == PointerWrap::MODE_READ)
|
||||
{
|
||||
RoundingModeUpdated();
|
||||
IBATUpdated();
|
||||
DBATUpdated();
|
||||
}
|
||||
@@ -180,6 +182,7 @@ static void ResetRegisters()
|
||||
}
|
||||
SetXER({});
|
||||
|
||||
RoundingModeUpdated();
|
||||
DBATUpdated();
|
||||
IBATUpdated();
|
||||
|
||||
@@ -246,10 +249,6 @@ CPUCore DefaultCPUCore()
|
||||
|
||||
void Init(CPUCore cpu_core)
|
||||
{
|
||||
// NOTE: This function runs on EmuThread, not the CPU Thread.
|
||||
// Changing the rounding mode has a limited effect.
|
||||
FPURoundMode::SetPrecisionMode(FPURoundMode::PREC_53);
|
||||
|
||||
s_invalidate_cache_thread_safe =
|
||||
CoreTiming::RegisterEvent("invalidateEmulatedCache", InvalidateCacheThreadSafe);
|
||||
|
||||
@@ -632,4 +631,13 @@ void UpdateFPRF(double dvalue)
|
||||
FPSCR.FPRF = Common::ClassifyDouble(dvalue);
|
||||
}
|
||||
|
||||
void RoundingModeUpdated()
|
||||
{
|
||||
// The rounding mode is separate for each thread, so this must run on the CPU thread
|
||||
ASSERT(Core::IsCPUThread());
|
||||
|
||||
FPURoundMode::SetRoundMode(FPSCR.RN);
|
||||
FPURoundMode::SetSIMDMode(FPSCR.RN, FPSCR.NI);
|
||||
}
|
||||
|
||||
} // namespace PowerPC
|
||||
|
||||
Reference in New Issue
Block a user