diff options
Diffstat (limited to 'src/video_core/shader/expr.h')
| -rw-r--r-- | src/video_core/shader/expr.h | 156 |
1 files changed, 0 insertions, 156 deletions
diff --git a/src/video_core/shader/expr.h b/src/video_core/shader/expr.h deleted file mode 100644 index cda284c72..000000000 --- a/src/video_core/shader/expr.h +++ /dev/null | |||
| @@ -1,156 +0,0 @@ | |||
| 1 | // Copyright 2019 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <memory> | ||
| 8 | #include <variant> | ||
| 9 | |||
| 10 | #include "video_core/engines/shader_bytecode.h" | ||
| 11 | |||
| 12 | namespace VideoCommon::Shader { | ||
| 13 | |||
| 14 | using Tegra::Shader::ConditionCode; | ||
| 15 | using Tegra::Shader::Pred; | ||
| 16 | |||
| 17 | class ExprAnd; | ||
| 18 | class ExprBoolean; | ||
| 19 | class ExprCondCode; | ||
| 20 | class ExprGprEqual; | ||
| 21 | class ExprNot; | ||
| 22 | class ExprOr; | ||
| 23 | class ExprPredicate; | ||
| 24 | class ExprVar; | ||
| 25 | |||
| 26 | using ExprData = std::variant<ExprVar, ExprCondCode, ExprPredicate, ExprNot, ExprOr, ExprAnd, | ||
| 27 | ExprBoolean, ExprGprEqual>; | ||
| 28 | using Expr = std::shared_ptr<ExprData>; | ||
| 29 | |||
| 30 | class ExprAnd final { | ||
| 31 | public: | ||
| 32 | explicit ExprAnd(Expr a, Expr b) : operand1{std::move(a)}, operand2{std::move(b)} {} | ||
| 33 | |||
| 34 | bool operator==(const ExprAnd& b) const; | ||
| 35 | bool operator!=(const ExprAnd& b) const; | ||
| 36 | |||
| 37 | Expr operand1; | ||
| 38 | Expr operand2; | ||
| 39 | }; | ||
| 40 | |||
| 41 | class ExprOr final { | ||
| 42 | public: | ||
| 43 | explicit ExprOr(Expr a, Expr b) : operand1{std::move(a)}, operand2{std::move(b)} {} | ||
| 44 | |||
| 45 | bool operator==(const ExprOr& b) const; | ||
| 46 | bool operator!=(const ExprOr& b) const; | ||
| 47 | |||
| 48 | Expr operand1; | ||
| 49 | Expr operand2; | ||
| 50 | }; | ||
| 51 | |||
| 52 | class ExprNot final { | ||
| 53 | public: | ||
| 54 | explicit ExprNot(Expr a) : operand1{std::move(a)} {} | ||
| 55 | |||
| 56 | bool operator==(const ExprNot& b) const; | ||
| 57 | bool operator!=(const ExprNot& b) const; | ||
| 58 | |||
| 59 | Expr operand1; | ||
| 60 | }; | ||
| 61 | |||
| 62 | class ExprVar final { | ||
| 63 | public: | ||
| 64 | explicit ExprVar(u32 index) : var_index{index} {} | ||
| 65 | |||
| 66 | bool operator==(const ExprVar& b) const { | ||
| 67 | return var_index == b.var_index; | ||
| 68 | } | ||
| 69 | |||
| 70 | bool operator!=(const ExprVar& b) const { | ||
| 71 | return !operator==(b); | ||
| 72 | } | ||
| 73 | |||
| 74 | u32 var_index; | ||
| 75 | }; | ||
| 76 | |||
| 77 | class ExprPredicate final { | ||
| 78 | public: | ||
| 79 | explicit ExprPredicate(u32 predicate_) : predicate{predicate_} {} | ||
| 80 | |||
| 81 | bool operator==(const ExprPredicate& b) const { | ||
| 82 | return predicate == b.predicate; | ||
| 83 | } | ||
| 84 | |||
| 85 | bool operator!=(const ExprPredicate& b) const { | ||
| 86 | return !operator==(b); | ||
| 87 | } | ||
| 88 | |||
| 89 | u32 predicate; | ||
| 90 | }; | ||
| 91 | |||
| 92 | class ExprCondCode final { | ||
| 93 | public: | ||
| 94 | explicit ExprCondCode(ConditionCode condition_code) : cc{condition_code} {} | ||
| 95 | |||
| 96 | bool operator==(const ExprCondCode& b) const { | ||
| 97 | return cc == b.cc; | ||
| 98 | } | ||
| 99 | |||
| 100 | bool operator!=(const ExprCondCode& b) const { | ||
| 101 | return !operator==(b); | ||
| 102 | } | ||
| 103 | |||
| 104 | ConditionCode cc; | ||
| 105 | }; | ||
| 106 | |||
| 107 | class ExprBoolean final { | ||
| 108 | public: | ||
| 109 | explicit ExprBoolean(bool val) : value{val} {} | ||
| 110 | |||
| 111 | bool operator==(const ExprBoolean& b) const { | ||
| 112 | return value == b.value; | ||
| 113 | } | ||
| 114 | |||
| 115 | bool operator!=(const ExprBoolean& b) const { | ||
| 116 | return !operator==(b); | ||
| 117 | } | ||
| 118 | |||
| 119 | bool value; | ||
| 120 | }; | ||
| 121 | |||
| 122 | class ExprGprEqual final { | ||
| 123 | public: | ||
| 124 | explicit ExprGprEqual(u32 gpr_, u32 value_) : gpr{gpr_}, value{value_} {} | ||
| 125 | |||
| 126 | bool operator==(const ExprGprEqual& b) const { | ||
| 127 | return gpr == b.gpr && value == b.value; | ||
| 128 | } | ||
| 129 | |||
| 130 | bool operator!=(const ExprGprEqual& b) const { | ||
| 131 | return !operator==(b); | ||
| 132 | } | ||
| 133 | |||
| 134 | u32 gpr; | ||
| 135 | u32 value; | ||
| 136 | }; | ||
| 137 | |||
| 138 | template <typename T, typename... Args> | ||
| 139 | Expr MakeExpr(Args&&... args) { | ||
| 140 | static_assert(std::is_convertible_v<T, ExprData>); | ||
| 141 | return std::make_shared<ExprData>(T(std::forward<Args>(args)...)); | ||
| 142 | } | ||
| 143 | |||
| 144 | bool ExprAreEqual(const Expr& first, const Expr& second); | ||
| 145 | |||
| 146 | bool ExprAreOpposite(const Expr& first, const Expr& second); | ||
| 147 | |||
| 148 | Expr MakeExprNot(Expr first); | ||
| 149 | |||
| 150 | Expr MakeExprAnd(Expr first, Expr second); | ||
| 151 | |||
| 152 | Expr MakeExprOr(Expr first, Expr second); | ||
| 153 | |||
| 154 | bool ExprIsTrue(const Expr& first); | ||
| 155 | |||
| 156 | } // namespace VideoCommon::Shader | ||