@@ -602,11 +602,71 @@ bool CapabilityVisitor::visit(SpirvEntryPoint *entryPoint) {
602602}
603603
604604bool CapabilityVisitor::visit (SpirvExecutionMode *execMode) {
605- if (execMode->getExecutionMode () == spv::ExecutionMode::PostDepthCoverage) {
605+ spv::ExecutionMode executionMode = execMode->getExecutionMode ();
606+ SourceLocation execModeSourceLocation = execMode->getSourceLocation ();
607+ SourceLocation entryPointSourceLocation =
608+ execMode->getEntryPoint ()->getSourceLocation ();
609+ switch (executionMode) {
610+ case spv::ExecutionMode::PostDepthCoverage:
606611 addCapability (spv::Capability::SampleMaskPostDepthCoverage,
607- execMode-> getEntryPoint ()-> getSourceLocation () );
612+ entryPointSourceLocation );
608613 addExtension (Extension::KHR_post_depth_coverage,
609- " [[vk::post_depth_coverage]]" , execMode->getSourceLocation ());
614+ " [[vk::post_depth_coverage]]" , execModeSourceLocation);
615+ break ;
616+ case spv::ExecutionMode::EarlyAndLateFragmentTestsAMD:
617+ addExtension (Extension::AMD_shader_early_and_late_fragment_tests,
618+ " [[vk::early_and_late_tests]]" , execModeSourceLocation);
619+ break ;
620+ case spv::ExecutionMode::StencilRefUnchangedFrontAMD:
621+ addCapability (spv::Capability::StencilExportEXT, entryPointSourceLocation);
622+ addExtension (Extension::AMD_shader_early_and_late_fragment_tests,
623+ " [[vk::stencil_ref_unchanged_front]]" , execModeSourceLocation);
624+ addExtension (Extension::EXT_shader_stencil_export,
625+ " [[vk::stencil_ref_unchanged_front]]" , execModeSourceLocation);
626+ break ;
627+ case spv::ExecutionMode::StencilRefGreaterFrontAMD:
628+ addCapability (spv::Capability::StencilExportEXT, entryPointSourceLocation);
629+ addExtension (Extension::AMD_shader_early_and_late_fragment_tests,
630+ " [[vk::stencil_ref_greater_equal_front]]" ,
631+ execModeSourceLocation);
632+ addExtension (Extension::EXT_shader_stencil_export,
633+ " [[vk::stencil_ref_greater_equal_front]]" ,
634+ execModeSourceLocation);
635+ break ;
636+ case spv::ExecutionMode::StencilRefLessFrontAMD:
637+ addCapability (spv::Capability::StencilExportEXT, entryPointSourceLocation);
638+ addExtension (Extension::AMD_shader_early_and_late_fragment_tests,
639+ " [[vk::stencil_ref_less_equal_front]]" ,
640+ execModeSourceLocation);
641+ addExtension (Extension::EXT_shader_stencil_export,
642+ " [[vk::stencil_ref_less_equal_front]]" ,
643+ execModeSourceLocation);
644+ break ;
645+ case spv::ExecutionMode::StencilRefUnchangedBackAMD:
646+ addCapability (spv::Capability::StencilExportEXT, entryPointSourceLocation);
647+ addExtension (Extension::AMD_shader_early_and_late_fragment_tests,
648+ " [[vk::stencil_ref_unchanged_back]]" , execModeSourceLocation);
649+ addExtension (Extension::EXT_shader_stencil_export,
650+ " [[vk::stencil_ref_unchanged_back]]" , execModeSourceLocation);
651+ break ;
652+ case spv::ExecutionMode::StencilRefGreaterBackAMD:
653+ addCapability (spv::Capability::StencilExportEXT, entryPointSourceLocation);
654+ addExtension (Extension::AMD_shader_early_and_late_fragment_tests,
655+ " [[vk::stencil_ref_greater_equal_back]]" ,
656+ execModeSourceLocation);
657+ addExtension (Extension::EXT_shader_stencil_export,
658+ " [[vk::stencil_ref_greater_equal_back]]" ,
659+ execModeSourceLocation);
660+ break ;
661+ case spv::ExecutionMode::StencilRefLessBackAMD:
662+ addCapability (spv::Capability::StencilExportEXT, entryPointSourceLocation);
663+ addExtension (Extension::AMD_shader_early_and_late_fragment_tests,
664+ " [[vk::stencil_ref_less_equal_back]]" , execModeSourceLocation);
665+ addExtension (Extension::EXT_shader_stencil_export,
666+ " [[vk::stencil_ref_less_equal_back]]" , execModeSourceLocation);
667+ break ;
668+ default :
669+ break ;
610670 }
611671 return true ;
612672}
0 commit comments