mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-21 22:34:43 +00:00
Better SPIR-V Capability checks (#1664)
* Restructure DeviceRequirement in shaderc * Add missing SPIR-V capabilities * Avoid generating a check for every instruction in the file XD
This commit is contained in:
parent
148dc78def
commit
010d7fe551
@ -262,33 +262,47 @@ where
|
||||
type_id: _,
|
||||
} => storage_class_requirement(storage_class),
|
||||
Instruction::Capability(cap) => capability_requirement(cap),
|
||||
_ => DeviceRequirement::None,
|
||||
_ => &[],
|
||||
}
|
||||
};
|
||||
|
||||
match dev_req {
|
||||
DeviceRequirement::None => continue,
|
||||
DeviceRequirement::Features(features) => {
|
||||
for feature in features {
|
||||
let ident = Ident::new(feature, Span::call_site());
|
||||
cap_checks.push(quote! {
|
||||
if !device.enabled_features().#ident {
|
||||
panic!("Device feature {:?} required", #feature);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
DeviceRequirement::Extensions(extensions) => {
|
||||
for extension in extensions {
|
||||
let ident = Ident::new(extension, Span::call_site());
|
||||
cap_checks.push(quote! {
|
||||
if !device.enabled_extensions().#ident {
|
||||
panic!("Device extension {:?} required", #extension);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if dev_req.len() == 0 {
|
||||
continue;
|
||||
}
|
||||
|
||||
let (conditions, messages): (Vec<_>, Vec<_>) = dev_req
|
||||
.iter()
|
||||
.map(|req| match req {
|
||||
DeviceRequirement::Extension(extension) => {
|
||||
let ident = Ident::new(extension, Span::call_site());
|
||||
(
|
||||
quote! { device.enabled_extensions().#ident },
|
||||
format!("extension {}", extension),
|
||||
)
|
||||
}
|
||||
DeviceRequirement::Feature(feature) => {
|
||||
let ident = Ident::new(feature, Span::call_site());
|
||||
(
|
||||
quote! { device.enabled_features().#ident },
|
||||
format!("feature {}", feature),
|
||||
)
|
||||
}
|
||||
DeviceRequirement::Version(major, minor) => {
|
||||
let ident = format_ident!("V{}_{}", major, minor);
|
||||
(
|
||||
quote! { device.api_version() >= crate::Version::#ident },
|
||||
format!("API version {}.{}", major, minor),
|
||||
)
|
||||
}
|
||||
})
|
||||
.unzip();
|
||||
let messages = messages.join(", ");
|
||||
|
||||
cap_checks.push(quote! {
|
||||
if !std::array::IntoIter::new([#(#conditions),*]).all(|x| x) {
|
||||
panic!("One of the following must be enabled on the device: {}", #messages);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// writing one method for each entry point of this module
|
||||
@ -428,103 +442,154 @@ impl From<ParseError> for Error {
|
||||
}
|
||||
|
||||
/// Returns the Vulkan device requirement for a SPIR-V `OpCapability`.
|
||||
// TODO: this function is a draft, as the actual names may not be the same
|
||||
fn capability_requirement(cap: &Capability) -> DeviceRequirement {
|
||||
#[rustfmt::skip]
|
||||
fn capability_requirement(cap: &Capability) -> &'static [DeviceRequirement] {
|
||||
match *cap {
|
||||
Capability::Matrix => DeviceRequirement::None,
|
||||
Capability::Shader => DeviceRequirement::None,
|
||||
Capability::Geometry => DeviceRequirement::Features(&["geometry_shader"]),
|
||||
Capability::Tessellation => DeviceRequirement::Features(&["tessellation_shader"]),
|
||||
Capability::Addresses => panic!(), // not supported
|
||||
Capability::Linkage => panic!(), // not supported
|
||||
Capability::Kernel => panic!(), // not supported
|
||||
Capability::Vector16 => panic!(), // not supported
|
||||
Capability::Float16Buffer => panic!(), // not supported
|
||||
Capability::Float16 => panic!(), // not supported
|
||||
Capability::Float64 => DeviceRequirement::Features(&["shader_float64"]),
|
||||
Capability::Int64 => DeviceRequirement::Features(&["shader_int64"]),
|
||||
Capability::Int64Atomics => panic!(), // not supported
|
||||
Capability::ImageBasic => panic!(), // not supported
|
||||
Capability::ImageReadWrite => panic!(), // not supported
|
||||
Capability::ImageMipmap => panic!(), // not supported
|
||||
Capability::Pipes => panic!(), // not supported
|
||||
Capability::Groups => panic!(), // not supported
|
||||
Capability::DeviceEnqueue => panic!(), // not supported
|
||||
Capability::LiteralSampler => panic!(), // not supported
|
||||
Capability::AtomicStorage => panic!(), // not supported
|
||||
Capability::Int16 => DeviceRequirement::Features(&["shader_int16"]),
|
||||
Capability::TessellationPointSize => {
|
||||
DeviceRequirement::Features(&["shader_tessellation_and_geometry_point_size"])
|
||||
}
|
||||
Capability::GeometryPointSize => {
|
||||
DeviceRequirement::Features(&["shader_tessellation_and_geometry_point_size"])
|
||||
}
|
||||
Capability::Matrix => &[],
|
||||
Capability::Shader => &[],
|
||||
Capability::InputAttachment => &[],
|
||||
Capability::Sampled1D => &[],
|
||||
Capability::Image1D => &[],
|
||||
Capability::SampledBuffer => &[],
|
||||
Capability::ImageBuffer => &[],
|
||||
Capability::ImageQuery => &[],
|
||||
Capability::DerivativeControl => &[],
|
||||
Capability::Geometry => &[DeviceRequirement::Feature("geometry_shader")],
|
||||
Capability::Tessellation => &[DeviceRequirement::Feature("tessellation_shader")],
|
||||
Capability::Float64 => &[DeviceRequirement::Feature("shader_float64")],
|
||||
Capability::Int64 => &[DeviceRequirement::Feature("shader_int64")],
|
||||
Capability::Int64Atomics => &[
|
||||
DeviceRequirement::Feature("shader_buffer_int64_atomics"),
|
||||
DeviceRequirement::Feature("shader_shared_int64_atomics"),
|
||||
DeviceRequirement::Feature("shader_image_int64_atomics"),
|
||||
],
|
||||
/* Capability::AtomicFloat16AddEXT => &[
|
||||
DeviceRequirement::Feature("shader_buffer_float16_atomic_add"),
|
||||
DeviceRequirement::Feature("shader_shared_float16_atomic_add"),
|
||||
], */
|
||||
/* Capability::AtomicFloat32AddEXT => &[
|
||||
DeviceRequirement::Feature("shader_buffer_float32_atomic_add"),
|
||||
DeviceRequirement::Feature("shader_shared_float32_atomic_add"),
|
||||
DeviceRequirement::Feature("shader_image_float32_atomic_add"),
|
||||
], */
|
||||
/* Capability::AtomicFloat64AddEXT => &[
|
||||
DeviceRequirement::Feature("shader_buffer_float64_atomic_add"),
|
||||
DeviceRequirement::Feature("shader_shared_float64_atomic_add"),
|
||||
], */
|
||||
/* Capability::AtomicFloat16MinMaxEXT => &[
|
||||
DeviceRequirement::Feature("shader_buffer_float16_atomic_min_max"),
|
||||
DeviceRequirement::Feature("shader_shared_float16_atomic_min_max"),
|
||||
], */
|
||||
/* Capability::AtomicFloat32MinMaxEXT => &[
|
||||
DeviceRequirement::Feature("shader_buffer_float32_atomic_min_max"),
|
||||
DeviceRequirement::Feature("shader_shared_float32_atomic_min_max"),
|
||||
DeviceRequirement::Feature("shader_image_float32_atomic_min_max"),
|
||||
], */
|
||||
/* Capability::AtomicFloat64MinMaxEXT => &[
|
||||
DeviceRequirement::Feature("shader_buffer_float64_atomic_min_max"),
|
||||
DeviceRequirement::Feature("shader_shared_float64_atomic_min_max"),
|
||||
], */
|
||||
// Capability::Int64ImageEXT => &[DeviceRequirement::Feature("shader_image_int64_atomics")],
|
||||
Capability::Int16 => &[DeviceRequirement::Feature("shader_int16")],
|
||||
Capability::TessellationPointSize => &[DeviceRequirement::Feature(
|
||||
"shader_tessellation_and_geometry_point_size",
|
||||
)],
|
||||
Capability::GeometryPointSize => &[DeviceRequirement::Feature(
|
||||
"shader_tessellation_and_geometry_point_size",
|
||||
)],
|
||||
Capability::ImageGatherExtended => {
|
||||
DeviceRequirement::Features(&["shader_image_gather_extended"])
|
||||
&[DeviceRequirement::Feature("shader_image_gather_extended")]
|
||||
}
|
||||
Capability::StorageImageMultisample => {
|
||||
DeviceRequirement::Features(&["shader_storage_image_multisample"])
|
||||
Capability::StorageImageMultisample => &[DeviceRequirement::Feature(
|
||||
"shader_storage_image_multisample",
|
||||
)],
|
||||
Capability::UniformBufferArrayDynamicIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_uniform_buffer_array_dynamic_indexing",
|
||||
)],
|
||||
Capability::SampledImageArrayDynamicIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_sampled_image_array_dynamic_indexing",
|
||||
)],
|
||||
Capability::StorageBufferArrayDynamicIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_storage_buffer_array_dynamic_indexing",
|
||||
)],
|
||||
Capability::StorageImageArrayDynamicIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_storage_image_array_dynamic_indexing",
|
||||
)],
|
||||
Capability::ClipDistance => &[DeviceRequirement::Feature("shader_clip_distance")],
|
||||
Capability::CullDistance => &[DeviceRequirement::Feature("shader_cull_distance")],
|
||||
Capability::ImageCubeArray => &[DeviceRequirement::Feature("image_cube_array")],
|
||||
Capability::SampleRateShading => &[DeviceRequirement::Feature("sample_rate_shading")],
|
||||
Capability::SparseResidency => &[DeviceRequirement::Feature("shader_resource_residency")],
|
||||
Capability::MinLod => &[DeviceRequirement::Feature("shader_resource_min_lod")],
|
||||
Capability::SampledCubeArray => &[DeviceRequirement::Feature("image_cube_array")],
|
||||
Capability::ImageMSArray => &[DeviceRequirement::Feature(
|
||||
"shader_storage_image_multisample",
|
||||
)],
|
||||
Capability::StorageImageExtendedFormats => &[],
|
||||
Capability::InterpolationFunction => &[DeviceRequirement::Feature("sample_rate_shading")],
|
||||
Capability::StorageImageReadWithoutFormat => &[DeviceRequirement::Feature(
|
||||
"shader_storage_image_read_without_format",
|
||||
)],
|
||||
Capability::StorageImageWriteWithoutFormat => &[DeviceRequirement::Feature(
|
||||
"shader_storage_image_write_without_format",
|
||||
)],
|
||||
Capability::MultiViewport => &[DeviceRequirement::Feature("multi_viewport")],
|
||||
Capability::DrawParameters => &[
|
||||
DeviceRequirement::Feature("shader_draw_parameters"),
|
||||
DeviceRequirement::Extension("khr_shader_draw_parameters"),
|
||||
],
|
||||
Capability::MultiView => &[DeviceRequirement::Feature("multiview")],
|
||||
Capability::DeviceGroup => &[
|
||||
DeviceRequirement::Version(1, 1),
|
||||
DeviceRequirement::Extension("khr_device_group"),
|
||||
],
|
||||
Capability::VariablePointersStorageBuffer => &[DeviceRequirement::Feature(
|
||||
"variable_pointers_storage_buffer",
|
||||
)],
|
||||
Capability::VariablePointers => &[DeviceRequirement::Feature("variable_pointers")],
|
||||
Capability::ShaderClockKHR => &[DeviceRequirement::Extension("khr_shader_clock")],
|
||||
Capability::StencilExportEXT => {
|
||||
&[DeviceRequirement::Extension("ext_shader_stencil_export")]
|
||||
}
|
||||
Capability::UniformBufferArrayDynamicIndexing => {
|
||||
DeviceRequirement::Features(&["shader_uniform_buffer_array_dynamic_indexing"])
|
||||
Capability::SubgroupBallotKHR => {
|
||||
&[DeviceRequirement::Extension("ext_shader_subgroup_ballot")]
|
||||
}
|
||||
Capability::SampledImageArrayDynamicIndexing => {
|
||||
DeviceRequirement::Features(&["shader_sampled_image_array_dynamic_indexing"])
|
||||
Capability::SubgroupVoteKHR => &[DeviceRequirement::Extension("ext_shader_subgroup_vote")],
|
||||
Capability::ImageReadWriteLodAMD => &[DeviceRequirement::Extension(
|
||||
"amd_shader_image_load_store_lod",
|
||||
)],
|
||||
Capability::ImageGatherBiasLodAMD => {
|
||||
&[DeviceRequirement::Extension("amd_texture_gather_bias_lod")]
|
||||
}
|
||||
Capability::StorageBufferArrayDynamicIndexing => {
|
||||
DeviceRequirement::Features(&["shader_storage_buffer_array_dynamic_indexing"])
|
||||
Capability::FragmentMaskAMD => &[DeviceRequirement::Extension("amd_shader_fragment_mask")],
|
||||
Capability::SampleMaskOverrideCoverageNV => &[DeviceRequirement::Extension(
|
||||
"nv_sample_mask_override_coverage",
|
||||
)],
|
||||
Capability::GeometryShaderPassthroughNV => &[DeviceRequirement::Extension(
|
||||
"nv_geometry_shader_passthrough",
|
||||
)],
|
||||
Capability::ShaderViewportIndex => {
|
||||
&[DeviceRequirement::Feature("shader_output_viewport_index")]
|
||||
}
|
||||
Capability::StorageImageArrayDynamicIndexing => {
|
||||
DeviceRequirement::Features(&["shader_storage_image_array_dynamic_indexing"])
|
||||
}
|
||||
Capability::ClipDistance => DeviceRequirement::Features(&["shader_clip_distance"]),
|
||||
Capability::CullDistance => DeviceRequirement::Features(&["shader_cull_distance"]),
|
||||
Capability::ImageCubeArray => DeviceRequirement::Features(&["image_cube_array"]),
|
||||
Capability::SampleRateShading => DeviceRequirement::Features(&["sample_rate_shading"]),
|
||||
Capability::ImageRect => panic!(), // not supported
|
||||
Capability::SampledRect => panic!(), // not supported
|
||||
Capability::GenericPointer => panic!(), // not supported
|
||||
Capability::Int8 => DeviceRequirement::Extensions(&["khr_8bit_storage"]),
|
||||
Capability::InputAttachment => DeviceRequirement::None,
|
||||
Capability::SparseResidency => DeviceRequirement::Features(&["shader_resource_residency"]),
|
||||
Capability::MinLod => DeviceRequirement::Features(&["shader_resource_min_lod"]),
|
||||
Capability::Sampled1D => DeviceRequirement::None,
|
||||
Capability::Image1D => DeviceRequirement::None,
|
||||
Capability::SampledCubeArray => DeviceRequirement::Features(&["image_cube_array"]),
|
||||
Capability::SampledBuffer => DeviceRequirement::None,
|
||||
Capability::ImageBuffer => DeviceRequirement::None,
|
||||
Capability::ImageMSArray => {
|
||||
DeviceRequirement::Features(&["shader_storage_image_multisample"])
|
||||
}
|
||||
Capability::StorageImageExtendedFormats => {
|
||||
DeviceRequirement::Features(&["shader_storage_image_extended_formats"])
|
||||
}
|
||||
Capability::ImageQuery => DeviceRequirement::None,
|
||||
Capability::DerivativeControl => DeviceRequirement::None,
|
||||
Capability::InterpolationFunction => DeviceRequirement::Features(&["sample_rate_shading"]),
|
||||
Capability::TransformFeedback => panic!(), // not supported
|
||||
Capability::GeometryStreams => panic!(), // not supported
|
||||
Capability::StorageImageReadWithoutFormat => {
|
||||
DeviceRequirement::Features(&["shader_storage_image_read_without_format"])
|
||||
}
|
||||
Capability::StorageImageWriteWithoutFormat => {
|
||||
DeviceRequirement::Features(&["shader_storage_image_write_without_format"])
|
||||
}
|
||||
Capability::MultiViewport => DeviceRequirement::Features(&["multi_viewport"]),
|
||||
Capability::DrawParameters => DeviceRequirement::Features(&["shader_draw_parameters"]),
|
||||
Capability::ShaderLayer => &[DeviceRequirement::Feature("shader_output_layer")],
|
||||
Capability::ShaderViewportIndexLayerEXT => &[
|
||||
DeviceRequirement::Extension("ext_shader_viewport_index_layer"),
|
||||
DeviceRequirement::Extension("nv_viewport_array2"),
|
||||
],
|
||||
Capability::ShaderViewportMaskNV => &[DeviceRequirement::Extension("nv_viewport_array2")],
|
||||
Capability::PerViewAttributesNV => &[DeviceRequirement::Extension(
|
||||
"nvx_multiview_per_view_attributes",
|
||||
)],
|
||||
Capability::StorageBuffer16BitAccess => {
|
||||
DeviceRequirement::Extensions(&["khr_16bit_storage"])
|
||||
&[DeviceRequirement::Feature("storage_buffer16_bit_access")]
|
||||
}
|
||||
Capability::UniformAndStorageBuffer16BitAccess => {
|
||||
DeviceRequirement::Extensions(&["khr_16bit_storage"])
|
||||
Capability::UniformAndStorageBuffer16BitAccess => &[DeviceRequirement::Feature(
|
||||
"uniform_and_storage_buffer16_bit_access",
|
||||
)],
|
||||
Capability::StoragePushConstant16 => {
|
||||
&[DeviceRequirement::Feature("storage_push_constant16")]
|
||||
}
|
||||
Capability::StoragePushConstant16 => DeviceRequirement::Extensions(&["khr_16bit_storage"]),
|
||||
Capability::StorageInputOutput16 => DeviceRequirement::Extensions(&["khr_16bit_storage"]),
|
||||
Capability::MultiView => DeviceRequirement::Features(&["multiview"]),
|
||||
Capability::StoragePushConstant8 => DeviceRequirement::Extensions(&["khr_8bit_storage"]),
|
||||
Capability::SubgroupDispatch => todo!(),
|
||||
Capability::NamedBarrier => todo!(),
|
||||
Capability::PipeStorage => todo!(),
|
||||
Capability::StorageInputOutput16 => &[DeviceRequirement::Feature("storage_input_output16")],
|
||||
Capability::GroupNonUniform => todo!(),
|
||||
Capability::GroupNonUniformVote => todo!(),
|
||||
Capability::GroupNonUniformArithmetic => todo!(),
|
||||
@ -533,98 +598,170 @@ fn capability_requirement(cap: &Capability) -> DeviceRequirement {
|
||||
Capability::GroupNonUniformShuffleRelative => todo!(),
|
||||
Capability::GroupNonUniformClustered => todo!(),
|
||||
Capability::GroupNonUniformQuad => todo!(),
|
||||
Capability::ShaderLayer => todo!(),
|
||||
Capability::ShaderViewportIndex => todo!(),
|
||||
Capability::SubgroupBallotKHR => todo!(),
|
||||
Capability::SubgroupVoteKHR => todo!(),
|
||||
Capability::DeviceGroup => todo!(),
|
||||
Capability::VariablePointersStorageBuffer => todo!(),
|
||||
Capability::VariablePointers => todo!(),
|
||||
Capability::AtomicStorageOps => todo!(),
|
||||
Capability::SampleMaskPostDepthCoverage => todo!(),
|
||||
Capability::StorageBuffer8BitAccess => todo!(),
|
||||
Capability::UniformAndStorageBuffer8BitAccess => {
|
||||
DeviceRequirement::Extensions(&["khr_8bit_storage"])
|
||||
Capability::GroupNonUniformPartitionedNV => todo!(),
|
||||
Capability::SampleMaskPostDepthCoverage => {
|
||||
&[DeviceRequirement::Extension("ext_post_depth_coverage")]
|
||||
}
|
||||
Capability::ShaderNonUniform => &[
|
||||
DeviceRequirement::Version(1, 2),
|
||||
DeviceRequirement::Extension("ext_descriptor_indexing"),
|
||||
],
|
||||
Capability::RuntimeDescriptorArray => {
|
||||
&[DeviceRequirement::Feature("runtime_descriptor_array")]
|
||||
}
|
||||
Capability::InputAttachmentArrayDynamicIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_input_attachment_array_dynamic_indexing",
|
||||
)],
|
||||
Capability::UniformTexelBufferArrayDynamicIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_uniform_texel_buffer_array_dynamic_indexing",
|
||||
)],
|
||||
Capability::StorageTexelBufferArrayDynamicIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_storage_texel_buffer_array_dynamic_indexing",
|
||||
)],
|
||||
Capability::UniformBufferArrayNonUniformIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_uniform_buffer_array_non_uniform_indexing",
|
||||
)],
|
||||
Capability::SampledImageArrayNonUniformIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_sampled_image_array_non_uniform_indexing",
|
||||
)],
|
||||
Capability::StorageBufferArrayNonUniformIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_storage_buffer_array_non_uniform_indexing",
|
||||
)],
|
||||
Capability::StorageImageArrayNonUniformIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_storage_image_array_non_uniform_indexing",
|
||||
)],
|
||||
Capability::InputAttachmentArrayNonUniformIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_input_attachment_array_non_uniform_indexing",
|
||||
)],
|
||||
Capability::UniformTexelBufferArrayNonUniformIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_uniform_texel_buffer_array_non_uniform_indexing",
|
||||
)],
|
||||
Capability::StorageTexelBufferArrayNonUniformIndexing => &[DeviceRequirement::Feature(
|
||||
"shader_storage_texel_buffer_array_non_uniform_indexing",
|
||||
)],
|
||||
Capability::Float16 => &[
|
||||
DeviceRequirement::Feature("shader_float16"),
|
||||
DeviceRequirement::Extension("amd_gpu_shader_half_float"),
|
||||
],
|
||||
Capability::Int8 => &[DeviceRequirement::Feature("shader_int8")],
|
||||
Capability::StorageBuffer8BitAccess => {
|
||||
&[DeviceRequirement::Feature("storage_buffer8_bit_access")]
|
||||
}
|
||||
Capability::UniformAndStorageBuffer8BitAccess => &[DeviceRequirement::Feature(
|
||||
"uniform_and_storage_buffer8_bit_access",
|
||||
)],
|
||||
Capability::StoragePushConstant8 => &[DeviceRequirement::Feature("storage_push_constant8")],
|
||||
Capability::VulkanMemoryModel => &[DeviceRequirement::Feature("vulkan_memory_model")],
|
||||
Capability::VulkanMemoryModelDeviceScope => &[DeviceRequirement::Feature(
|
||||
"vulkan_memory_model_device_scope",
|
||||
)],
|
||||
Capability::DenormPreserve => todo!(),
|
||||
Capability::DenormFlushToZero => todo!(),
|
||||
Capability::SignedZeroInfNanPreserve => todo!(),
|
||||
Capability::RoundingModeRTE => todo!(),
|
||||
Capability::RoundingModeRTZ => todo!(),
|
||||
Capability::RayQueryProvisionalKHR => todo!(),
|
||||
Capability::RayTraversalPrimitiveCullingProvisionalKHR => todo!(),
|
||||
Capability::Float16ImageAMD => todo!(),
|
||||
Capability::ImageGatherBiasLodAMD => todo!(),
|
||||
Capability::FragmentMaskAMD => todo!(),
|
||||
Capability::StencilExportEXT => todo!(),
|
||||
Capability::ImageReadWriteLodAMD => todo!(),
|
||||
Capability::ShaderClockKHR => todo!(),
|
||||
Capability::SampleMaskOverrideCoverageNV => todo!(),
|
||||
Capability::GeometryShaderPassthroughNV => todo!(),
|
||||
Capability::ShaderViewportIndexLayerEXT => todo!(),
|
||||
Capability::ShaderViewportMaskNV => todo!(),
|
||||
Capability::ShaderStereoViewNV => todo!(),
|
||||
Capability::PerViewAttributesNV => todo!(),
|
||||
Capability::FragmentFullyCoveredEXT => todo!(),
|
||||
Capability::MeshShadingNV => todo!(),
|
||||
Capability::ImageFootprintNV => todo!(),
|
||||
Capability::FragmentBarycentricNV => todo!(),
|
||||
Capability::ComputeDerivativeGroupQuadsNV => todo!(),
|
||||
Capability::FragmentDensityEXT => todo!(),
|
||||
Capability::GroupNonUniformPartitionedNV => todo!(),
|
||||
Capability::ShaderNonUniform => todo!(),
|
||||
Capability::RuntimeDescriptorArray => todo!(),
|
||||
Capability::InputAttachmentArrayDynamicIndexing => todo!(),
|
||||
Capability::UniformTexelBufferArrayDynamicIndexing => todo!(),
|
||||
Capability::StorageTexelBufferArrayDynamicIndexing => todo!(),
|
||||
Capability::UniformBufferArrayNonUniformIndexing => todo!(),
|
||||
Capability::SampledImageArrayNonUniformIndexing => todo!(),
|
||||
Capability::StorageBufferArrayNonUniformIndexing => todo!(),
|
||||
Capability::StorageImageArrayNonUniformIndexing => todo!(),
|
||||
Capability::InputAttachmentArrayNonUniformIndexing => todo!(),
|
||||
Capability::UniformTexelBufferArrayNonUniformIndexing => todo!(),
|
||||
Capability::StorageTexelBufferArrayNonUniformIndexing => todo!(),
|
||||
Capability::RayTracingNV => todo!(),
|
||||
Capability::VulkanMemoryModel => todo!(),
|
||||
Capability::VulkanMemoryModelDeviceScope => todo!(),
|
||||
Capability::PhysicalStorageBufferAddresses => todo!(),
|
||||
Capability::ComputeDerivativeGroupLinearNV => todo!(),
|
||||
Capability::RayTracingProvisionalKHR => todo!(),
|
||||
Capability::CooperativeMatrixNV => todo!(),
|
||||
Capability::FragmentShaderSampleInterlockEXT => todo!(),
|
||||
Capability::FragmentShaderShadingRateInterlockEXT => todo!(),
|
||||
Capability::ShaderSMBuiltinsNV => todo!(),
|
||||
Capability::FragmentShaderPixelInterlockEXT => todo!(),
|
||||
Capability::DemoteToHelperInvocationEXT => todo!(),
|
||||
Capability::SubgroupShuffleINTEL => todo!(),
|
||||
Capability::SubgroupBufferBlockIOINTEL => todo!(),
|
||||
Capability::SubgroupImageBlockIOINTEL => todo!(),
|
||||
Capability::SubgroupImageMediaBlockIOINTEL => todo!(),
|
||||
Capability::IntegerFunctions2INTEL => todo!(),
|
||||
Capability::SubgroupAvcMotionEstimationINTEL => todo!(),
|
||||
Capability::SubgroupAvcMotionEstimationIntraINTEL => todo!(),
|
||||
Capability::SubgroupAvcMotionEstimationChromaINTEL => todo!(),
|
||||
Capability::ComputeDerivativeGroupQuadsNV => {
|
||||
&[DeviceRequirement::Feature("compute_derivative_group_quads")]
|
||||
}
|
||||
Capability::ComputeDerivativeGroupLinearNV => &[DeviceRequirement::Feature(
|
||||
"compute_derivative_group_linear",
|
||||
)],
|
||||
Capability::FragmentBarycentricNV => {
|
||||
&[DeviceRequirement::Feature("fragment_shader_barycentric")]
|
||||
}
|
||||
Capability::ImageFootprintNV => &[DeviceRequirement::Feature("image_footprint")],
|
||||
Capability::MeshShadingNV => &[DeviceRequirement::Extension("nv_mesh_shader")],
|
||||
Capability::RayTracingProvisionalKHR => {
|
||||
&[DeviceRequirement::Feature("ray_tracing_pipeline")]
|
||||
}
|
||||
Capability::RayQueryProvisionalKHR => &[DeviceRequirement::Feature("ray_query")],
|
||||
Capability::RayTraversalPrimitiveCullingProvisionalKHR => &[DeviceRequirement::Feature(
|
||||
"ray_traversal_primitive_culling",
|
||||
)],
|
||||
Capability::RayTracingNV => &[DeviceRequirement::Extension("nv_ray_tracing")],
|
||||
// Capability::RayTracingMotionBlurNV => &[DeviceRequirement::Feature("ray_tracing_motion_blur")],
|
||||
Capability::TransformFeedback => &[DeviceRequirement::Feature("transform_feedback")],
|
||||
Capability::GeometryStreams => &[DeviceRequirement::Feature("geometry_streams")],
|
||||
Capability::FragmentDensityEXT => &[
|
||||
DeviceRequirement::Feature("fragment_density_map"),
|
||||
DeviceRequirement::Feature("shading_rate_image"),
|
||||
],
|
||||
Capability::PhysicalStorageBufferAddresses => {
|
||||
&[DeviceRequirement::Feature("buffer_device_address")]
|
||||
}
|
||||
Capability::CooperativeMatrixNV => &[DeviceRequirement::Feature("cooperative_matrix")],
|
||||
Capability::IntegerFunctions2INTEL => {
|
||||
&[DeviceRequirement::Feature("shader_integer_functions2")]
|
||||
}
|
||||
Capability::ShaderSMBuiltinsNV => &[DeviceRequirement::Feature("shader_sm_builtins")],
|
||||
Capability::FragmentShaderSampleInterlockEXT => &[DeviceRequirement::Feature(
|
||||
"fragment_shader_sample_interlock",
|
||||
)],
|
||||
Capability::FragmentShaderPixelInterlockEXT => &[DeviceRequirement::Feature(
|
||||
"fragment_shader_pixel_interlock",
|
||||
)],
|
||||
Capability::FragmentShaderShadingRateInterlockEXT => &[
|
||||
DeviceRequirement::Feature("fragment_shader_shading_rate_interlock"),
|
||||
DeviceRequirement::Feature("shading_rate_image"),
|
||||
],
|
||||
Capability::DemoteToHelperInvocationEXT => &[DeviceRequirement::Feature(
|
||||
"shader_demote_to_helper_invocation",
|
||||
)],
|
||||
// Capability::FragmentShadingRateKHR => &[DeviceRequirement::Feature("pipeline_fragment_shading_rate"), DeviceRequirement::Feature("primitive_fragment_shading_rate"), DeviceRequirement::Feature("attachment_fragment_shading_rate")],
|
||||
// Capability::WorkgroupMemoryExplicitLayoutKHR => &[DeviceRequirement::Feature("workgroup_memory_explicit_layout")],
|
||||
// Capability::WorkgroupMemoryExplicitLayout8BitAccessKHR => &[DeviceRequirement::Feature("workgroup_memory_explicit_layout8_bit_access")],
|
||||
// Capability::WorkgroupMemoryExplicitLayout16BitAccessKHR => &[DeviceRequirement::Feature("workgroup_memory_explicit_layout16_bit_access")],
|
||||
Capability::Addresses => panic!(), // not supported
|
||||
Capability::Linkage => panic!(), // not supported
|
||||
Capability::Kernel => panic!(), // not supported
|
||||
Capability::Vector16 => panic!(), // not supported
|
||||
Capability::Float16Buffer => panic!(), // not supported
|
||||
Capability::ImageBasic => panic!(), // not supported
|
||||
Capability::ImageReadWrite => panic!(), // not supported
|
||||
Capability::ImageMipmap => panic!(), // not supported
|
||||
Capability::Pipes => panic!(), // not supported
|
||||
Capability::Groups => panic!(), // not supported
|
||||
Capability::DeviceEnqueue => panic!(), // not supported
|
||||
Capability::LiteralSampler => panic!(), // not supported
|
||||
Capability::AtomicStorage => panic!(), // not supported
|
||||
Capability::ImageRect => panic!(), // not supported
|
||||
Capability::SampledRect => panic!(), // not supported
|
||||
Capability::GenericPointer => panic!(), // not supported
|
||||
Capability::SubgroupDispatch => panic!(), // not supported,
|
||||
Capability::NamedBarrier => panic!(), // not supported,
|
||||
Capability::PipeStorage => panic!(), // not supported,
|
||||
Capability::AtomicStorageOps => panic!(), // not supported,
|
||||
Capability::Float16ImageAMD => panic!(), // not supported,
|
||||
Capability::ShaderStereoViewNV => panic!(), // not supported,
|
||||
Capability::FragmentFullyCoveredEXT => panic!(), // not supported,
|
||||
Capability::SubgroupShuffleINTEL => panic!(), // not supported,
|
||||
Capability::SubgroupBufferBlockIOINTEL => panic!(), // not supported,
|
||||
Capability::SubgroupImageBlockIOINTEL => panic!(), // not supported,
|
||||
Capability::SubgroupImageMediaBlockIOINTEL => panic!(), // not supported,
|
||||
Capability::SubgroupAvcMotionEstimationINTEL => panic!(), // not supported,
|
||||
Capability::SubgroupAvcMotionEstimationIntraINTEL => panic!(), // not supported,
|
||||
Capability::SubgroupAvcMotionEstimationChromaINTEL => panic!(), // not supported,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the Vulkan device requirement for a SPIR-V storage class.
|
||||
fn storage_class_requirement(storage_class: &StorageClass) -> DeviceRequirement {
|
||||
fn storage_class_requirement(storage_class: &StorageClass) -> &'static [DeviceRequirement] {
|
||||
match *storage_class {
|
||||
StorageClass::UniformConstant => DeviceRequirement::None,
|
||||
StorageClass::Input => DeviceRequirement::None,
|
||||
StorageClass::Uniform => DeviceRequirement::None,
|
||||
StorageClass::Output => DeviceRequirement::None,
|
||||
StorageClass::Workgroup => DeviceRequirement::None,
|
||||
StorageClass::CrossWorkgroup => DeviceRequirement::None,
|
||||
StorageClass::Private => DeviceRequirement::None,
|
||||
StorageClass::Function => DeviceRequirement::None,
|
||||
StorageClass::Generic => DeviceRequirement::None,
|
||||
StorageClass::PushConstant => DeviceRequirement::None,
|
||||
StorageClass::AtomicCounter => DeviceRequirement::None,
|
||||
StorageClass::Image => DeviceRequirement::None,
|
||||
StorageClass::StorageBuffer => {
|
||||
DeviceRequirement::Extensions(&["khr_storage_buffer_storage_class"])
|
||||
}
|
||||
StorageClass::UniformConstant => &[],
|
||||
StorageClass::Input => &[],
|
||||
StorageClass::Uniform => &[],
|
||||
StorageClass::Output => &[],
|
||||
StorageClass::Workgroup => &[],
|
||||
StorageClass::CrossWorkgroup => &[],
|
||||
StorageClass::Private => &[],
|
||||
StorageClass::Function => &[],
|
||||
StorageClass::Generic => &[],
|
||||
StorageClass::PushConstant => &[],
|
||||
StorageClass::AtomicCounter => &[],
|
||||
StorageClass::Image => &[],
|
||||
StorageClass::StorageBuffer => &[DeviceRequirement::Extension(
|
||||
"khr_storage_buffer_storage_class",
|
||||
)],
|
||||
StorageClass::CallableDataNV => todo!(),
|
||||
StorageClass::IncomingCallableDataNV => todo!(),
|
||||
StorageClass::RayPayloadNV => todo!(),
|
||||
@ -636,9 +773,9 @@ fn storage_class_requirement(storage_class: &StorageClass) -> DeviceRequirement
|
||||
}
|
||||
|
||||
enum DeviceRequirement {
|
||||
None,
|
||||
Features(&'static [&'static str]),
|
||||
Extensions(&'static [&'static str]),
|
||||
Feature(&'static str),
|
||||
Extension(&'static str),
|
||||
Version(u32, u32),
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
Loading…
Reference in New Issue
Block a user