summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-06-19 02:55:04 +0200
committerSubv <subv2112@gmail.com>2018-06-19 02:56:29 +0200
commit38989bef4353d57fa56a754d6e31bd7c09679f57 (patch)
tree2370cc3282ca25c9063bb526ac94365b4a4ce99c /src
parentMerge pull request #570 from bunnei/astc (diff)
downloadyuzu-38989bef4353d57fa56a754d6e31bd7c09679f57.tar
yuzu-38989bef4353d57fa56a754d6e31bd7c09679f57.tar.gz
yuzu-38989bef4353d57fa56a754d6e31bd7c09679f57.tar.bz2
yuzu-38989bef4353d57fa56a754d6e31bd7c09679f57.tar.lz
yuzu-38989bef4353d57fa56a754d6e31bd7c09679f57.tar.xz
yuzu-38989bef4353d57fa56a754d6e31bd7c09679f57.tar.zst
yuzu-38989bef4353d57fa56a754d6e31bd7c09679f57.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp21
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:
switch (opcode->GetType()) {
case OpCode::Type::Arithmetic: {
- std::string op_a = instr.alu.negate_a ? "-" : "";
- op_a += regs.GetRegisterAsFloat(instr.gpr8);
+ std::string op_a = regs.GetRegisterAsFloat(instr.gpr8);
if (instr.alu.abs_a) {
op_a = "abs(" + op_a + ')';
}
- std::string op_b = instr.alu.negate_b ? "-" : "";
+ if (instr.alu.negate_a) {
+ op_a = "-(" + op_a + ')';
+ }
+
+ std::string op_b;
if (instr.is_b_imm) {
- op_b += GetImmediate19(instr);
+ op_b = GetImmediate19(instr);
} 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);
}
}
@@ -845,6 +848,10 @@ private:
op_b = "abs(" + op_b + ')';
}
+ if (instr.alu.negate_b) {
+ op_b = "-(" + op_b + ')';
+ }
+
switch (opcode->GetId()) {
case OpCode::Id::MOV_C:
case OpCode::Id::MOV_R: {