diff options
author | heapo <heapo3@gmail.com> | 2018-12-15 02:10:14 +0100 |
---|---|---|
committer | heapo <heapo3@gmail.com> | 2018-12-17 16:56:25 +0100 |
commit | 72599cc667046cbd588fe1c4e3e3c7b55b272e29 (patch) | |
tree | 3662b6d0ec5999c63c82aba4531ce91c3245afc9 | |
parent | Merge pull request #1899 from lioncash/state (diff) | |
download | yuzu-72599cc667046cbd588fe1c4e3e3c7b55b272e29.tar yuzu-72599cc667046cbd588fe1c4e3e3c7b55b272e29.tar.gz yuzu-72599cc667046cbd588fe1c4e3e3c7b55b272e29.tar.bz2 yuzu-72599cc667046cbd588fe1c4e3e3c7b55b272e29.tar.lz yuzu-72599cc667046cbd588fe1c4e3e3c7b55b272e29.tar.xz yuzu-72599cc667046cbd588fe1c4e3e3c7b55b272e29.tar.zst yuzu-72599cc667046cbd588fe1c4e3e3c7b55b272e29.zip |
-rw-r--r-- | src/video_core/engines/shader_bytecode.h | 2 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 24 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 5ea094e64..5198cd268 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h @@ -575,7 +575,7 @@ union Instruction { union { BitField<39, 2, u64> tab5cb8_2; - BitField<41, 3, u64> tab5c68_1; + BitField<41, 3, u64> postfactor; BitField<44, 2, u64> tab5c68_0; BitField<48, 1, u64> negate_b; } fmul; diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index a5cfa0070..bd61af463 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -1867,9 +1867,6 @@ private: UNIMPLEMENTED_IF_MSG(instr.fmul.tab5cb8_2 != 0, "FMUL tab5cb8_2({}) is not implemented", instr.fmul.tab5cb8_2.Value()); - UNIMPLEMENTED_IF_MSG(instr.fmul.tab5c68_1 != 0, - "FMUL tab5cb8_1({}) is not implemented", - instr.fmul.tab5c68_1.Value()); UNIMPLEMENTED_IF_MSG( instr.fmul.tab5c68_0 != 1, "FMUL tab5cb8_0({}) is not implemented", instr.fmul.tab5c68_0 @@ -1879,7 +1876,26 @@ private: op_b = GetOperandAbsNeg(op_b, false, instr.fmul.negate_b); - regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " * " + op_b, 1, 1, + std::string postfactor_op; + if (instr.fmul.postfactor != 0) { + s8 postfactor = static_cast<s8>(instr.fmul.postfactor); + + // postfactor encoded as 3-bit 1's complement in instruction, + // interpreted with below logic. + if (postfactor >= 4) { + postfactor = 7 - postfactor; + } else { + postfactor = 0 - postfactor; + } + + if (postfactor > 0) { + postfactor_op = " * " + std::to_string(1 << postfactor); + } else { + postfactor_op = " / " + std::to_string(1 << -postfactor); + } + } + + regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " * " + op_b + postfactor_op, 1, 1, instr.alu.saturate_d, 0, true); break; } |