mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
chore(shader): plan builder return for void + ssa pass init value
This commit is contained in:
@@ -20,7 +20,7 @@ public:
|
||||
private:
|
||||
[[nodiscard]] IrValue* AddPhiOperands(Variable variable, IrValue& phi, IrBlock* block);
|
||||
[[nodiscard]] IrValue* TryRemoveTrivialPhi(IrValue& phi, Variable variable);
|
||||
[[nodiscard]] IrValue* MakeUndef(Variable variable);
|
||||
[[nodiscard]] IrValue* MakeInitialValue(Variable variable);
|
||||
|
||||
IrProgram& _program;
|
||||
DefTable _definitions;
|
||||
|
||||
@@ -45,11 +45,8 @@ void PlanBuilder::Run() {
|
||||
|
||||
void PlanBuilder::Collect(IrValue* raw, std::uint32_t usePc) {
|
||||
IrValue* value = raw->Resolve();
|
||||
if (value->HasImmediate()) {
|
||||
return;
|
||||
}
|
||||
if (value->Opcode() == IrOpcode::Void) {
|
||||
Fail(_program.Resources(), usePc, "invalid typed planning value");
|
||||
return;
|
||||
}
|
||||
IrValue* inst = value;
|
||||
const auto cycle = std::find(_visiting.begin(), _visiting.end(), inst);
|
||||
|
||||
@@ -113,7 +113,7 @@ IrValue* Pass::TryRemoveTrivialPhi(IrValue& phi, Variable variable) {
|
||||
same = operand;
|
||||
}
|
||||
if (same == nullptr) {
|
||||
same = MakeUndef(variable);
|
||||
same = MakeInitialValue(variable);
|
||||
}
|
||||
std::vector<IrValue*> users = phi.Uses();
|
||||
phi.ReplaceUsesWith(same, true);
|
||||
@@ -125,10 +125,15 @@ IrValue* Pass::TryRemoveTrivialPhi(IrValue& phi, Variable variable) {
|
||||
return same;
|
||||
}
|
||||
|
||||
IrValue* Pass::MakeUndef(Variable variable) {
|
||||
IrValue* Pass::MakeInitialValue(Variable variable) {
|
||||
const IrType type = VariableType(variable);
|
||||
const IrOpcode opcode = (type == IrType::Bool) ? IrOpcode::UndefU1 : IrOpcode::UndefU32;
|
||||
return &_program.CreateValue(opcode, type);
|
||||
IrValue& value = _program.CreateValue(IrOpcode::Void, type);
|
||||
if (type == IrType::Bool) {
|
||||
value.SetImmediateBool(false);
|
||||
} else {
|
||||
value.SetImmediateU32(0u);
|
||||
}
|
||||
return &value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user