diff options
author | FernandoS27 <fsahmkow27@gmail.com> | 2018-10-22 02:07:15 +0200 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2018-10-22 17:31:17 +0200 |
commit | 5c5b4e8e7d26032bf9e2e948aad3d309cca1a78a (patch) | |
tree | 8a562abe2df336679611f0bf9ed411ce0fedf207 /src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |
parent | Merge pull request #1531 from ogniK5377/hid-fixes (diff) | |
download | yuzu-5c5b4e8e7d26032bf9e2e948aad3d309cca1a78a.tar yuzu-5c5b4e8e7d26032bf9e2e948aad3d309cca1a78a.tar.gz yuzu-5c5b4e8e7d26032bf9e2e948aad3d309cca1a78a.tar.bz2 yuzu-5c5b4e8e7d26032bf9e2e948aad3d309cca1a78a.tar.lz yuzu-5c5b4e8e7d26032bf9e2e948aad3d309cca1a78a.tar.xz yuzu-5c5b4e8e7d26032bf9e2e948aad3d309cca1a78a.tar.zst yuzu-5c5b4e8e7d26032bf9e2e948aad3d309cca1a78a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index a427353e9..b0eb879cc 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -2736,20 +2736,13 @@ private: break; } case OpCode::Type::FloatSetPredicate: { - std::string op_a = instr.fsetp.neg_a ? "-" : ""; - op_a += regs.GetRegisterAsFloat(instr.gpr8); - - if (instr.fsetp.abs_a) { - op_a = "abs(" + op_a + ')'; - } + const std::string op_a = + GetOperandAbsNeg(regs.GetRegisterAsFloat(instr.gpr8), instr.fsetp.abs_a != 0, + instr.fsetp.neg_a != 0); - std::string op_b{}; + std::string op_b; if (instr.is_b_imm) { - if (instr.fsetp.neg_b) { - // Only the immediate version of fsetp has a neg_b bit. - op_b += '-'; - } op_b += '(' + GetImmediate19(instr) + ')'; } else { if (instr.is_b_gpr) { @@ -2945,33 +2938,24 @@ private: break; } case OpCode::Type::FloatSet: { - std::string op_a = instr.fset.neg_a ? "-" : ""; - op_a += regs.GetRegisterAsFloat(instr.gpr8); - - if (instr.fset.abs_a) { - op_a = "abs(" + op_a + ')'; - } + const std::string op_a = GetOperandAbsNeg(regs.GetRegisterAsFloat(instr.gpr8), + instr.fset.abs_a != 0, instr.fset.neg_a != 0); - std::string op_b = instr.fset.neg_b ? "-" : ""; + std::string op_b; if (instr.is_b_imm) { const std::string imm = GetImmediate19(instr); - if (instr.fset.neg_imm) - op_b += "(-" + imm + ')'; - else - op_b += imm; + op_b = imm; } else { if (instr.is_b_gpr) { - op_b += regs.GetRegisterAsFloat(instr.gpr20); + op_b = regs.GetRegisterAsFloat(instr.gpr20); } else { - op_b += regs.GetUniform(instr.cbuf34.index, instr.cbuf34.offset, - GLSLRegister::Type::Float); + op_b = regs.GetUniform(instr.cbuf34.index, instr.cbuf34.offset, + GLSLRegister::Type::Float); } } - if (instr.fset.abs_b) { - op_b = "abs(" + op_b + ')'; - } + op_b = GetOperandAbsNeg(op_b, instr.fset.abs_b != 0, instr.fset.neg_b != 0); // The fset instruction sets a register to 1.0 or -1 (depending on the bf bit) if the // condition is true, and to 0 otherwise. |