diff --git a/crates/metal2vulkan-runtime/src/tests/feature_enables.rs b/crates/metal2vulkan-runtime/src/tests/feature_enables.rs index d18179a55..cb7987093 100644 --- a/crates/metal2vulkan-runtime/src/tests/feature_enables.rs +++ b/crates/metal2vulkan-runtime/src/tests/feature_enables.rs @@ -132,6 +132,57 @@ fn every_feature_creation_enables_reaches_the_translator() { ); } +/// On a device that lists `VK_KHR_portability_subset`, each portability feature the translator +/// names and the device states reaches the translator's description, as on a device without the +/// subset, which offers each by Vulkan's definition: the translator then refuses only what the +/// device lacks. +#[test] +fn a_portability_device_gives_the_translator_each_portability_feature_it_states() { + let mut device = at_the_floor(); + device + .extensions + .push(ash::khr::portability_subset::NAME.to_owned()); + device.features.portability = vk::PhysicalDevicePortabilitySubsetFeaturesKHR { + constant_alpha_color_blend_factors: vk::TRUE, + events: vk::TRUE, + image_view_format_reinterpretation: vk::TRUE, + image_view_format_swizzle: vk::TRUE, + image_view2_d_on3_d_image: vk::TRUE, + multisample_array_image: vk::TRUE, + mutable_comparison_samplers: vk::TRUE, + point_polygons: vk::TRUE, + sampler_mip_lod_bias: vk::TRUE, + separate_stencil_mask_ref: vk::TRUE, + shader_sample_rate_interpolation_functions: vk::TRUE, + tessellation_isolines: vk::TRUE, + tessellation_point_mode: vk::TRUE, + triangle_fans: vk::TRUE, + vertex_attribute_access_beyond_stride: vk::TRUE, + ..Default::default() + }; + let capabilities = decide(&device).unwrap_or_else(|below| panic!("{below}")); + let enables = shader_enables(&capabilities); + let named = [ + VkFeature::ConstantAlphaColorBlendFactors, + VkFeature::VertexAttributeAccessBeyondStride, + VkFeature::SamplerMipLodBias, + VkFeature::MutableComparisonSamplers, + VkFeature::ShaderSampleRateInterpolationFunctions, + VkFeature::MultisampleArrayImage, + VkFeature::ImageView2DOn3DImage, + VkFeature::SeparateStencilMaskRef, + VkFeature::ImageViewFormatSwizzle, + VkFeature::PointPolygons, + ]; + let unstated: Vec = (named.into_iter()) + .filter(|feature| !enables.features.contains(feature)) + .collect(); + assert!( + unstated.is_empty(), + "stated by the device and named by the translator, not passed: {unstated:?}" + ); +} + /// The enable set is what the translator's description states as enabled on a device that /// reports every feature of creation's tables, lists every extension creation may enable and has /// the descriptor room of the attachment reads and of set 0's kernel storage buffers: it holds