summaryrefslogtreecommitdiff
path: root/src/video_core/shader/expr.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/shader/expr.h')
-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 {
30public: 30public:
31 ExprAnd(Expr a, Expr b) : operand1{a}, operand2{b} {} 31 ExprAnd(Expr a, Expr b) : operand1{a}, operand2{b} {}
32 32
33 bool operator==(const ExprAnd& b) const;
34
33 Expr operand1; 35 Expr operand1;
34 Expr operand2; 36 Expr operand2;
35}; 37};
@@ -38,6 +40,8 @@ class ExprOr final {
38public: 40public:
39 ExprOr(Expr a, Expr b) : operand1{a}, operand2{b} {} 41 ExprOr(Expr a, Expr b) : operand1{a}, operand2{b} {}
40 42
43 bool operator==(const ExprOr& b) const;
44
41 Expr operand1; 45 Expr operand1;
42 Expr operand2; 46 Expr operand2;
43}; 47};
@@ -46,6 +50,8 @@ class ExprNot final {
46public: 50public:
47 ExprNot(Expr a) : operand1{a} {} 51 ExprNot(Expr a) : operand1{a} {}
48 52
53 bool operator==(const ExprNot& b) const;
54
49 Expr operand1; 55 Expr operand1;
50}; 56};
51 57
@@ -53,20 +59,32 @@ class ExprVar final {
53public: 59public:
54 ExprVar(u32 index) : var_index{index} {} 60 ExprVar(u32 index) : var_index{index} {}
55 61
62 bool operator==(const ExprVar& b) const {
63 return var_index == b.var_index;
64 }
65
56 u32 var_index; 66 u32 var_index;
57}; 67};
58 68
59class ExprPredicate final { 69class ExprPredicate final {
60public: 70public:
61 ExprPredicate(Pred predicate) : predicate{predicate} {} 71 ExprPredicate(u32 predicate) : predicate{predicate} {}
72
73 bool operator==(const ExprPredicate& b) const {
74 return predicate == b.predicate;
75 }
62 76
63 Pred predicate; 77 u32 predicate;
64}; 78};
65 79
66class ExprCondCode final { 80class ExprCondCode final {
67public: 81public:
68 ExprCondCode(ConditionCode cc) : cc{cc} {} 82 ExprCondCode(ConditionCode cc) : cc{cc} {}
69 83
84 bool operator==(const ExprCondCode& b) const {
85 return cc == b.cc;
86 }
87
70 ConditionCode cc; 88 ConditionCode cc;
71}; 89};
72 90
@@ -74,6 +92,10 @@ class ExprBoolean final {
74public: 92public:
75 ExprBoolean(bool val) : value{val} {} 93 ExprBoolean(bool val) : value{val} {}
76 94
95 bool operator==(const ExprBoolean& b) const {
96 return value == b.value;
97 }
98
77 bool value; 99 bool value;
78}; 100};
79 101
@@ -83,4 +105,14 @@ Expr MakeExpr(Args&&... args) {
83 return std::make_shared<ExprData>(T(std::forward<Args>(args)...)); 105 return std::make_shared<ExprData>(T(std::forward<Args>(args)...));
84} 106}
85 107
108bool ExprAreEqual(Expr first, Expr second);
109
110bool ExprAreOpposite(Expr first, Expr second);
111
112Expr MakeExprNot(Expr first);
113
114Expr MakeExprAnd(Expr first, Expr second);
115
116Expr MakeExprOr(Expr first, Expr second);
117
86} // namespace VideoCommon::Shader 118} // namespace VideoCommon::Shader