mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-09-07 16:09:09 +01:00
gl_shader_decompiler: Let OpenGL interpret floats.
- Accuracy is lost in translation to string, e.g. with NaN. - Needed for Super Mario Odyssey.
This commit is contained in:
parent
4fa3511a63
commit
e542356d0c
2 changed files with 6 additions and 11 deletions
|
@ -254,20 +254,15 @@ union Instruction {
|
|||
BitField<56, 1, u64> invert_b;
|
||||
} lop32i;
|
||||
|
||||
float GetImm20_19() const {
|
||||
float result{};
|
||||
u32 GetImm20_19() const {
|
||||
u32 imm{static_cast<u32>(imm20_19)};
|
||||
imm <<= 12;
|
||||
imm |= negate_imm ? 0x80000000 : 0;
|
||||
std::memcpy(&result, &imm, sizeof(imm));
|
||||
return result;
|
||||
return imm;
|
||||
}
|
||||
|
||||
float GetImm20_32() const {
|
||||
float result{};
|
||||
s32 imm{static_cast<s32>(imm20_32)};
|
||||
std::memcpy(&result, &imm, sizeof(imm));
|
||||
return result;
|
||||
u32 GetImm20_32() const {
|
||||
return static_cast<u32>(imm20_32);
|
||||
}
|
||||
|
||||
s32 GetSignedImm20_20() const {
|
||||
|
|
|
@ -602,12 +602,12 @@ private:
|
|||
|
||||
/// Generates code representing a 19-bit immediate value
|
||||
static std::string GetImmediate19(const Instruction& instr) {
|
||||
return std::to_string(instr.alu.GetImm20_19());
|
||||
return fmt::format("uintBitsToFloat({})", instr.alu.GetImm20_19());
|
||||
}
|
||||
|
||||
/// Generates code representing a 32-bit immediate value
|
||||
static std::string GetImmediate32(const Instruction& instr) {
|
||||
return std::to_string(instr.alu.GetImm20_32());
|
||||
return fmt::format("uintBitsToFloat({})", instr.alu.GetImm20_32());
|
||||
}
|
||||
|
||||
/// Generates code representing a texture sampler.
|
||||
|
|
Loading…
Reference in a new issue