diff options
Diffstat (limited to 'src/video_core/shader/node.h')
| -rw-r--r-- | src/video_core/shader/node.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.h index 4d2f4d6a8..42e82ab74 100644 --- a/src/video_core/shader/node.h +++ b/src/video_core/shader/node.h | |||
| @@ -392,8 +392,30 @@ struct MetaImage { | |||
| 392 | using Meta = | 392 | using Meta = |
| 393 | std::variant<MetaArithmetic, MetaTexture, MetaImage, MetaStackClass, Tegra::Shader::HalfType>; | 393 | std::variant<MetaArithmetic, MetaTexture, MetaImage, MetaStackClass, Tegra::Shader::HalfType>; |
| 394 | 394 | ||
| 395 | class AmendNode { | ||
| 396 | public: | ||
| 397 | std::optional<u32> GetAmendIndex() const { | ||
| 398 | if (amend_index == amend_null_index) { | ||
| 399 | return std::nullopt; | ||
| 400 | } | ||
| 401 | return {amend_index}; | ||
| 402 | } | ||
| 403 | |||
| 404 | void SetAmendIndex(u32 index) { | ||
| 405 | amend_index = index; | ||
| 406 | } | ||
| 407 | |||
| 408 | void ClearAmend() { | ||
| 409 | amend_index = amend_null_index; | ||
| 410 | } | ||
| 411 | |||
| 412 | private: | ||
| 413 | static constexpr u32 amend_null_index = 0xFFFFFFFF; | ||
| 414 | u32 amend_index{amend_null_index}; | ||
| 415 | }; | ||
| 416 | |||
| 395 | /// Holds any kind of operation that can be done in the IR | 417 | /// Holds any kind of operation that can be done in the IR |
| 396 | class OperationNode final { | 418 | class OperationNode final : public AmendNode { |
| 397 | public: | 419 | public: |
| 398 | explicit OperationNode(OperationCode code) : OperationNode(code, Meta{}) {} | 420 | explicit OperationNode(OperationCode code) : OperationNode(code, Meta{}) {} |
| 399 | 421 | ||
| @@ -433,7 +455,7 @@ private: | |||
| 433 | }; | 455 | }; |
| 434 | 456 | ||
| 435 | /// Encloses inside any kind of node that returns a boolean conditionally-executed code | 457 | /// Encloses inside any kind of node that returns a boolean conditionally-executed code |
| 436 | class ConditionalNode final { | 458 | class ConditionalNode final : public AmendNode { |
| 437 | public: | 459 | public: |
| 438 | explicit ConditionalNode(Node condition, std::vector<Node>&& code) | 460 | explicit ConditionalNode(Node condition, std::vector<Node>&& code) |
| 439 | : condition{std::move(condition)}, code{std::move(code)} {} | 461 | : condition{std::move(condition)}, code{std::move(code)} {} |
| @@ -630,7 +652,7 @@ private: | |||
| 630 | }; | 652 | }; |
| 631 | 653 | ||
| 632 | /// Commentary, can be dropped | 654 | /// Commentary, can be dropped |
| 633 | class CommentNode final { | 655 | class CommentNode final : public AmendNode { |
| 634 | public: | 656 | public: |
| 635 | explicit CommentNode(std::string text) : text{std::move(text)} {} | 657 | explicit CommentNode(std::string text) : text{std::move(text)} {} |
| 636 | 658 | ||