diff options
| author | 2019-06-28 20:54:21 -0400 | |
|---|---|---|
| committer | 2019-10-04 18:52:48 -0400 | |
| commit | 8be6e1c5221066a49b6ad27efbd20a999a7c16b3 (patch) | |
| tree | a00263eb962503bec08ec4bc870a9546c3b80d22 /src/video_core/shader/expr.h | |
| parent | shader_ir: Add basic goto elimination (diff) | |
| download | yuzu-8be6e1c5221066a49b6ad27efbd20a999a7c16b3.tar.gz yuzu-8be6e1c5221066a49b6ad27efbd20a999a7c16b3.tar.xz yuzu-8be6e1c5221066a49b6ad27efbd20a999a7c16b3.zip | |
shader_ir: Corrections to outward movements and misc stuffs
Diffstat (limited to 'src/video_core/shader/expr.h')
| -rw-r--r-- | src/video_core/shader/expr.h | 36 |
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 { | |||
| 30 | public: | 30 | public: |
| 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 { | |||
| 38 | public: | 40 | public: |
| 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 { | |||
| 46 | public: | 50 | public: |
| 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 { | |||
| 53 | public: | 59 | public: |
| 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 | ||
| 59 | class ExprPredicate final { | 69 | class ExprPredicate final { |
| 60 | public: | 70 | public: |
| 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 | ||
| 66 | class ExprCondCode final { | 80 | class ExprCondCode final { |
| 67 | public: | 81 | public: |
| 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 { | |||
| 74 | public: | 92 | public: |
| 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 | ||
| 108 | bool ExprAreEqual(Expr first, Expr second); | ||
| 109 | |||
| 110 | bool ExprAreOpposite(Expr first, Expr second); | ||
| 111 | |||
| 112 | Expr MakeExprNot(Expr first); | ||
| 113 | |||
| 114 | Expr MakeExprAnd(Expr first, Expr second); | ||
| 115 | |||
| 116 | Expr MakeExprOr(Expr first, Expr second); | ||
| 117 | |||
| 86 | } // namespace VideoCommon::Shader | 118 | } // namespace VideoCommon::Shader |