diff options
| author | 2022-01-28 16:32:48 -0500 | |
|---|---|---|
| committer | 2022-01-28 16:32:48 -0500 | |
| commit | beaf7654bbf0543bcaa5a0b22e916fa7276ed96d (patch) | |
| tree | 539482328b7532c5b1ff581524a696c1b448132b /src/shader_recompiler/backend | |
| parent | Merge pull request #7770 from german77/motion-threshold (diff) | |
| download | yuzu-beaf7654bbf0543bcaa5a0b22e916fa7276ed96d.tar.gz yuzu-beaf7654bbf0543bcaa5a0b22e916fa7276ed96d.tar.xz yuzu-beaf7654bbf0543bcaa5a0b22e916fa7276ed96d.zip | |
emit_spirv: Add Xfb execution mode when transform feedback is used
Fixes Transform Feedback on Vulkan AMD drivers.
Diffstat (limited to 'src/shader_recompiler/backend')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp index 50918317f..08b3a81ce 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp | |||
| @@ -387,6 +387,14 @@ void SetupSignedNanCapabilities(const Profile& profile, const IR::Program& progr | |||
| 387 | } | 387 | } |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | void SetupTransformFeedbackCapabilities(EmitContext& ctx, Id main_func) { | ||
| 391 | if (ctx.runtime_info.xfb_varyings.empty()) { | ||
| 392 | return; | ||
| 393 | } | ||
| 394 | ctx.AddCapability(spv::Capability::TransformFeedback); | ||
| 395 | ctx.AddExecutionMode(main_func, spv::ExecutionMode::Xfb); | ||
| 396 | } | ||
| 397 | |||
| 390 | void SetupCapabilities(const Profile& profile, const Info& info, EmitContext& ctx) { | 398 | void SetupCapabilities(const Profile& profile, const Info& info, EmitContext& ctx) { |
| 391 | if (info.uses_sampled_1d) { | 399 | if (info.uses_sampled_1d) { |
| 392 | ctx.AddCapability(spv::Capability::Sampled1D); | 400 | ctx.AddCapability(spv::Capability::Sampled1D); |
| @@ -442,9 +450,6 @@ void SetupCapabilities(const Profile& profile, const Info& info, EmitContext& ct | |||
| 442 | if (info.uses_sample_id) { | 450 | if (info.uses_sample_id) { |
| 443 | ctx.AddCapability(spv::Capability::SampleRateShading); | 451 | ctx.AddCapability(spv::Capability::SampleRateShading); |
| 444 | } | 452 | } |
| 445 | if (!ctx.runtime_info.xfb_varyings.empty()) { | ||
| 446 | ctx.AddCapability(spv::Capability::TransformFeedback); | ||
| 447 | } | ||
| 448 | if (info.uses_derivatives) { | 453 | if (info.uses_derivatives) { |
| 449 | ctx.AddCapability(spv::Capability::DerivativeControl); | 454 | ctx.AddCapability(spv::Capability::DerivativeControl); |
| 450 | } | 455 | } |
| @@ -484,6 +489,7 @@ std::vector<u32> EmitSPIRV(const Profile& profile, const RuntimeInfo& runtime_in | |||
| 484 | SetupSignedNanCapabilities(profile, program, ctx, main); | 489 | SetupSignedNanCapabilities(profile, program, ctx, main); |
| 485 | } | 490 | } |
| 486 | SetupCapabilities(profile, program.info, ctx); | 491 | SetupCapabilities(profile, program.info, ctx); |
| 492 | SetupTransformFeedbackCapabilities(ctx, main); | ||
| 487 | PatchPhiNodes(program, ctx); | 493 | PatchPhiNodes(program, ctx); |
| 488 | return ctx.Assemble(); | 494 | return ctx.Assemble(); |
| 489 | } | 495 | } |