summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/node.h
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-12-30 18:54:53 +0100
committerFernandoS27 <fsahmkow27@gmail.com>2019-12-30 20:31:48 +0100
commitb3371ed09e6866e235141119f9eecc2bb962dc8d (patch)
tree06619df9bd72cc0d73a3869b040b20804e2d3109 /src/video_core/shader/node.h
parentMerge pull request #3250 from ReinUsesLisp/empty-fragment (diff)
downloadyuzu-b3371ed09e6866e235141119f9eecc2bb962dc8d.tar
yuzu-b3371ed09e6866e235141119f9eecc2bb962dc8d.tar.gz
yuzu-b3371ed09e6866e235141119f9eecc2bb962dc8d.tar.bz2
yuzu-b3371ed09e6866e235141119f9eecc2bb962dc8d.tar.lz
yuzu-b3371ed09e6866e235141119f9eecc2bb962dc8d.tar.xz
yuzu-b3371ed09e6866e235141119f9eecc2bb962dc8d.tar.zst
yuzu-b3371ed09e6866e235141119f9eecc2bb962dc8d.zip
Diffstat (limited to 'src/video_core/shader/node.h')
-rw-r--r--src/video_core/shader/node.h28
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 {
using Meta =
std::variant<MetaArithmetic, MetaTexture, MetaImage, MetaStackClass, Tegra::Shader::HalfType>;
+class AmendNode {
+public:
+ std::optional<u32> GetAmendIndex() const {
+ if (amend_index == amend_null_index) {
+ return std::nullopt;
+ }
+ return {amend_index};
+ }
+
+ void SetAmendIndex(u32 index) {
+ amend_index = index;
+ }
+
+ void ClearAmend() {
+ amend_index = amend_null_index;
+ }
+
+private:
+ static constexpr u32 amend_null_index = 0xFFFFFFFF;
+ u32 amend_index{amend_null_index};
+};
+
/// Holds any kind of operation that can be done in the IR
-class OperationNode final {
+class OperationNode final : public AmendNode {
public:
explicit OperationNode(OperationCode code) : OperationNode(code, Meta{}) {}
@@ -433,7 +455,7 @@ private:
};
/// Encloses inside any kind of node that returns a boolean conditionally-executed code
-class ConditionalNode final {
+class ConditionalNode final : public AmendNode {
public:
explicit ConditionalNode(Node condition, std::vector<Node>&& code)
: condition{std::move(condition)}, code{std::move(code)} {}
@@ -630,7 +652,7 @@ private:
};
/// Commentary, can be dropped
-class CommentNode final {
+class CommentNode final : public AmendNode {
public:
explicit CommentNode(std::string text) : text{std::move(text)} {}