summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-06-03 12:05:26 -0400
committerGravatar GitHub2018-06-03 12:05:26 -0400
commit27c0f9e02dc3ebff9a82a9d9c7a6c6cf80a16316 (patch)
tree82f2c9aacfb30b88fc1f6aa9fa30597ad799ac8c /src
parentMerge pull request #484 from mailwl/nvhost-nvdec (diff)
parentgl_shader_decompiler: Implement RRO as a register move. (diff)
downloadyuzu-27c0f9e02dc3ebff9a82a9d9c7a6c6cf80a16316.tar.gz
yuzu-27c0f9e02dc3ebff9a82a9d9c7a6c6cf80a16316.tar.xz
yuzu-27c0f9e02dc3ebff9a82a9d9c7a6c6cf80a16316.zip
Merge pull request #495 from bunnei/improve-rro
gl_shader_decompiler: Implement RRO as a register move.
Diffstat (limited to '')
-rw-r--r--src/video_core/engines/shader_bytecode.h10
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp17
2 files changed, 18 insertions, 9 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index f32a17057..26c891356 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -297,8 +297,10 @@ public:
297 FMUL_R, 297 FMUL_R,
298 FMUL_IMM, 298 FMUL_IMM,
299 FMUL32_IMM, 299 FMUL32_IMM,
300 MUFU, // Multi-Function Operator 300 MUFU, // Multi-Function Operator
301 RRO, // Range Reduction Operator 301 RRO_C, // Range Reduction Operator
302 RRO_R,
303 RRO_IMM,
302 F2F_C, 304 F2F_C,
303 F2F_R, 305 F2F_R,
304 F2F_IMM, 306 F2F_IMM,
@@ -459,7 +461,9 @@ private:
459 INST("0011100-01101---", Id::FMUL_IMM, Type::Arithmetic, "FMUL_IMM"), 461 INST("0011100-01101---", Id::FMUL_IMM, Type::Arithmetic, "FMUL_IMM"),
460 INST("00011110--------", Id::FMUL32_IMM, Type::Arithmetic, "FMUL32_IMM"), 462 INST("00011110--------", Id::FMUL32_IMM, Type::Arithmetic, "FMUL32_IMM"),
461 INST("0101000010000---", Id::MUFU, Type::Arithmetic, "MUFU"), 463 INST("0101000010000---", Id::MUFU, Type::Arithmetic, "MUFU"),
462 INST("0101110010010---", Id::RRO, Type::Arithmetic, "RRO"), 464 INST("0100110010010---", Id::RRO_C, Type::Arithmetic, "RRO_C"),
465 INST("0101110010010---", Id::RRO_R, Type::Arithmetic, "RRO_R"),
466 INST("0011100-10010---", Id::RRO_IMM, Type::Arithmetic, "RRO_IMM"),
463 INST("0100110010101---", Id::F2F_C, Type::Conversion, "F2F_C"), 467 INST("0100110010101---", Id::F2F_C, Type::Conversion, "F2F_C"),
464 INST("0101110010101---", Id::F2F_R, Type::Conversion, "F2F_R"), 468 INST("0101110010101---", Id::F2F_R, Type::Conversion, "F2F_R"),
465 INST("0011100-10101---", Id::F2F_IMM, Type::Conversion, "F2F_IMM"), 469 INST("0011100-10101---", Id::F2F_IMM, Type::Conversion, "F2F_IMM"),
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 68efe74b8..cb4b68b26 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -792,8 +792,13 @@ private:
792 1, 1); 792 1, 1);
793 break; 793 break;
794 } 794 }
795 case OpCode::Id::RRO: { 795 case OpCode::Id::RRO_C:
796 NGLOG_DEBUG(HW_GPU, "Skipping RRO instruction"); 796 case OpCode::Id::RRO_R:
797 case OpCode::Id::RRO_IMM: {
798 // Currently RRO is only implemented as a register move.
799 // Usage of `abs_b` and `negate_b` here should also be correct.
800 regs.SetRegisterToFloat(instr.gpr0, 0, op_b, 1, 1);
801 NGLOG_WARNING(HW_GPU, "RRO instruction is incomplete");
797 break; 802 break;
798 } 803 }
799 default: { 804 default: {
@@ -897,8 +902,8 @@ private:
897 const std::string op_b = regs.GetRegisterAsFloat(instr.gpr20); 902 const std::string op_b = regs.GetRegisterAsFloat(instr.gpr20);
898 const std::string sampler = GetSampler(instr.sampler); 903 const std::string sampler = GetSampler(instr.sampler);
899 const std::string coord = "vec2 coords = vec2(" + op_a + ", " + op_b + ");"; 904 const std::string coord = "vec2 coords = vec2(" + op_a + ", " + op_b + ");";
900 // Add an extra scope and declare the texture coords inside to prevent overwriting 905 // Add an extra scope and declare the texture coords inside to prevent
901 // them in case they are used as outputs of the texs instruction. 906 // overwriting them in case they are used as outputs of the texs instruction.
902 shader.AddLine("{"); 907 shader.AddLine("{");
903 ++shader.scope; 908 ++shader.scope;
904 shader.AddLine(coord); 909 shader.AddLine(coord);
@@ -961,8 +966,8 @@ private:
961 '(' + predicate + ") " + combiner + " (" + second_pred + ')'); 966 '(' + predicate + ") " + combiner + " (" + second_pred + ')');
962 967
963 if (instr.fsetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) { 968 if (instr.fsetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) {
964 // Set the secondary predicate to the result of !Predicate OP SecondPredicate, if 969 // Set the secondary predicate to the result of !Predicate OP SecondPredicate,
965 // enabled 970 // if enabled
966 SetPredicate(instr.fsetp.pred0, 971 SetPredicate(instr.fsetp.pred0,
967 "!(" + predicate + ") " + combiner + " (" + second_pred + ')'); 972 "!(" + predicate + ") " + combiner + " (" + second_pred + ')');
968 } 973 }