diff --git a/crates/metal2vulkan-rt/README.md b/crates/metal2vulkan-rt/README.md index 8798c5760..f271fa184 100644 --- a/crates/metal2vulkan-rt/README.md +++ b/crates/metal2vulkan-rt/README.md @@ -1193,6 +1193,8 @@ Presenting runs on the runtime's own device; nothing is exported or imported. | `subgroupSizeControl` | `VkPhysicalDeviceVulkan13Features` | a kernel's SIMD groups at Metal's width of 32, where the device lists compute in `requiredSubgroupSizeStages` | | `computeFullSubgroups` | `VkPhysicalDeviceVulkan13Features` | a kernel's subgroups required full, so each SIMD group is one subgroup | | `robustImageAccess` | `VkPhysicalDeviceVulkan13Features` | an image write or atomic out of range dropped and a read out of range zero, with no guard in the shader | +| `independentBlend` | `VkPhysicalDeviceFeatures` | each color attachment of a render pipeline blended by its own state, as Metal's are | +| `fragmentStoresAndAtomics` | `VkPhysicalDeviceFeatures` | a fragment function's writes and atomics on device memory | | `timelineSemaphore` | `VkPhysicalDeviceVulkan12Features` | submission and completion | | `hostQueryReset` | `VkPhysicalDeviceVulkan12Features` | a command buffer's timestamp queries reset on the host as it retires | | `synchronization2` | `VkPhysicalDeviceVulkan13Features` | barriers, layout changes and submission | diff --git a/crates/metal2vulkan-rt/src/floor.rs b/crates/metal2vulkan-rt/src/floor.rs index 30014ca10..d5bcb6836 100644 --- a/crates/metal2vulkan-rt/src/floor.rs +++ b/crates/metal2vulkan-rt/src/floor.rs @@ -269,6 +269,11 @@ pub(crate) const REQUIRED: &[Feature] = &[ // An image access out of range: a write or an atomic is dropped and a read answers zero, as // Metal's, with no guard in the shader. Vulkan 1.3's. feature!(vulkan13.robust_image_access => RobustImageAccess), + // A render pipeline's color attachments blend each by its own state, as Metal's do, and a + // fragment function writes and atomically updates device memory, as Metal's may. Vulkan 1.4 + // requires both of every graphics device. + feature!(core.independent_blend => IndependentBlend), + feature!(core.fragment_stores_and_atomics => FragmentStoresAndAtomics), // Submission, barriers and render passes. feature!(vulkan12.timeline_semaphore), // GPU times: a command buffer's two timestamp queries reset on the host as it retires, so no diff --git a/crates/metal2vulkan-rt/src/tests/floor.rs b/crates/metal2vulkan-rt/src/tests/floor.rs index 7bf7830ce..0523b3dab 100644 --- a/crates/metal2vulkan-rt/src/tests/floor.rs +++ b/crates/metal2vulkan-rt/src/tests/floor.rs @@ -66,6 +66,8 @@ fn at_the_floor() -> Queried { features.vulkan13.subgroup_size_control = vk::TRUE; features.vulkan13.compute_full_subgroups = vk::TRUE; features.vulkan13.robust_image_access = vk::TRUE; + features.core.independent_blend = vk::TRUE; + features.core.fragment_stores_and_atomics = vk::TRUE; features.vulkan12.timeline_semaphore = vk::TRUE; features.vulkan12.host_query_reset = vk::TRUE; features.vulkan13.synchronization2 = vk::TRUE; @@ -132,8 +134,9 @@ fn holds(features: &Features, feature: &crate::floor::Feature) -> bool { /// The translator's description is restricted to what device creation enables: a feature or an /// extension the device reports beyond the floor is outside the enable set, so the translator's -/// profile never relies on it, and the floor's `robustImageAccess` and `nullDescriptor` are in it. -/// `VK_EXT_robustness2`'s robust buffer and image access stay off where the device reports them. +/// profile never relies on it, and the floor's `robustImageAccess`, `independentBlend`, +/// `fragmentStoresAndAtomics` and `nullDescriptor` are in it. `VK_EXT_robustness2`'s robust buffer +/// and image access stay off where the device reports them. #[test] fn the_translator_sees_only_what_device_creation_enables() { use crate::floor::shader_enables; @@ -155,6 +158,10 @@ fn the_translator_sees_only_what_device_creation_enables() { ); let enables = shader_enables(&capabilities); assert!(enables.features.contains(&VkFeature::RobustImageAccess)); + assert!(enables.features.contains(&VkFeature::IndependentBlend)); + assert!(enables + .features + .contains(&VkFeature::FragmentStoresAndAtomics)); assert!(enables.features.contains(&VkFeature::NullDescriptor)); for reported in [ VkFeature::GeometryShader, @@ -209,6 +216,8 @@ fn a_device_at_the_floor_is_above_it() { assert_eq!(enabled.vulkan11.storage_input_output16, vk::FALSE); assert_eq!(enabled.vulkan12.sampler_mirror_clamp_to_edge, vk::FALSE); assert_eq!(enabled.vulkan13.robust_image_access, vk::TRUE); + assert_eq!(enabled.core.independent_blend, vk::TRUE); + assert_eq!(enabled.core.fragment_stores_and_atomics, vk::TRUE); } #[test] @@ -219,7 +228,7 @@ fn each_missing_feature_is_named() { const CORE: &str = "VkPhysicalDeviceFeatures"; const ROBUSTNESS2: &str = "VkPhysicalDeviceRobustness2FeaturesEXT"; type Clear = fn(&mut Features); - let cases: [(Clear, Missing); 29] = [ + let cases: [(Clear, Missing); 31] = [ ( |f| f.vulkan12.buffer_device_address = vk::FALSE, feature(V12, "bufferDeviceAddress"), @@ -326,6 +335,14 @@ fn each_missing_feature_is_named() { |f| f.vulkan13.robust_image_access = vk::FALSE, feature(V13, "robustImageAccess"), ), + ( + |f| f.core.independent_blend = vk::FALSE, + feature(CORE, "independentBlend"), + ), + ( + |f| f.core.fragment_stores_and_atomics = vk::FALSE, + feature(CORE, "fragmentStoresAndAtomics"), + ), ( |f| f.vulkan13.synchronization2 = vk::FALSE, feature(V13, "synchronization2"),