summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/expr.h
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-06-29 02:54:21 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-10-05 00:52:48 +0200
commit8be6e1c5221066a49b6ad27efbd20a999a7c16b3 (patch)
treea00263eb962503bec08ec4bc870a9546c3b80d22 /src/video_core/shader/expr.h
parentshader_ir: Add basic goto elimination (diff)
downloadyuzu-8be6e1c5221066a49b6ad27efbd20a999a7c16b3.tar
yuzu-8be6e1c5221066a49b6ad27efbd20a999a7c16b3.tar.gz
yuzu-8be6e1c5221066a49b6ad27efbd20a999a7c16b3.tar.bz2
yuzu-8be6e1c5221066a49b6ad27efbd20a999a7c16b3.tar.lz
yuzu-8be6e1c5221066a49b6ad27efbd20a999a7c16b3.tar.xz
yuzu-8be6e1c5221066a49b6ad27efbd20a999a7c16b3.tar.zst
yuzu-8be6e1c5221066a49b6ad27efbd20a999a7c16b3.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/shader/expr.h36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/video_core/shader/expr.h b/src/video_core/shader/expr.h
index 94678f09a..f012f6fcf 100644
--- a/src/video_core/shader/expr.h
+++ b/src/video_core/shader/expr.h
@@ -30,6 +30,8 @@ class ExprAnd final {
public:
ExprAnd(Expr a, Expr b) : operand1{a}, operand2{b} {}
+ bool operator==(const ExprAnd& b) const;
+
Expr operand1;
Expr operand2;
};
@@ -38,6 +40,8 @@ class ExprOr final {
public:
ExprOr(Expr a, Expr b) : operand1{a}, operand2{b} {}
+ bool operator==(const ExprOr& b) const;
+
Expr operand1;
Expr operand2;
};
@@ -46,6 +50,8 @@ class ExprNot final {
public:
ExprNot(Expr a) : operand1{a} {}
+ bool operator==(const ExprNot& b) const;
+
Expr operand1;
};
@@ -53,20 +59,32 @@ class ExprVar final {
public:
ExprVar(u32 index) : var_index{index} {}
+ bool operator==(const ExprVar& b) const {
+ return var_index == b.var_index;
+ }
+
u32 var_index;
};
class ExprPredicate final {
public:
- ExprPredicate(Pred predicate) : predicate{predicate} {}
+ ExprPredicate(u32 predicate) : predicate{predicate} {}
+
+ bool operator==(const ExprPredicate& b) const {
+ return predicate == b.predicate;
+ }
- Pred predicate;
+ u32 predicate;
};
class ExprCondCode final {
public:
ExprCondCode(ConditionCode cc) : cc{cc} {}
+ bool operator==(const ExprCondCode& b) const {
+ return cc == b.cc;
+ }
+
ConditionCode cc;
};
@@ -74,6 +92,10 @@ class ExprBoolean final {
public:
ExprBoolean(bool val) : value{val} {}
+ bool operator==(const ExprBoolean& b) const {
+ return value == b.value;
+ }
+
bool value;
};
@@ -83,4 +105,14 @@ Expr MakeExpr(Args&&... args) {
return std::make_shared<ExprData>(T(std::forward<Args>(args)...));
}
+bool ExprAreEqual(Expr first, Expr second);
+
+bool ExprAreOpposite(Expr first, Expr second);
+
+Expr MakeExprNot(Expr first);
+
+Expr MakeExprAnd(Expr first, Expr second);
+
+Expr MakeExprOr(Expr first, Expr second);
+
} // namespace VideoCommon::Shader