diff options
Diffstat (limited to 'src/shader_recompiler')
| -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 | |||
| 246 | ctx.AddCapability(spv::Capability::ImageQuery); | 246 | ctx.AddCapability(spv::Capability::ImageQuery); |
| 247 | ctx.AddCapability(spv::Capability::SampledBuffer); | 247 | ctx.AddCapability(spv::Capability::SampledBuffer); |
| 248 | } | 248 | } |
| 249 | } // Anonymous namespace | ||
| 250 | |||
| 251 | std::vector<u32> EmitSPIRV(const Profile& profile, IR::Program& program, u32& binding) { | ||
| 252 | EmitContext ctx{profile, program, binding}; | ||
| 253 | const Id main{DefineMain(ctx, program)}; | ||
| 254 | DefineEntryPoint(program, ctx, main); | ||
| 255 | if (profile.support_float_controls) { | ||
| 256 | ctx.AddExtension("SPV_KHR_float_controls"); | ||
| 257 | SetupDenormControl(profile, program, ctx, main); | ||
| 258 | SetupSignedNanCapabilities(profile, program, ctx, main); | ||
| 259 | } | ||
| 260 | SetupCapabilities(profile, program.info, ctx); | ||
| 261 | 249 | ||
| 250 | void PatchPhiNodes(IR::Program& program, EmitContext& ctx) { | ||
| 262 | auto inst{program.blocks.front()->begin()}; | 251 | auto inst{program.blocks.front()->begin()}; |
| 263 | size_t block_index{}; | 252 | size_t block_index{0}; |
| 264 | ctx.PatchDeferredPhi([&](size_t phi_arg) { | 253 | ctx.PatchDeferredPhi([&](size_t phi_arg) { |
| 265 | if (phi_arg == 0) { | 254 | if (phi_arg == 0) { |
| 266 | ++inst; | 255 | ++inst; |
| @@ -274,6 +263,20 @@ std::vector<u32> EmitSPIRV(const Profile& profile, IR::Program& program, u32& bi | |||
| 274 | } | 263 | } |
| 275 | return ctx.Def(inst->Arg(phi_arg)); | 264 | return ctx.Def(inst->Arg(phi_arg)); |
| 276 | }); | 265 | }); |
| 266 | } | ||
| 267 | } // Anonymous namespace | ||
| 268 | |||
| 269 | std::vector<u32> EmitSPIRV(const Profile& profile, IR::Program& program, u32& binding) { | ||
| 270 | EmitContext ctx{profile, program, binding}; | ||
| 271 | const Id main{DefineMain(ctx, program)}; | ||
| 272 | DefineEntryPoint(program, ctx, main); | ||
| 273 | if (profile.support_float_controls) { | ||
| 274 | ctx.AddExtension("SPV_KHR_float_controls"); | ||
| 275 | SetupDenormControl(profile, program, ctx, main); | ||
| 276 | SetupSignedNanCapabilities(profile, program, ctx, main); | ||
| 277 | } | ||
| 278 | SetupCapabilities(profile, program.info, ctx); | ||
| 279 | PatchPhiNodes(program, ctx); | ||
| 277 | return ctx.Assemble(); | 280 | return ctx.Assemble(); |
| 278 | } | 281 | } |
| 279 | 282 | ||