diff options
| author | 2018-06-18 19:55:04 -0500 | |
|---|---|---|
| committer | 2018-06-18 19:56:29 -0500 | |
| commit | 38989bef4353d57fa56a754d6e31bd7c09679f57 (patch) | |
| tree | 2370cc3282ca25c9063bb526ac94365b4a4ce99c /src | |
| parent | Merge pull request #570 from bunnei/astc (diff) | |
| download | yuzu-38989bef4353d57fa56a754d6e31bd7c09679f57.tar.gz yuzu-38989bef4353d57fa56a754d6e31bd7c09679f57.tar.xz yuzu-38989bef4353d57fa56a754d6e31bd7c09679f57.zip | |
GPU: Perform negation after absolute value in the float shader instructions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 6ec0a0742..759f68708 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -822,22 +822,25 @@ private: | |||
| 822 | 822 | ||
| 823 | switch (opcode->GetType()) { | 823 | switch (opcode->GetType()) { |
| 824 | case OpCode::Type::Arithmetic: { | 824 | case OpCode::Type::Arithmetic: { |
| 825 | std::string op_a = instr.alu.negate_a ? "-" : ""; | 825 | std::string op_a = regs.GetRegisterAsFloat(instr.gpr8); |
| 826 | op_a += regs.GetRegisterAsFloat(instr.gpr8); | ||
| 827 | if (instr.alu.abs_a) { | 826 | if (instr.alu.abs_a) { |
| 828 | op_a = "abs(" + op_a + ')'; | 827 | op_a = "abs(" + op_a + ')'; |
| 829 | } | 828 | } |
| 830 | 829 | ||
| 831 | std::string op_b = instr.alu.negate_b ? "-" : ""; | 830 | if (instr.alu.negate_a) { |
| 831 | op_a = "-(" + op_a + ')'; | ||
| 832 | } | ||
| 833 | |||
| 834 | std::string op_b; | ||
| 832 | 835 | ||
| 833 | if (instr.is_b_imm) { | 836 | if (instr.is_b_imm) { |
| 834 | op_b += GetImmediate19(instr); | 837 | op_b = GetImmediate19(instr); |
| 835 | } else { | 838 | } else { |
| 836 | if (instr.is_b_gpr) { | 839 | if (instr.is_b_gpr) { |
| 837 | op_b += regs.GetRegisterAsFloat(instr.gpr20); | 840 | op_b = regs.GetRegisterAsFloat(instr.gpr20); |
| 838 | } else { | 841 | } else { |
| 839 | op_b += regs.GetUniform(instr.cbuf34.index, instr.cbuf34.offset, | 842 | op_b = regs.GetUniform(instr.cbuf34.index, instr.cbuf34.offset, |
| 840 | GLSLRegister::Type::Float); | 843 | GLSLRegister::Type::Float); |
| 841 | } | 844 | } |
| 842 | } | 845 | } |
| 843 | 846 | ||
| @@ -845,6 +848,10 @@ private: | |||
| 845 | op_b = "abs(" + op_b + ')'; | 848 | op_b = "abs(" + op_b + ')'; |
| 846 | } | 849 | } |
| 847 | 850 | ||
| 851 | if (instr.alu.negate_b) { | ||
| 852 | op_b = "-(" + op_b + ')'; | ||
| 853 | } | ||
| 854 | |||
| 848 | switch (opcode->GetId()) { | 855 | switch (opcode->GetId()) { |
| 849 | case OpCode::Id::MOV_C: | 856 | case OpCode::Id::MOV_C: |
| 850 | case OpCode::Id::MOV_R: { | 857 | case OpCode::Id::MOV_R: { |