diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-04-11 07:46:51 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:27 +0200 |
commit | 106764a6d51566b050dfe7124f82cf9a4de468c1 (patch) | |
tree | 3298d279c99e259b507a6e3b288f3267162e3d63 /src/shader_recompiler/backend/spirv | |
parent | spirv: Guard against typeless image reads on unsupported devices (diff) | |
download | yuzu-106764a6d51566b050dfe7124f82cf9a4de468c1.tar yuzu-106764a6d51566b050dfe7124f82cf9a4de468c1.tar.gz yuzu-106764a6d51566b050dfe7124f82cf9a4de468c1.tar.bz2 yuzu-106764a6d51566b050dfe7124f82cf9a4de468c1.tar.lz yuzu-106764a6d51566b050dfe7124f82cf9a4de468c1.tar.xz yuzu-106764a6d51566b050dfe7124f82cf9a4de468c1.tar.zst yuzu-106764a6d51566b050dfe7124f82cf9a4de468c1.zip |
Diffstat (limited to 'src/shader_recompiler/backend/spirv')
-rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp index db7b3f1b2..5a1ffd61c 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp @@ -246,21 +246,10 @@ void SetupCapabilities(const Profile& profile, const Info& info, EmitContext& ct ctx.AddCapability(spv::Capability::ImageQuery); 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()}; - size_t block_index{}; + size_t block_index{0}; ctx.PatchDeferredPhi([&](size_t phi_arg) { if (phi_arg == 0) { ++inst; @@ -274,6 +263,20 @@ std::vector<u32> EmitSPIRV(const Profile& profile, IR::Program& program, u32& bi } 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(); } |