mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
shader: Add TryInstRecursive utility to values
This commit is contained in:
parent
c09557acd8
commit
f6f0383b49
1 changed files with 8 additions and 0 deletions
|
@ -57,6 +57,7 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] IR::Inst* Inst() const;
|
[[nodiscard]] IR::Inst* Inst() const;
|
||||||
[[nodiscard]] IR::Inst* InstRecursive() const;
|
[[nodiscard]] IR::Inst* InstRecursive() const;
|
||||||
|
[[nodiscard]] IR::Inst* TryInstRecursive() const;
|
||||||
[[nodiscard]] IR::Value Resolve() const;
|
[[nodiscard]] IR::Value Resolve() const;
|
||||||
[[nodiscard]] IR::Reg Reg() const;
|
[[nodiscard]] IR::Reg Reg() const;
|
||||||
[[nodiscard]] IR::Pred Pred() const;
|
[[nodiscard]] IR::Pred Pred() const;
|
||||||
|
@ -308,6 +309,13 @@ inline IR::Inst* Value::InstRecursive() const {
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline IR::Inst* Value::TryInstRecursive() const {
|
||||||
|
if (IsIdentity()) {
|
||||||
|
return inst->Arg(0).TryInstRecursive();
|
||||||
|
}
|
||||||
|
return type == Type::Opaque ? inst : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
inline IR::Value Value::Resolve() const {
|
inline IR::Value Value::Resolve() const {
|
||||||
if (IsIdentity()) {
|
if (IsIdentity()) {
|
||||||
return inst->Arg(0).Resolve();
|
return inst->Arg(0).Resolve();
|
||||||
|
|
Loading…
Reference in a new issue