summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/engines/shader_bytecode.h13
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp4
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 {
254 BitField<56, 1, u64> invert_b; 254 BitField<56, 1, u64> invert_b;
255 } lop32i; 255 } lop32i;
256 256
257 float GetImm20_19() const { 257 u32 GetImm20_19() const {
258 float result{};
259 u32 imm{static_cast<u32>(imm20_19)}; 258 u32 imm{static_cast<u32>(imm20_19)};
260 imm <<= 12; 259 imm <<= 12;
261 imm |= negate_imm ? 0x80000000 : 0; 260 imm |= negate_imm ? 0x80000000 : 0;
262 std::memcpy(&result, &imm, sizeof(imm)); 261 return imm;
263 return result;
264 } 262 }
265 263
266 float GetImm20_32() const { 264 u32 GetImm20_32() const {
267 float result{}; 265 return static_cast<u32>(imm20_32);
268 s32 imm{static_cast<s32>(imm20_32)};
269 std::memcpy(&result, &imm, sizeof(imm));
270 return result;
271 } 266 }
272 267
273 s32 GetSignedImm20_20() const { 268 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:
602 602
603 /// Generates code representing a 19-bit immediate value 603 /// Generates code representing a 19-bit immediate value
604 static std::string GetImmediate19(const Instruction& instr) { 604 static std::string GetImmediate19(const Instruction& instr) {
605 return std::to_string(instr.alu.GetImm20_19()); 605 return fmt::format("uintBitsToFloat({})", instr.alu.GetImm20_19());
606 } 606 }
607 607
608 /// Generates code representing a 32-bit immediate value 608 /// Generates code representing a 32-bit immediate value
609 static std::string GetImmediate32(const Instruction& instr) { 609 static std::string GetImmediate32(const Instruction& instr) {
610 return std::to_string(instr.alu.GetImm20_32()); 610 return fmt::format("uintBitsToFloat({})", instr.alu.GetImm20_32());
611 } 611 }
612 612
613 /// Generates code representing a texture sampler. 613 /// Generates code representing a texture sampler.