Huge FPU refactor. Thanks ares ❤️

This commit is contained in:
SimoneN64
2024-06-23 23:00:48 +02:00
parent e957029c50
commit b6385684bc
3 changed files with 605 additions and 514 deletions

View File

@@ -69,7 +69,7 @@ Your GPU needs to support Vulkan 1.1+, because the RDP is implemented via [ParaL
This list will probably grow with time!
## Special thanks:
- [ares](https://github.com/ares-emulator/ares) for being the cleanest and most accurate Nintendo 64 emulator out there. It served as a reference time and time again. Especially regarding FPU accuracy.
- [Dillonb](https://github.com/Dillonb) and [KieronJ](https://github.com/KieronJ) for bearing with me and my recurring brainfarts, and for the support :heart:
- [WhoBrokeTheBuild](https://github.com/WhoBrokeTheBuild) for the shader that allows letterboxing :rocket:
- [Kelpsy](https://github.com/kelpsyberry), [fleroviux](https://github.com/fleroviux), [Kim-Dewelski](https://github.com/Kim-Dewelski), [Peach](https://github.com/wheremyfoodat/),

View File

@@ -89,35 +89,45 @@ struct JIT;
struct Registers;
struct Cop1 {
#define CheckFPUUsable_PreserveCause() do { if(!regs.cop0.status.cu1) { regs.cop0.FireException(ExceptionCode::CoprocessorUnusable, 1, regs.oldPC); return; } } while(0)
#define CheckFPUUsable() do { CheckFPUUsable_PreserveCause(); fcr31.cause = 0; } while(0)
Cop1(Registers&);
explicit Cop1(Registers&);
u32 fcr0{};
FCR31 fcr31{};
FloatingPointReg fgr[32]{};
void Reset();
template <class T> // either JIT or Interpreter
void decode(T&, u32);
friend struct Interpreter;
bool CheckFPUException();
bool FireException();
template <bool preserveCause = false>
bool CheckFPUUsable();
template <typename T>
bool CheckResult(T&);
template <typename T>
bool CheckArg(T&);
template <typename T>
bool CheckArgs(T&, T&);
template<typename T, bool quiet, bool cf>
bool XORDERED(T fs, T ft);
template <typename T>
void SetCauseOnResult(T& d);
bool CheckCVTArg(float &f);
template <typename T>
bool CheckCVTArg(double &f);
template <typename T>
void SetCauseByArg(T f);
template <typename T>
void SetCauseByArgLCVT(T f);
template <typename T>
void SetCauseByArgWCVT(T f);
void SetCauseRaised(int);
void SetCauseRaisedCVT(int);
void SetCauseUnimplemented();
void SetCauseUnderflow();
void SetCauseInexact();
void SetCauseDivisionByZero();
void SetCauseOverflow();
void SetCauseInvalid();
template <bool cvt = false>
bool TestExceptions();
bool SetCauseUnimplemented();
bool SetCauseUnderflow();
bool SetCauseInexact();
bool SetCauseDivisionByZero();
bool SetCauseOverflow();
bool SetCauseInvalid();
private:
template <typename T>
auto FGR_T(Cop0Status&, u32) -> T&;
@@ -137,7 +147,7 @@ private:
void ceilws(u32 instr);
void ceilld(u32 instr);
void ceilwd(u32 instr);
void cfc1(u32 instr) const;
void cfc1(u32 instr);
void ctc1(u32 instr);
void unimplemented();
void roundls(u32 instr);

File diff suppressed because it is too large Load Diff