mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 04:46:27 -05:00
spirv: Move phi node patching to a separate function
This commit is contained in:
parent
ab543f1821
commit
106764a6d5
1 changed files with 16 additions and 13 deletions
|
@ -246,21 +246,10 @@ void SetupCapabilities(const Profile& profile, const Info& info, EmitContext& ct
|
||||||
ctx.AddCapability(spv::Capability::ImageQuery);
|
ctx.AddCapability(spv::Capability::ImageQuery);
|
||||||
ctx.AddCapability(spv::Capability::SampledBuffer);
|
ctx.AddCapability(spv::Capability::SampledBuffer);
|
||||||
}
|
}
|
||||||
} // Anonymous namespace
|
|
||||||
|
|
||||||
std::vector<u32> EmitSPIRV(const Profile& profile, IR::Program& program, u32& binding) {
|
|
||||||
EmitContext ctx{profile, program, binding};
|
|
||||||
const Id main{DefineMain(ctx, program)};
|
|
||||||
DefineEntryPoint(program, ctx, main);
|
|
||||||
if (profile.support_float_controls) {
|
|
||||||
ctx.AddExtension("SPV_KHR_float_controls");
|
|
||||||
SetupDenormControl(profile, program, ctx, main);
|
|
||||||
SetupSignedNanCapabilities(profile, program, ctx, main);
|
|
||||||
}
|
|
||||||
SetupCapabilities(profile, program.info, ctx);
|
|
||||||
|
|
||||||
|
void PatchPhiNodes(IR::Program& program, EmitContext& ctx) {
|
||||||
auto inst{program.blocks.front()->begin()};
|
auto inst{program.blocks.front()->begin()};
|
||||||
size_t block_index{};
|
size_t block_index{0};
|
||||||
ctx.PatchDeferredPhi([&](size_t phi_arg) {
|
ctx.PatchDeferredPhi([&](size_t phi_arg) {
|
||||||
if (phi_arg == 0) {
|
if (phi_arg == 0) {
|
||||||
++inst;
|
++inst;
|
||||||
|
@ -274,6 +263,20 @@ std::vector<u32> EmitSPIRV(const Profile& profile, IR::Program& program, u32& bi
|
||||||
}
|
}
|
||||||
return ctx.Def(inst->Arg(phi_arg));
|
return ctx.Def(inst->Arg(phi_arg));
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
} // Anonymous namespace
|
||||||
|
|
||||||
|
std::vector<u32> EmitSPIRV(const Profile& profile, IR::Program& program, u32& binding) {
|
||||||
|
EmitContext ctx{profile, program, binding};
|
||||||
|
const Id main{DefineMain(ctx, program)};
|
||||||
|
DefineEntryPoint(program, ctx, main);
|
||||||
|
if (profile.support_float_controls) {
|
||||||
|
ctx.AddExtension("SPV_KHR_float_controls");
|
||||||
|
SetupDenormControl(profile, program, ctx, main);
|
||||||
|
SetupSignedNanCapabilities(profile, program, ctx, main);
|
||||||
|
}
|
||||||
|
SetupCapabilities(profile, program.info, ctx);
|
||||||
|
PatchPhiNodes(program, ctx);
|
||||||
return ctx.Assemble();
|
return ctx.Assemble();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue