summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-04-26 04:42:54 +0200
committerGitHub <noreply@github.com>2018-04-26 04:42:54 +0200
commitf81b915fd8112b9ae50c75d3bd2feafa9c8cda93 (patch)
tree9c4a3c0937698df3ea00dab528f2eaebb4418bb8 /src/video_core/renderer_opengl
parentMerge pull request #398 from lioncash/kernel (diff)
parentShaders: Added bit decodings for the I2I instruction. (diff)
downloadyuzu-f81b915fd8112b9ae50c75d3bd2feafa9c8cda93.tar
yuzu-f81b915fd8112b9ae50c75d3bd2feafa9c8cda93.tar.gz
yuzu-f81b915fd8112b9ae50c75d3bd2feafa9c8cda93.tar.bz2
yuzu-f81b915fd8112b9ae50c75d3bd2feafa9c8cda93.tar.lz
yuzu-f81b915fd8112b9ae50c75d3bd2feafa9c8cda93.tar.xz
yuzu-f81b915fd8112b9ae50c75d3bd2feafa9c8cda93.tar.zst
yuzu-f81b915fd8112b9ae50c75d3bd2feafa9c8cda93.zip
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp55
1 files changed, 54 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 086424395..3dffb205d 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -519,7 +519,7 @@ private:
}
break;
}
- case OpCode::Type::FloatPredicate: {
+ case OpCode::Type::FloatSetPredicate: {
std::string op_a = instr.fsetp.neg_a ? "-" : "";
op_a += GetRegister(instr.gpr8);
@@ -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: {