From 7a3fe46a33dbad862d3de7e4ad2642a19d5fbb1c Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Tue, 17 Nov 2026 08:47:19 -0800 Subject: [PATCH] metal2vulkan-rt: SIMD groups, the fifth query-chosen feature; isolation its own known gap VK_KHR_shader_maximal_reconvergence and VK_KHR_shader_subgroup_uniform_control_flow are optional extensions, enabled where the device lists them, with their features read and enabled only then (floor::OPTIONAL_EXTENSIONS, two more floor::Features structures, Capabilities::maximal_reconvergence and subgroup_uniform_control_flow, Capabilities::extensions now the enabled list). The translator's enable set takes each enabled extension it names, so its description sees them. The README's Chosen by a query names five features, with the SIMD groups' queries and what they decide; the extension and optional feature tables gain their rows, which tests::floor holds equal to the code. The README's known gap of guest-process isolation is its own bullet, apart from the read-back rule. Tests: tests::floor an_optional_extension_is_enabled_where_listed, and the optional-feature cases for the two new features. --- crates/metal2vulkan-rt/README.md | 29 +++-- crates/metal2vulkan-rt/src/device.rs | 22 +++- crates/metal2vulkan-rt/src/extension.rs | 6 +- crates/metal2vulkan-rt/src/floor.rs | 115 ++++++++++++++++--- crates/metal2vulkan-rt/src/tests/floor.rs | 47 +++++++- crates/metal2vulkan/tests/api_signatures.tsv | 8 +- 6 files changed, 187 insertions(+), 40 deletions(-) diff --git a/crates/metal2vulkan-rt/README.md b/crates/metal2vulkan-rt/README.md index c598b73d2..9285c046e 100644 --- a/crates/metal2vulkan-rt/README.md +++ b/crates/metal2vulkan-rt/README.md @@ -179,10 +179,14 @@ that touch blocks first. the two timestamp queries of a command buffer, which decide only its `gpu_start_time`, through arithmetic defined for every value and never later than its `gpu_end_time`. The parameter ring and an indirect dispatch's arguments are read only by the GPU: the runtime writes the ring and - never reads it back, and never reads the arguments. One device serves - every guest process and shaders use raw device addresses, so a guest shader can reach any guest - process's memory on the device; the runtime does not isolate processes from each other, and - the old runtime did not either. + never reads it back, and never reads the arguments. +- Guest processes are not isolated from each other. One device serves every guest process, and + shaders use raw device addresses, so a guest shader can read and write any memory on the + device: other processes' buffers and textures, and the host's own resources there. The runtime + does not isolate processes, and the old runtime does not either: measured, one guest process + read and overwrote another's Shared buffer, Private buffer and texture through addresses and + resource IDs it made up, with no fault. The consumer treats every byte on the device as + guest-writable and keeps nothing there that it parses or trusts. - Presenting (the binary semaphore a command buffer signals for a present) comes with presenting. - An indirect dispatch's threadgroup counts are the GPU's to read, so a count above the device's `maxComputeWorkGroupCount` is not refused; Vulkan leaves such a dispatch undefined. A direct @@ -282,6 +286,8 @@ Presenting runs on the runtime's own device; nothing is exported or imported. | `VK_KHR_surface` | instance | presenting | | `VK_KHR_swapchain` | device | presenting | | `VK_KHR_workgroup_memory_explicit_layout` | device | threadgroup memory laid out as Metal lays it | +| `VK_KHR_shader_maximal_reconvergence` | device, where listed | SIMD groups that reconverge as Metal's do | +| `VK_KHR_shader_subgroup_uniform_control_flow` | device, where listed | SIMD groups' reconvergence where maximal reconvergence is not offered | ### Features @@ -360,9 +366,16 @@ only for a created device, so `PhysicalDevice::check` finds a type with each set ### Chosen by a query -Four features choose between two forms by the device's answer, and no other feature does. -`floor::Capabilities` holds each answer, and the features to enable: the floor's, and each -optional one the device has. +Five features choose between two forms by the device's answer, and no other feature does: 16-bit +floats, storage-image reads without a format, 64-bit atomics, 64-bit floats and SIMD groups. +`floor::Capabilities` holds each answer the floor reads, and the features and extensions to +enable: the floor's, and each optional one the device has. + +| Feature | Queries | Used for | +|---|---|---| +| SIMD groups | `minSubgroupSize`, `maxSubgroupSize` and `requiredSubgroupSizeStages` (`VkPhysicalDeviceVulkan13Properties`); `subgroupSupportedStages` and `subgroupSupportedOperations` (`VkPhysicalDeviceVulkan11Properties`); `shaderMaximalReconvergence` (`VK_KHR_shader_maximal_reconvergence`) and `shaderSubgroupUniformControlFlow` (`VK_KHR_shader_subgroup_uniform_control_flow`) | the translator's choice of how a kernel's SIMD groups run (its tier), and their reconvergence mode: maximal where offered, else subgroup-uniform control flow where offered | + +The other four are one feature each: | Optional feature | Structure | Used for | |---|---|---| @@ -371,6 +384,8 @@ optional one the device has. | `shaderBufferInt64Atomics` | `VkPhysicalDeviceVulkan12Features` | 64-bit atomics on buffers | | `shaderSharedInt64Atomics` | `VkPhysicalDeviceVulkan12Features` | 64-bit atomics on threadgroup memory | | `shaderFloat64` | `VkPhysicalDeviceFeatures` | 64-bit floats | +| `shaderMaximalReconvergence` | `VkPhysicalDeviceShaderMaximalReconvergenceFeaturesKHR` | SIMD groups that reconverge as Metal's do | +| `shaderSubgroupUniformControlFlow` | `VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR` | SIMD groups' reconvergence where maximal reconvergence is not offered | The test `tests::floor` holds these tables equal to the code, checks that each missing item is named, and, under `--cfg m2v_gpu` or `--cfg m2v_cpu_icd`, checks every device the machine's diff --git a/crates/metal2vulkan-rt/src/device.rs b/crates/metal2vulkan-rt/src/device.rs index 69491e75e..0ce7bb48f 100644 --- a/crates/metal2vulkan-rt/src/device.rs +++ b/crates/metal2vulkan-rt/src/device.rs @@ -201,7 +201,7 @@ impl Device { /// `MTLCreateSystemDefaultDevice`, for the physical device the consumer chose. /// /// Checks the floor ([`PhysicalDevice::check`]), then makes one `VkDevice` with the floor's - /// features and extensions, each of the four query-decided features the device has, and each + /// features and extensions, each of the optional features and extensions the device has, and each /// of the consumer's extensions ([`DeviceOptions::extensions`]) the device offers with the /// features the consumer needs, and chooses its memory types on it. It takes one queue of the floor's queue /// family for the runtime and, where that family has a second queue, a queue for presenting; @@ -218,7 +218,7 @@ impl Device { let raw = physical.raw(); let capabilities = physical.check().map_err(Error::BelowFloor)?; // SAFETY: `raw` is the instance's, which was made at the floor's version. - let translator = unsafe { translator(vk_instance, raw, &capabilities.features) }?; + let translator = unsafe { translator(vk_instance, raw, &capabilities) }?; let family = capabilities.queue_family; // SAFETY: as above. let families = unsafe { vk_instance.get_physical_device_queue_family_properties(raw) }; @@ -237,6 +237,8 @@ impl Device { mut vulkan12, mut vulkan13, mut workgroup_layout, + mut maximal_reconvergence, + mut subgroup_uniform_control_flow, } = capabilities.features; let mut features = vk::PhysicalDeviceFeatures2::default() .features(core) @@ -244,6 +246,14 @@ impl Device { .push_next(&mut vulkan12) .push_next(&mut vulkan13) .push_next(&mut workgroup_layout); + // An optional extension's structure goes in only where the extension is enabled. + let enabled = |name: &std::ffi::CStr| capabilities.extensions.contains(&name); + if enabled(ash::khr::shader_maximal_reconvergence::NAME) { + features = features.push_next(&mut maximal_reconvergence); + } + if enabled(ash::khr::shader_subgroup_uniform_control_flow::NAME) { + features = features.push_next(&mut subgroup_uniform_control_flow); + } // SAFETY: as for the floor check. let listed = unsafe { vk_instance.enumerate_device_extension_properties(raw) } .map_err(Error::vulkan("vkEnumerateDeviceExtensionProperties"))?; @@ -253,7 +263,7 @@ impl Device { vk_instance, raw, &listed, - capabilities.extensions, + &capabilities.extensions, &options.extensions, ) }; @@ -647,7 +657,7 @@ fn finish(runner: Option, core: &Arc, deadline: Option) - /// # Safety /// /// `device` was made with `capabilities.features`, and `family` is its queues' family. -/// The translator for `raw` with what device creation enables with `features`, under the identity +/// The translator for `raw` with what device creation enables of `capabilities`, under the identity /// domains: a buffer argument is the guest's address of the buffer, a push field, and a texture or /// a sampler its resource ID. It is decided by the device's Vulkan queries alone /// (`Device::from_queries`): no driver or GPU identity, and no fact measured on one, applies. @@ -658,13 +668,13 @@ fn finish(runner: Option, core: &Arc, deadline: Option) - unsafe fn translator( instance: &ash::Instance, raw: vk::PhysicalDevice, - features: &floor::Features, + capabilities: &floor::Capabilities, ) -> Result { // SAFETY: the caller's contract. let described = unsafe { DeviceDescription::query(instance, raw, ApiVersion::from_packed(floor::VERSION)) }; let description = described - .and_then(|description| description.with_enabled(&floor::shader_enables(features))) + .and_then(|description| description.with_enabled(&floor::shader_enables(capabilities))) .map_err(Error::Translation)?; let mut policy = DevicePolicy::default(); policy.pointer_domain = PointerDomain::Identity; diff --git a/crates/metal2vulkan-rt/src/extension.rs b/crates/metal2vulkan-rt/src/extension.rs index 1530d2dac..51743eb8b 100644 --- a/crates/metal2vulkan-rt/src/extension.rs +++ b/crates/metal2vulkan-rt/src/extension.rs @@ -32,8 +32,10 @@ impl DeviceExtension { /// `wanted` as it is. /// /// `T` is a structure the floor's features do not already chain: not - /// `VkPhysicalDeviceVulkan11Features`, `12`, `13` or - /// `VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR`. + /// `VkPhysicalDeviceVulkan11Features`, `12`, `13`, + /// `VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR`, + /// `VkPhysicalDeviceShaderMaximalReconvergenceFeaturesKHR` or + /// `VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR`. pub fn with_features(name: &CStr, wanted: T, needs: fn(&T) -> bool) -> DeviceExtension where T: vk::ExtendsPhysicalDeviceFeatures2 diff --git a/crates/metal2vulkan-rt/src/floor.rs b/crates/metal2vulkan-rt/src/floor.rs index 16f95f412..ebaed935f 100644 --- a/crates/metal2vulkan-rt/src/floor.rs +++ b/crates/metal2vulkan-rt/src/floor.rs @@ -1,6 +1,6 @@ //! The floor: the Vulkan version, extensions, features, limits, queue family and memory types the -//! runtime requires of every device, and the four features it uses only where a device reports -//! them. +//! runtime requires of every device, and the optional features it uses only where a device reports +//! them, each choosing one of two forms. //! //! [`PhysicalDevice::check`](crate::PhysicalDevice::check) queries a physical device and decides; //! the decision is a pure function of what it read, so a test can hand it any set of answers. @@ -26,9 +26,25 @@ pub const DEVICE_EXTENSIONS: &[&CStr] = &[ ash::khr::workgroup_memory_explicit_layout::NAME, ]; -/// The translator's name for each extension of [`DEVICE_EXTENSIONS`] that its shaders may use. -pub(crate) const SHADER_EXTENSIONS: &[VkExtension] = - &[VkExtension::KhrWorkgroupMemoryExplicitLayout]; +/// The device extensions device creation enables where the device lists them, each for the +/// optional features of its own: the SIMD groups' reconvergence modes. +pub const OPTIONAL_EXTENSIONS: &[&CStr] = &[ + ash::khr::shader_maximal_reconvergence::NAME, + ash::khr::shader_subgroup_uniform_control_flow::NAME, +]; + +/// The translator's name for an extension device creation enables that its shaders may use. +fn shader_extension(name: &CStr) -> Option { + if name == ash::khr::workgroup_memory_explicit_layout::NAME { + Some(VkExtension::KhrWorkgroupMemoryExplicitLayout) + } else if name == ash::khr::shader_maximal_reconvergence::NAME { + Some(VkExtension::KhrShaderMaximalReconvergence) + } else if name == ash::khr::shader_subgroup_uniform_control_flow::NAME { + Some(VkExtension::KhrShaderSubgroupUniformControlFlow) + } else { + None + } +} /// Slots in the sampled-texture array: the most sampled textures alive at once. pub(crate) const SAMPLED_IMAGES: u32 = 65_536; @@ -124,6 +140,14 @@ pub struct Features { /// `VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR`, of /// `VK_KHR_workgroup_memory_explicit_layout`. pub workgroup_layout: vk::PhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR<'static>, + /// `VkPhysicalDeviceShaderMaximalReconvergenceFeaturesKHR`, of + /// `VK_KHR_shader_maximal_reconvergence`: read and enabled only where the device lists it. + pub maximal_reconvergence: vk::PhysicalDeviceShaderMaximalReconvergenceFeaturesKHR<'static>, + /// `VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR`, of + /// `VK_KHR_shader_subgroup_uniform_control_flow`: read and enabled only where the device lists + /// it. + pub subgroup_uniform_control_flow: + vk::PhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR<'static>, } /// One feature: the Vulkan structure that reports it, its member as ash spells it, the member, and @@ -151,6 +175,12 @@ macro_rules! feature { (@structure workgroup_layout) => { "VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR" }; + (@structure maximal_reconvergence) => { + "VkPhysicalDeviceShaderMaximalReconvergenceFeaturesKHR" + }; + (@structure subgroup_uniform_control_flow) => { + "VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR" + }; (@translator) => { None }; @@ -213,12 +243,16 @@ pub(crate) const OPTIONAL: &[Feature] = &[ feature!(vulkan12.shader_buffer_int64_atomics => ShaderBufferInt64Atomics), feature!(vulkan12.shader_shared_int64_atomics => ShaderSharedInt64Atomics), feature!(core.shader_float64 => ShaderFloat64), + // The SIMD groups' reconvergence: maximal where the device offers it, else subgroup-uniform + // control flow where it offers that. + feature!(maximal_reconvergence.shader_maximal_reconvergence => ShaderMaximalReconvergence), + feature!(subgroup_uniform_control_flow.shader_subgroup_uniform_control_flow => ShaderSubgroupUniformControlFlow), ]; -/// What the translator's shaders may use of what device creation enables with `features`: each -/// enabled feature the translator names, and [`SHADER_EXTENSIONS`]. -pub(crate) fn shader_enables(features: &Features) -> EnableSet { - let mut features = *features; +/// What the translator's shaders may use of what device creation enables: each enabled feature of +/// `capabilities` the translator names, and each enabled extension it names. +pub(crate) fn shader_enables(capabilities: &Capabilities) -> EnableSet { + let mut features = capabilities.features; let mut enables = EnableSet::new(); for feature in REQUIRED.iter().chain(OPTIONAL) { if let Some(name) = feature.translator { @@ -227,7 +261,12 @@ pub(crate) fn shader_enables(features: &Features) -> EnableSet { } } } - enables.extensions.extend(SHADER_EXTENSIONS); + enables.extensions.extend( + capabilities + .extensions + .iter() + .filter_map(|&name| shader_extension(name)), + ); enables } @@ -328,11 +367,12 @@ impl fmt::Display for BelowFloor { impl std::error::Error for BelowFloor {} -/// What a device above the floor offers: the four answers that choose between two forms, and what +/// What a device above the floor offers: the answers that choose between two forms, and what /// device creation enables. /// /// Metal's counterparts are per-family capabilities (`supportsFamily`), and for storage reads -/// `readWriteTextureSupport`; here each is one Vulkan feature. +/// `readWriteTextureSupport`; here each is one Vulkan feature. The SIMD groups' other answers +/// (subgroup sizes, stages and operations) are properties the translator reads itself. pub struct Capabilities { /// `shaderFloat16`: `half` arithmetic in 16 bits. pub float16: bool, @@ -346,11 +386,17 @@ pub struct Capabilities { pub shared_int64_atomics: bool, /// `shaderFloat64`: 64-bit floats. pub float64: bool, + /// `shaderMaximalReconvergence`: SIMD groups reconverge maximally, as Metal's do. + pub maximal_reconvergence: bool, + /// `shaderSubgroupUniformControlFlow`: SIMD groups reconverge where control flow is uniform, + /// the mode where maximal reconvergence is not offered. + pub subgroup_uniform_control_flow: bool, /// The features device creation enables: every one the floor requires, and each of the /// optional ones the device reports. pub features: Features, - /// The device extensions device creation enables: [`DEVICE_EXTENSIONS`]. - pub extensions: &'static [&'static CStr], + /// The device extensions device creation enables: [`DEVICE_EXTENSIONS`], then each of + /// [`OPTIONAL_EXTENSIONS`] the device lists. + pub extensions: Vec<&'static CStr>, /// The first queue family with graphics and compute, whose timestamps the floor checked. pub queue_family: u32, /// The device's memory types and heaps, for device creation to choose from. @@ -432,10 +478,16 @@ unsafe fn query(instance: &ash::Instance, physical: vk::PhysicalDevice) -> Queri .collect(); // An extension's feature structure may be read only from a device that lists the // extension; on another, its features stay false. - let workgroup_layout_listed = queried - .extensions - .iter() - .any(|name| name.as_c_str() == ash::khr::workgroup_memory_explicit_layout::NAME); + let listed = |extension: &CStr| { + queried + .extensions + .iter() + .any(|name| name.as_c_str() == extension) + }; + let workgroup_layout_listed = listed(ash::khr::workgroup_memory_explicit_layout::NAME); + let maximal_reconvergence_listed = listed(ash::khr::shader_maximal_reconvergence::NAME); + let uniform_control_flow_listed = + listed(ash::khr::shader_subgroup_uniform_control_flow::NAME); let Features { core, @@ -443,6 +495,8 @@ unsafe fn query(instance: &ash::Instance, physical: vk::PhysicalDevice) -> Queri vulkan12, vulkan13, workgroup_layout, + maximal_reconvergence, + subgroup_uniform_control_flow, } = &mut queried.features; let mut features = vk::PhysicalDeviceFeatures2::default() .push_next(&mut *vulkan11) @@ -451,12 +505,20 @@ unsafe fn query(instance: &ash::Instance, physical: vk::PhysicalDevice) -> Queri if workgroup_layout_listed { features = features.push_next(&mut *workgroup_layout); } + if maximal_reconvergence_listed { + features = features.push_next(&mut *maximal_reconvergence); + } + if uniform_control_flow_listed { + features = features.push_next(&mut *subgroup_uniform_control_flow); + } instance.get_physical_device_features2(physical, &mut features); *core = features.features; vulkan11.p_next = std::ptr::null_mut(); vulkan12.p_next = std::ptr::null_mut(); vulkan13.p_next = std::ptr::null_mut(); workgroup_layout.p_next = std::ptr::null_mut(); + maximal_reconvergence.p_next = std::ptr::null_mut(); + subgroup_uniform_control_flow.p_next = std::ptr::null_mut(); queried.families = instance.get_physical_device_queue_family_properties(physical); queried.memory = instance.get_physical_device_memory_properties(physical); @@ -535,8 +597,23 @@ pub(crate) fn decide(device: &Queried) -> Result { buffer_int64_atomics: features.vulkan12.shader_buffer_int64_atomics == vk::TRUE, shared_int64_atomics: features.vulkan12.shader_shared_int64_atomics == vk::TRUE, float64: features.core.shader_float64 == vk::TRUE, + maximal_reconvergence: features.maximal_reconvergence.shader_maximal_reconvergence + == vk::TRUE, + subgroup_uniform_control_flow: features + .subgroup_uniform_control_flow + .shader_subgroup_uniform_control_flow + == vk::TRUE, features, - extensions: DEVICE_EXTENSIONS, + extensions: DEVICE_EXTENSIONS + .iter() + .chain(OPTIONAL_EXTENSIONS.iter().filter(|&&extension| { + device + .extensions + .iter() + .any(|name| name.as_c_str() == extension) + })) + .copied() + .collect(), queue_family, memory: device.memory, }) diff --git a/crates/metal2vulkan-rt/src/tests/floor.rs b/crates/metal2vulkan-rt/src/tests/floor.rs index 7344ac4fa..67f347f74 100644 --- a/crates/metal2vulkan-rt/src/tests/floor.rs +++ b/crates/metal2vulkan-rt/src/tests/floor.rs @@ -1,11 +1,12 @@ -//! The floor's check: each missing item is named, the four optional features decide +//! The floor's check: each missing item is named, the optional features decide //! `Capabilities`, memory types are chosen by flags and by what buffers can use, the README states //! what the code checks, and, under a device cfg, every device the loader lists is above the floor. use crate::floor::{ choose, decide, flag_names, limits, vulkan_name, BelowFloor, Features, MemoryTypes, Missing, - Queried, DEVICE_EXTENSIONS, INSTANCE_EXTENSIONS, MEMORY_FLAG_NAMES, OPTIONAL, PRIVATE_MEMORY, - REQUIRED, RING_MEMORY, SHARED_MEMORY, TIMESTAMP_BITS, VERSION, + Queried, DEVICE_EXTENSIONS, INSTANCE_EXTENSIONS, MEMORY_FLAG_NAMES, OPTIONAL, + OPTIONAL_EXTENSIONS, PRIVATE_MEMORY, REQUIRED, RING_MEMORY, SHARED_MEMORY, TIMESTAMP_BITS, + VERSION, }; use ash::vk; use std::collections::BTreeSet; @@ -142,6 +143,8 @@ fn a_device_at_the_floor_is_above_it() { assert!(!capabilities.buffer_int64_atomics); assert!(!capabilities.shared_int64_atomics); assert!(!capabilities.float64); + assert!(!capabilities.maximal_reconvergence); + assert!(!capabilities.subgroup_uniform_control_flow); assert_eq!(capabilities.extensions, DEVICE_EXTENSIONS); assert_eq!(capabilities.queue_family, 0); assert_eq!( @@ -668,10 +671,23 @@ fn every_missing_item_is_named_at_once() { ); } +/// An optional extension is enabled where the device lists it, after the floor's. #[test] -fn the_four_optional_features_decide_the_capabilities() { +fn an_optional_extension_is_enabled_where_listed() { + for &extension in OPTIONAL_EXTENSIONS { + let mut device = at_the_floor(); + device.extensions.push(extension.to_owned()); + let capabilities = decide(&device).unwrap_or_else(|below| panic!("{below}")); + let mut expected = DEVICE_EXTENSIONS.to_vec(); + expected.push(extension); + assert_eq!(capabilities.extensions, expected); + } +} + +#[test] +fn the_optional_features_decide_the_capabilities() { type Set = fn(&mut Features); - let cases: [(Set, &str); 5] = [ + let cases: [(Set, &str); 7] = [ (|f| f.vulkan12.shader_float16 = vk::TRUE, "float16"), ( |f| f.core.shader_storage_image_read_without_format = vk::TRUE, @@ -686,6 +702,17 @@ fn the_four_optional_features_decide_the_capabilities() { "shared_int64_atomics", ), (|f| f.core.shader_float64 = vk::TRUE, "float64"), + ( + |f| f.maximal_reconvergence.shader_maximal_reconvergence = vk::TRUE, + "maximal_reconvergence", + ), + ( + |f| { + f.subgroup_uniform_control_flow + .shader_subgroup_uniform_control_flow = vk::TRUE + }, + "subgroup_uniform_control_flow", + ), ]; assert_eq!( cases.len(), @@ -705,6 +732,11 @@ fn the_four_optional_features_decide_the_capabilities() { ("buffer_int64_atomics", capabilities.buffer_int64_atomics), ("shared_int64_atomics", capabilities.shared_int64_atomics), ("float64", capabilities.float64), + ("maximal_reconvergence", capabilities.maximal_reconvergence), + ( + "subgroup_uniform_control_flow", + capabilities.subgroup_uniform_control_flow, + ), ]; for (name, value) in answers { assert_eq!( @@ -776,6 +808,11 @@ fn the_readme_states_the_floor() { .iter() .map(|name| (name, "instance")) .chain(DEVICE_EXTENSIONS.iter().map(|name| (name, "device"))) + .chain( + OPTIONAL_EXTENSIONS + .iter() + .map(|name| (name, "device, where listed")), + ) .map(|(name, place)| (name.to_string_lossy().into_owned(), place.to_string())) .collect(); assert_eq!(stated, code, "the README's extensions"); diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index 8b52dd85c..ef37bee47 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -1092,6 +1092,7 @@ const metal2vulkan-rt::BLOCK_LEN pub const BLOCK_LEN: u64 const metal2vulkan-rt::floor::BUFFER_USAGE pub const BUFFER_USAGE: vk::BufferUsageFlags const metal2vulkan-rt::floor::DEVICE_EXTENSIONS pub const DEVICE_EXTENSIONS: &[&CStr] const metal2vulkan-rt::floor::INSTANCE_EXTENSIONS pub const INSTANCE_EXTENSIONS: &[&CStr] +const metal2vulkan-rt::floor::OPTIONAL_EXTENSIONS pub const OPTIONAL_EXTENSIONS: &[&CStr] const metal2vulkan-rt::floor::VERSION pub const VERSION: u32 const metal2vulkan-runtime::DEFAULT_CAPACITY pub const DEFAULT_CAPACITY: u64 const metal2vulkan-runtime::DEFAULT_MEMORY_CAPACITY pub const DEFAULT_MEMORY_CAPACITY: u64 @@ -1187,6 +1188,7 @@ const-value metal2vulkan-rt::BLOCK_LEN 256 <<20 const-value metal2vulkan-rt::floor::BUFFER_USAGE vk::BufferUsageFlags::from_raw(vk::BufferUsageFlags::TRANSFER_SRC.as_raw() | vk::BufferUsageFlags::TRANSFER_DST.as_raw() | vk::BufferUsageFlags::UNIFORM_TEXEL_BUFFER.as_raw() | vk::BufferUsageFlags::STORAGE_TEXEL_BUFFER.as_raw() | vk::BufferUsageFlags::UNIFORM_BUFFER.as_raw() | vk::BufferUsageFlags::STORAGE_BUFFER.as_raw() | vk::BufferUsageFlags::INDEX_BUFFER.as_raw() | vk::BufferUsageFlags::VERTEX_BUFFER.as_raw() | vk::BufferUsageFlags::INDIRECT_BUFFER.as_raw() | vk::BufferUsageFlags::SHADER_DEVICE_ADDRESS.as_raw()) const-value metal2vulkan-rt::floor::DEVICE_EXTENSIONS &[ash::khr::swapchain::NAME, ash::khr::workgroup_memory_explicit_layout::NAME] const-value metal2vulkan-rt::floor::INSTANCE_EXTENSIONS &[ash::khr::surface::NAME] +const-value metal2vulkan-rt::floor::OPTIONAL_EXTENSIONS &[ash::khr::shader_maximal_reconvergence::NAME, ash::khr::shader_subgroup_uniform_control_flow::NAME] const-value metal2vulkan-rt::floor::VERSION vk::API_VERSION_1_3 const-value metal2vulkan-runtime::DEFAULT_CAPACITY 25 <<30 const-value metal2vulkan-runtime::DEFAULT_MEMORY_CAPACITY 256 <<20 @@ -2249,15 +2251,19 @@ field metal2vulkan-rt::RawDevice.physical_device pub physical_device: vk::Physic field metal2vulkan-rt::RawDevice.queue_family_index pub queue_family_index: u32 field metal2vulkan-rt::floor::BelowFloor.missing pub missing: Vec field metal2vulkan-rt::floor::Capabilities.buffer_int64_atomics pub buffer_int64_atomics: bool -field metal2vulkan-rt::floor::Capabilities.extensions pub extensions: &'static [&'static CStr] +field metal2vulkan-rt::floor::Capabilities.extensions pub extensions: Vec<&'static CStr> field metal2vulkan-rt::floor::Capabilities.features pub features: Features field metal2vulkan-rt::floor::Capabilities.float16 pub float16: bool field metal2vulkan-rt::floor::Capabilities.float64 pub float64: bool +field metal2vulkan-rt::floor::Capabilities.maximal_reconvergence pub maximal_reconvergence: bool field metal2vulkan-rt::floor::Capabilities.memory pub memory: vk::PhysicalDeviceMemoryProperties field metal2vulkan-rt::floor::Capabilities.queue_family pub queue_family: u32 field metal2vulkan-rt::floor::Capabilities.shared_int64_atomics pub shared_int64_atomics: bool field metal2vulkan-rt::floor::Capabilities.storage_read_without_format pub storage_read_without_format: bool +field metal2vulkan-rt::floor::Capabilities.subgroup_uniform_control_flow pub subgroup_uniform_control_flow: bool field metal2vulkan-rt::floor::Features.core pub core: vk::PhysicalDeviceFeatures +field metal2vulkan-rt::floor::Features.maximal_reconvergence pub maximal_reconvergence: vk::PhysicalDeviceShaderMaximalReconvergenceFeaturesKHR<'static> +field metal2vulkan-rt::floor::Features.subgroup_uniform_control_flow pub subgroup_uniform_control_flow: vk::PhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR<'static> field metal2vulkan-rt::floor::Features.vulkan11 pub vulkan11: vk::PhysicalDeviceVulkan11Features<'static> field metal2vulkan-rt::floor::Features.vulkan12 pub vulkan12: vk::PhysicalDeviceVulkan12Features<'static> field metal2vulkan-rt::floor::Features.vulkan13 pub vulkan13: vk::PhysicalDeviceVulkan13Features<'static>