summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-04-25 18:17:38 +0200
committerSubv <subv2112@gmail.com>2018-04-25 19:52:32 +0200
commit1740aa544408d32a5c904f40d92c6e06ace6d00a (patch)
tree2568887ed57e86f19a2c21b5223d051e295289f8
parentShaders: Added decodings for the FSET instructions. (diff)
downloadyuzu-1740aa544408d32a5c904f40d92c6e06ace6d00a.tar
yuzu-1740aa544408d32a5c904f40d92c6e06ace6d00a.tar.gz
yuzu-1740aa544408d32a5c904f40d92c6e06ace6d00a.tar.bz2
yuzu-1740aa544408d32a5c904f40d92c6e06ace6d00a.tar.lz
yuzu-1740aa544408d32a5c904f40d92c6e06ace6d00a.tar.xz
yuzu-1740aa544408d32a5c904f40d92c6e06ace6d00a.tar.zst
yuzu-1740aa544408d32a5c904f40d92c6e06ace6d00a.zip
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 896b6cd2c..3dffb205d 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -570,6 +570,59 @@ private:
}
break;
}
+ case OpCode::Type::FloatSet: {
+ std::string dest = GetRegister(instr.gpr0);
+ std::string op_a = instr.fset.neg_a ? "-" : "";
+ op_a += GetRegister(instr.gpr8);
+
+ if (instr.fset.abs_a) {
+ op_a = "abs(" + op_a + ')';
+ }
+
+ std::string op_b = instr.fset.neg_b ? "-" : "";
+
+ if (instr.is_b_imm) {
+ std::string imm = GetImmediate19(instr);
+ if (instr.fset.neg_imm)
+ op_b += "(-" + imm + ')';
+ else
+ op_b += imm;
+ } else {
+ if (instr.is_b_gpr) {
+ op_b += GetRegister(instr.gpr20);
+ } else {
+ op_b += GetUniform(instr.uniform);
+ }
+ }
+
+ if (instr.fset.abs_b) {
+ op_b = "abs(" + op_b + ")";
+ }
+
+ using Tegra::Shader::Pred;
+ ASSERT_MSG(instr.fset.pred39 == static_cast<u64>(Pred::UnusedIndex),
+ "Compound predicates are not implemented");
+
+ // The fset instruction sets a register to 1.0 if the condition is true, and to 0
+ // otherwise.
+ using Tegra::Shader::PredCondition;
+ switch (instr.fset.cond) {
+ case PredCondition::LessThan:
+ SetDest(0, dest, "((" + op_a + ") < (" + op_b + ")) ? 1.0 : 0", 1, 1);
+ break;
+ case PredCondition::Equal:
+ SetDest(0, dest, "((" + op_a + ") == (" + op_b + ")) ? 1.0 : 0", 1, 1);
+ break;
+ case PredCondition::GreaterThan:
+ SetDest(0, dest, "((" + op_a + ") > (" + op_b + ")) ? 1.0 : 0", 1, 1);
+ break;
+ default:
+ NGLOG_CRITICAL(HW_GPU, "Unhandled predicate condition: {} (a: {}, b: {})",
+ static_cast<unsigned>(instr.fset.cond.Value()), op_a, op_b);
+ UNREACHABLE();
+ }
+ break;
+ }
default: {
switch (opcode->GetId()) {
case OpCode::Id::EXIT: {