Browse Source

shader: Add utility to resolve identities on a value

nce_cpp
ReinUsesLisp 5 years ago
committed by ameerj
parent
commit
073f346f8c
  1. 7
      src/shader_recompiler/frontend/ir/value.cpp
  2. 1
      src/shader_recompiler/frontend/ir/value.h

7
src/shader_recompiler/frontend/ir/value.cpp

@ -79,6 +79,13 @@ IR::Inst* Value::InstRecursive() const {
return inst;
}
IR::Value Value::Resolve() const {
if (IsIdentity()) {
return inst->Arg(0).Resolve();
}
return *this;
}
IR::Reg Value::Reg() const {
ValidateAccess(Type::Reg);
return reg;

1
src/shader_recompiler/frontend/ir/value.h

@ -41,6 +41,7 @@ public:
[[nodiscard]] IR::Inst* Inst() const;
[[nodiscard]] IR::Block* Label() const;
[[nodiscard]] IR::Inst* InstRecursive() const;
[[nodiscard]] IR::Value Resolve() const;
[[nodiscard]] IR::Reg Reg() const;
[[nodiscard]] IR::Pred Pred() const;
[[nodiscard]] IR::Attribute Attribute() const;

Loading…
Cancel
Save