Huge FPU refactor. Thanks ares ❤️
This commit is contained in:
@@ -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!
|
This list will probably grow with time!
|
||||||
|
|
||||||
## Special thanks:
|
## 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:
|
- [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:
|
- [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/),
|
- [Kelpsy](https://github.com/kelpsyberry), [fleroviux](https://github.com/fleroviux), [Kim-Dewelski](https://github.com/Kim-Dewelski), [Peach](https://github.com/wheremyfoodat/),
|
||||||
|
|||||||
@@ -89,35 +89,45 @@ struct JIT;
|
|||||||
struct Registers;
|
struct Registers;
|
||||||
|
|
||||||
struct Cop1 {
|
struct Cop1 {
|
||||||
#define CheckFPUUsable_PreserveCause() do { if(!regs.cop0.status.cu1) { regs.cop0.FireException(ExceptionCode::CoprocessorUnusable, 1, regs.oldPC); return; } } while(0)
|
explicit Cop1(Registers&);
|
||||||
#define CheckFPUUsable() do { CheckFPUUsable_PreserveCause(); fcr31.cause = 0; } while(0)
|
|
||||||
Cop1(Registers&);
|
|
||||||
u32 fcr0{};
|
u32 fcr0{};
|
||||||
FCR31 fcr31{};
|
FCR31 fcr31{};
|
||||||
FloatingPointReg fgr[32]{};
|
FloatingPointReg fgr[32]{};
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
template <class T> // either JIT or Interpreter
|
template <class T> // either JIT or Interpreter
|
||||||
void decode(T&, u32);
|
void decode(T&, u32);
|
||||||
friend struct Interpreter;
|
friend struct Interpreter;
|
||||||
|
|
||||||
|
bool CheckFPUException();
|
||||||
bool FireException();
|
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>
|
template <typename T>
|
||||||
void SetCauseOnResult(T& d);
|
bool CheckCVTArg(float &f);
|
||||||
|
template <typename T>
|
||||||
|
bool CheckCVTArg(double &f);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void SetCauseByArg(T f);
|
void SetCauseByArg(T f);
|
||||||
template <typename T>
|
template <bool cvt = false>
|
||||||
void SetCauseByArgLCVT(T f);
|
bool TestExceptions();
|
||||||
template <typename T>
|
bool SetCauseUnimplemented();
|
||||||
void SetCauseByArgWCVT(T f);
|
bool SetCauseUnderflow();
|
||||||
void SetCauseRaised(int);
|
bool SetCauseInexact();
|
||||||
void SetCauseRaisedCVT(int);
|
bool SetCauseDivisionByZero();
|
||||||
void SetCauseUnimplemented();
|
bool SetCauseOverflow();
|
||||||
void SetCauseUnderflow();
|
bool SetCauseInvalid();
|
||||||
void SetCauseInexact();
|
|
||||||
void SetCauseDivisionByZero();
|
|
||||||
void SetCauseOverflow();
|
|
||||||
void SetCauseInvalid();
|
|
||||||
private:
|
private:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
auto FGR_T(Cop0Status&, u32) -> T&;
|
auto FGR_T(Cop0Status&, u32) -> T&;
|
||||||
@@ -137,7 +147,7 @@ private:
|
|||||||
void ceilws(u32 instr);
|
void ceilws(u32 instr);
|
||||||
void ceilld(u32 instr);
|
void ceilld(u32 instr);
|
||||||
void ceilwd(u32 instr);
|
void ceilwd(u32 instr);
|
||||||
void cfc1(u32 instr) const;
|
void cfc1(u32 instr);
|
||||||
void ctc1(u32 instr);
|
void ctc1(u32 instr);
|
||||||
void unimplemented();
|
void unimplemented();
|
||||||
void roundls(u32 instr);
|
void roundls(u32 instr);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user