From 5ed8f2438498d3281c2ce8621869995de3908413 Mon Sep 17 00:00:00 2001
From: FernandoS27 <fsahmkow27@gmail.com>
Date: Thu, 1 Apr 2021 07:52:36 +0200
Subject: [PATCH] shader: Stub VOTE.VTG

---
 src/shader_recompiler/frontend/ir/ir_emitter.cpp           | 7 +++++++
 .../maxwell/translate/impl/move_special_register.cpp       | 4 ++++
 .../frontend/maxwell/translate/impl/not_implemented.cpp    | 4 ----
 .../frontend/maxwell/translate/impl/vote.cpp               | 4 ++++
 4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
index edf8c05d4..5258ede09 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
@@ -256,6 +256,13 @@ static U1 GetFlowTest(IREmitter& ir, FlowTest flow_test) {
         return ir.LogicalOr(ir.GetSFlag(), ir.GetZFlag());
     case FlowTest::RGT:
         return ir.LogicalAnd(ir.LogicalNot(ir.GetSFlag()), ir.LogicalNot(ir.GetZFlag()));
+    case FlowTest::CSM_TA:
+    case FlowTest::CSM_TR:
+    case FlowTest::CSM_MX:
+    case FlowTest::FCSM_TA:
+    case FlowTest::FCSM_TR:
+    case FlowTest::FCSM_MX:
+        return ir.Imm1(false);
     default:
         throw NotImplementedException("Flow test {}", flow_test);
     }
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/move_special_register.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/move_special_register.cpp
index 93cea302a..a295f4c5e 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/move_special_register.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/move_special_register.cpp
@@ -95,6 +95,10 @@ enum class SpecialRegister : u64 {
         return ir.WorkgroupIdY();
     case SpecialRegister::SR_CTAID_Z:
         return ir.WorkgroupIdZ();
+    case SpecialRegister::SR_WSCALEFACTOR_XY:
+        return ir.Imm32(Common::BitCast<u32>(1.0f));
+    case SpecialRegister::SR_WSCALEFACTOR_Z:
+        return ir.Imm32(Common::BitCast<u32>(1.0f));
     default:
         throw NotImplementedException("S2R special register {}", special_register);
     }
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
index ba526817a..83ed0c0fd 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
@@ -329,10 +329,6 @@ void TranslatorVisitor::VADD(u64) {
     ThrowNotImplemented(Opcode::VADD);
 }
 
-void TranslatorVisitor::VOTE_vtg(u64) {
-    ThrowNotImplemented(Opcode::VOTE_vtg);
-}
-
 void TranslatorVisitor::VSET(u64) {
     ThrowNotImplemented(Opcode::VSET);
 }
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/vote.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/vote.cpp
index a88894a7e..391520a18 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/vote.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/vote.cpp
@@ -49,4 +49,8 @@ void TranslatorVisitor::VOTE(u64 insn) {
     Vote(*this, insn);
 }
 
+void TranslatorVisitor::VOTE_vtg(u64) {
+    // Stub
+}
+
 } // namespace Shader::Maxwell