diff options
| author | 2021-02-16 19:49:24 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:22 -0400 | |
| commit | 3633e433774927681b02e1de665a608730f5582c (patch) | |
| tree | 47ec548d43d72ae4bfd85c8052cca6fca29498b4 /src | |
| parent | spirv: Implement EmitIdentity (diff) | |
| download | yuzu-3633e433774927681b02e1de665a608730f5582c.tar.gz yuzu-3633e433774927681b02e1de665a608730f5582c.tar.xz yuzu-3633e433774927681b02e1de665a608730f5582c.zip | |
shader: Add utility to resolve identities on a value
Diffstat (limited to 'src')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/value.cpp | 7 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/value.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/value.cpp b/src/shader_recompiler/frontend/ir/value.cpp index 9ea61813b..718314213 100644 --- a/src/shader_recompiler/frontend/ir/value.cpp +++ b/src/shader_recompiler/frontend/ir/value.cpp | |||
| @@ -79,6 +79,13 @@ IR::Inst* Value::InstRecursive() const { | |||
| 79 | return inst; | 79 | return inst; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | IR::Value Value::Resolve() const { | ||
| 83 | if (IsIdentity()) { | ||
| 84 | return inst->Arg(0).Resolve(); | ||
| 85 | } | ||
| 86 | return *this; | ||
| 87 | } | ||
| 88 | |||
| 82 | IR::Reg Value::Reg() const { | 89 | IR::Reg Value::Reg() const { |
| 83 | ValidateAccess(Type::Reg); | 90 | ValidateAccess(Type::Reg); |
| 84 | return reg; | 91 | return reg; |
diff --git a/src/shader_recompiler/frontend/ir/value.h b/src/shader_recompiler/frontend/ir/value.h index 2f3688c73..8aba0bbf6 100644 --- a/src/shader_recompiler/frontend/ir/value.h +++ b/src/shader_recompiler/frontend/ir/value.h | |||
| @@ -41,6 +41,7 @@ public: | |||
| 41 | [[nodiscard]] IR::Inst* Inst() const; | 41 | [[nodiscard]] IR::Inst* Inst() const; |
| 42 | [[nodiscard]] IR::Block* Label() const; | 42 | [[nodiscard]] IR::Block* Label() const; |
| 43 | [[nodiscard]] IR::Inst* InstRecursive() const; | 43 | [[nodiscard]] IR::Inst* InstRecursive() const; |
| 44 | [[nodiscard]] IR::Value Resolve() const; | ||
| 44 | [[nodiscard]] IR::Reg Reg() const; | 45 | [[nodiscard]] IR::Reg Reg() const; |
| 45 | [[nodiscard]] IR::Pred Pred() const; | 46 | [[nodiscard]] IR::Pred Pred() const; |
| 46 | [[nodiscard]] IR::Attribute Attribute() const; | 47 | [[nodiscard]] IR::Attribute Attribute() const; |