diff options
author | bunnei <bunneidev@gmail.com> | 2018-08-09 01:17:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-09 01:17:01 +0200 |
commit | cf917a5e9342f53824b6fa70115b06378f10f517 (patch) | |
tree | 2f735b11c82502d1dec5397899206cefb4f68626 /src/video_core | |
parent | Merge pull request #981 from bunnei/cbuf-corrupt (diff) | |
parent | gl_shader_decompiler: Let OpenGL interpret floats. (diff) | |
download | yuzu-cf917a5e9342f53824b6fa70115b06378f10f517.tar yuzu-cf917a5e9342f53824b6fa70115b06378f10f517.tar.gz yuzu-cf917a5e9342f53824b6fa70115b06378f10f517.tar.bz2 yuzu-cf917a5e9342f53824b6fa70115b06378f10f517.tar.lz yuzu-cf917a5e9342f53824b6fa70115b06378f10f517.tar.xz yuzu-cf917a5e9342f53824b6fa70115b06378f10f517.tar.zst yuzu-cf917a5e9342f53824b6fa70115b06378f10f517.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/engines/shader_bytecode.h | 13 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 4 |
2 files changed, 6 insertions, 11 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index c7e3fb4b1..0d33c5a5e 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h @@ -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 { diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index e3217db81..1ff71d682 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -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. |