VERY experimental Nintendo Switch 2 emulator
C++
Address Comments
Levi Behunin0858ed54d4f5
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.hindex 11a8a3f70e..1b19a06731 100644--- a/src/video_core/shader/node.h+++ b/src/video_core/shader/node.h@@ -464,7 +464,11 @@ public:return operands.size();}- NodeBlock GetOperands() const {+ NodeBlock& GetOperands() {+ return operands;+ }++ const NodeBlock& GetOperands() const {return operands;}diff --git a/src/video_core/shader/shader_ir.cpp b/src/video_core/shader/shader_ir.cppindex 14206d3ae8..521d0e47d4 100644--- a/src/video_core/shader/shader_ir.cpp+++ b/src/video_core/shader/shader_ir.cpp@@ -388,12 +388,12 @@ void ShaderIR::SetInternalFlagsFromInteger(NodeBlock& bb, Node value, bool sets_return;}switch (value->index()) {- case 0:+ case 0: // Operation NodeIterop(bb, value);break;- case 2:+ case 2: // Genral Purpose Nodeif (const auto gpr = std::get_if<GprNode>(value.get())) {- LOG_WARNING(HW_GPU, "GprNode: index={}", gpr->GetIndex());+ LOG_DEBUG(HW_GPU, "GprNode: index={}", gpr->GetIndex());Node zerop = Operation(OperationCode::LogicalIEqual, std::move(value),Immediate(gpr->GetIndex()));SetInternalFlag(bb, InternalFlag::Zero, std::move(zerop));@@ -408,26 +408,31 @@ void ShaderIR::SetInternalFlagsFromInteger(NodeBlock& bb, Node value, bool sets_}}-void ShaderIR::Iterop(NodeBlock& nb, Node var) {- if (const auto op = std::get_if<OperationNode>(var.get())) {- if (op->GetOperandsCount() > 0) {- for (auto& opss : op->GetOperands()) {- switch (opss->index()) {- case 0:- return Iterop(nb, opss);- case 2:- if (const auto gpr = std::get_if<GprNode>(opss.get())) {- LOG_WARNING(HW_GPU, "Child GprNode: index={}", gpr->GetIndex());- Node zerop = Operation(OperationCode::LogicalIEqual, std::move(opss),- Immediate(gpr->GetIndex()));- SetInternalFlag(nb, InternalFlag::Zero, std::move(zerop));- }- break;- default:- LOG_WARNING(HW_GPU, "Child Node Type: {}", opss->index());- break;- }+void ShaderIR::SearchOperands(NodeBlock& nb, Node var) {+ const auto* op = std::get_if<OperationNode>(var.get());+ if (op == nullptr) {+ return;+ }++ if (op->GetOperandsCount() == 0) {+ return;+ }++ for (auto& operand : op->GetOperands()) {+ switch (operand->index()) {+ case 0: // Operation Node+ return Iterop(nb, operand);+ case 2: // General Purpose Node+ if (const auto* gpr = std::get_if<GprNode>(operand.get())) {+ LOG_DEBUG(HW_GPU, "Child GprNode: index={}", gpr->GetIndex());+ Node zerop = Operation(OperationCode::LogicalIEqual, std::move(operand),+ Immediate(gpr->GetIndex()));+ SetInternalFlag(nb, InternalFlag::Zero, std::move(zerop));}+ break;+ default:+ LOG_WARNING(HW_GPU, "Child Node Type: {}", operand->index());+ break;}}}diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.hindex 2484b1c6a4..b450f3b8a4 100644--- a/src/video_core/shader/shader_ir.h+++ b/src/video_core/shader/shader_ir.h@@ -346,8 +346,8 @@ private:/// Access a bindless image sampler.Image& GetBindlessImage(Tegra::Shader::Register reg, Tegra::Shader::ImageType type);- /// Recursive Iteration over the OperationNode operands- void Iterop(NodeBlock& nb, Node var);+ /// Recursive Iteration over the OperationNode operands, searching for GprNodes.+ void SearchOperands(NodeBlock& nb, Node var);/// Extracts a sequence of bits from a nodeNode BitfieldExtract(Node value, u32 offset, u32 bits);