summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/shader/node.h6
-rw-r--r--src/video_core/shader/shader_ir.cpp49
-rw-r--r--src/video_core/shader/shader_ir.h4
3 files changed, 34 insertions, 25 deletions
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.h
index 11a8a3f70..1b19a0673 100644
--- a/src/video_core/shader/node.h
+++ b/src/video_core/shader/node.h
@@ -464,7 +464,11 @@ public:
464 return operands.size(); 464 return operands.size();
465 } 465 }
466 466
467 NodeBlock GetOperands() const { 467 NodeBlock& GetOperands() {
468 return operands;
469 }
470
471 const NodeBlock& GetOperands() const {
468 return operands; 472 return operands;
469 } 473 }
470 474
diff --git a/src/video_core/shader/shader_ir.cpp b/src/video_core/shader/shader_ir.cpp
index 14206d3ae..521d0e47d 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_
388 return; 388 return;
389 } 389 }
390 switch (value->index()) { 390 switch (value->index()) {
391 case 0: 391 case 0: // Operation Node
392 Iterop(bb, value); 392 Iterop(bb, value);
393 break; 393 break;
394 case 2: 394 case 2: // Genral Purpose Node
395 if (const auto gpr = std::get_if<GprNode>(value.get())) { 395 if (const auto gpr = std::get_if<GprNode>(value.get())) {
396 LOG_WARNING(HW_GPU, "GprNode: index={}", gpr->GetIndex()); 396 LOG_DEBUG(HW_GPU, "GprNode: index={}", gpr->GetIndex());
397 Node zerop = Operation(OperationCode::LogicalIEqual, std::move(value), 397 Node zerop = Operation(OperationCode::LogicalIEqual, std::move(value),
398 Immediate(gpr->GetIndex())); 398 Immediate(gpr->GetIndex()));
399 SetInternalFlag(bb, InternalFlag::Zero, std::move(zerop)); 399 SetInternalFlag(bb, InternalFlag::Zero, std::move(zerop));
@@ -408,26 +408,31 @@ void ShaderIR::SetInternalFlagsFromInteger(NodeBlock& bb, Node value, bool sets_
408 } 408 }
409} 409}
410 410
411void ShaderIR::Iterop(NodeBlock& nb, Node var) { 411void ShaderIR::SearchOperands(NodeBlock& nb, Node var) {
412 if (const auto op = std::get_if<OperationNode>(var.get())) { 412 const auto* op = std::get_if<OperationNode>(var.get());
413 if (op->GetOperandsCount() > 0) { 413 if (op == nullptr) {
414 for (auto& opss : op->GetOperands()) { 414 return;
415 switch (opss->index()) { 415 }
416 case 0: 416
417 return Iterop(nb, opss); 417 if (op->GetOperandsCount() == 0) {
418 case 2: 418 return;
419 if (const auto gpr = std::get_if<GprNode>(opss.get())) { 419 }
420 LOG_WARNING(HW_GPU, "Child GprNode: index={}", gpr->GetIndex()); 420
421 Node zerop = Operation(OperationCode::LogicalIEqual, std::move(opss), 421 for (auto& operand : op->GetOperands()) {
422 Immediate(gpr->GetIndex())); 422 switch (operand->index()) {
423 SetInternalFlag(nb, InternalFlag::Zero, std::move(zerop)); 423 case 0: // Operation Node
424 } 424 return Iterop(nb, operand);
425 break; 425 case 2: // General Purpose Node
426 default: 426 if (const auto* gpr = std::get_if<GprNode>(operand.get())) {
427 LOG_WARNING(HW_GPU, "Child Node Type: {}", opss->index()); 427 LOG_DEBUG(HW_GPU, "Child GprNode: index={}", gpr->GetIndex());
428 break; 428 Node zerop = Operation(OperationCode::LogicalIEqual, std::move(operand),
429 } 429 Immediate(gpr->GetIndex()));
430 SetInternalFlag(nb, InternalFlag::Zero, std::move(zerop));
430 } 431 }
432 break;
433 default:
434 LOG_WARNING(HW_GPU, "Child Node Type: {}", operand->index());
435 break;
431 } 436 }
432 } 437 }
433} 438}
diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h
index 2484b1c6a..b450f3b8a 100644
--- a/src/video_core/shader/shader_ir.h
+++ b/src/video_core/shader/shader_ir.h
@@ -346,8 +346,8 @@ private:
346 /// Access a bindless image sampler. 346 /// Access a bindless image sampler.
347 Image& GetBindlessImage(Tegra::Shader::Register reg, Tegra::Shader::ImageType type); 347 Image& GetBindlessImage(Tegra::Shader::Register reg, Tegra::Shader::ImageType type);
348 348
349 /// Recursive Iteration over the OperationNode operands 349 /// Recursive Iteration over the OperationNode operands, searching for GprNodes.
350 void Iterop(NodeBlock& nb, Node var); 350 void SearchOperands(NodeBlock& nb, Node var);
351 351
352 /// Extracts a sequence of bits from a node 352 /// Extracts a sequence of bits from a node
353 Node BitfieldExtract(Node value, u32 offset, u32 bits); 353 Node BitfieldExtract(Node value, u32 offset, u32 bits);