diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index b84e6c5e0..942ee5e08 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -6578,7 +6578,7 @@ Presenting runs on the runtime's own device; nothing is exported or imported. | `VK_EXT_device_generated_commands` | device, with indirect command buffers | an indirect command buffer's execution, through `deviceGeneratedCommands`, enabled where the device reports it with the limits an execution needs (Indirect command buffers, above) | | `VK_KHR_maintenance5` | device, with indirect command buffers | the preprocess buffers' usage flag (`VkBufferUsageFlags2CreateInfoKHR`), through `maintenance5`, enabled with the extension above alone | | `VK_KHR_fragment_shader_barycentric` | device, where reported | a fragment function's `[[barycentric_coord]]`, through the barycentric feature below; `Device::extensions` names it only where that feature is enabled | -| `VK_EXT_mesh_shader` | device, with the mesh stages | Metal's object and mesh functions, as task and mesh shaders, through the mesh-stage features below (Mesh stages, below); `Device::extensions` names it only with all four | +| `VK_EXT_mesh_shader` | device, with the mesh stages | Metal's object and mesh functions, as task and mesh shaders, through the mesh-stage features below (Mesh stages, below); `Device::extensions` names it only with all three | ### Features @@ -7074,19 +7074,18 @@ covers them all. This was read in the release's source, not reproduced in the la ### Mesh stages -Where the device lists `VK_EXT_mesh_shader` and reports all four features below, device creation -enables the extension and the four, and none of them otherwise (`floor::MESH_EXTENSIONS`). An -object function is a task shader and a mesh function a mesh shader, and a mesh draw runs its grid -as pieces of one multi-draw, whose count a GPU-written draw reads from a buffer, so a device that -lacks any one of the four takes no mesh render pipeline state: the translator refuses it, -`Unsupported{MeshShading}` naming what the device lacks. No answer chooses a second form. +Where the device lists `VK_EXT_mesh_shader` and reports all three features below, device creation +enables the extension and the three, and none of them otherwise (`floor::MESH_EXTENSIONS`). An +object function is a task shader and a mesh function a mesh shader, and an object grid past the +task limits runs in pieces of one multi-draw, so a device that lacks any one of the three takes no +mesh render pipeline state: the translator refuses it, `Unsupported{MeshShading}` naming what the +device lacks. No answer chooses a second form. | Mesh-stage feature | Structure | Used for | |---|---|---| | `taskShader` | `VkPhysicalDeviceMeshShaderFeaturesEXT` | an object function, as a task shader | | `meshShader` | `VkPhysicalDeviceMeshShaderFeaturesEXT` | a mesh function, as a mesh shader | -| `multiDrawIndirect` | `VkPhysicalDeviceFeatures` | a mesh draw's grid, drawn as pieces of one multi-draw within the task stage's limits | -| `drawIndirectCount` | `VkPhysicalDeviceVulkan12Features` | an indirect mesh draw's count of pieces, which the GPU writes | +| `multiDrawIndirect` | `VkPhysicalDeviceFeatures` | an object grid past the task stage's limits, drawn as pieces of one multi-draw of host-written records | ### Not enabled diff --git a/crates/metal2vulkan-runtime/src/floor.rs b/crates/metal2vulkan-runtime/src/floor.rs index 56c29ce8e..c4f9ed622 100644 --- a/crates/metal2vulkan-runtime/src/floor.rs +++ b/crates/metal2vulkan-runtime/src/floor.rs @@ -175,9 +175,8 @@ pub const BORDER_SWIZZLE_EXTENSIONS: &[&CStr] = &[ pub const BARYCENTRIC_EXTENSIONS: &[&CStr] = &[ash::khr::fragment_shader_barycentric::NAME]; /// The device extension of Metal's object and mesh functions (`VK_EXT_mesh_shader`): device -/// creation enables it, with four features (`taskShader`, `meshShader`, `multiDrawIndirect` and -/// `drawIndirectCount`), where the device lists it and reports all four, and none of them -/// otherwise, so [`Device::extensions`](crate::Device::extensions) names it only with its stages. A device without them refuses every mesh render pipeline state +/// creation enables it, with three features (`taskShader`, `meshShader` and `multiDrawIndirect`), +/// where the device lists it and reports all three, and none of them otherwise, so [`Device::extensions`](crate::Device::extensions) names it only with its stages. A device without them refuses every mesh render pipeline state /// (the translator's `Unsupported{MeshShading}`, naming what the device lacks). pub const MESH_EXTENSIONS: &[&CStr] = &[ash::ext::mesh_shader::NAME]; @@ -470,8 +469,8 @@ pub struct Features { /// and enabled only where the device lists it ([`OPTIONAL_EXTENSIONS`]). pub extended_dynamic_state: vk::PhysicalDeviceExtendedDynamicStateFeaturesEXT<'static>, /// `VkPhysicalDeviceMeshShaderFeaturesEXT`, of `VK_EXT_mesh_shader`: read where the device - /// lists it, and `taskShader` and `meshShader` enabled with `multiDrawIndirect` and - /// `drawIndirectCount` ([`MESH_EXTENSIONS`]); none of its other features. + /// lists it, and `taskShader` and `meshShader` enabled with `multiDrawIndirect` + /// ([`MESH_EXTENSIONS`]); none of its other features. pub mesh: vk::PhysicalDeviceMeshShaderFeaturesEXT<'static>, } @@ -895,16 +894,14 @@ pub(crate) const PIPELINE_ROBUSTNESS: &[Feature] = pub(crate) const EXTENDED_DYNAMIC_STATE: &[Feature] = &[feature!(extended_dynamic_state.extended_dynamic_state => ExtendedDynamicState)]; /// The features of Metal's object and mesh functions ([`MESH_EXTENSIONS`]): enabled together where -/// the device lists `VK_EXT_mesh_shader` and reports all four, and none otherwise. An object -/// function is a task shader and a mesh function a mesh shader, and a mesh draw runs its grid as -/// pieces through `multiDrawIndirect` and, for an indirect draw, `drawIndirectCount`, so a device -/// that lacks any one of them takes no mesh render pipeline state. No answer chooses a second -/// form. +/// the device lists `VK_EXT_mesh_shader` and reports all three, and none otherwise. An object +/// function is a task shader and a mesh function a mesh shader, and an object grid past the task +/// limits runs in pieces of one multi-draw (`multiDrawIndirect`), so a device that lacks any one +/// of them takes no mesh render pipeline state. No answer chooses a second form. pub(crate) const MESH_STAGES: &[Feature] = &[ feature!(mesh.task_shader => TaskShader), feature!(mesh.mesh_shader => MeshShader), feature!(core.multi_draw_indirect => MultiDrawIndirect), - feature!(vulkan12.draw_indirect_count => DrawIndirectCount), ]; /// The features of [`INDIRECT_COMMANDS`]: enabled together where the device offers indirect @@ -1185,7 +1182,7 @@ pub struct Capabilities { /// and fault-report ones the device reports, the attachment-read ones where /// [`feedback_loop`](Self::feedback_loop) holds, the border-swizzle ones where the device reports /// both, the barycentric one where the device lists its extension and reports it, and the - /// mesh stages' four where the device lists `VK_EXT_mesh_shader` and reports all four. + /// mesh stages' three where the device lists `VK_EXT_mesh_shader` and reports all three. pub features: Features, /// The device extensions device creation enables: [`DEVICE_EXTENSIONS`], then each of /// [`OPTIONAL_EXTENSIONS`] the device lists, then [`ATTACHMENT_READ_EXTENSIONS`] where @@ -1194,8 +1191,8 @@ pub struct Capabilities { /// [`BARYCENTRIC_EXTENSIONS`] where the device lists it and reports its feature, then /// [`INDIRECT_COMMANDS`] where the device lists both and reports their features /// ([`indirect_commands`](Self::indirect_commands)), then [`MESH_EXTENSIONS`] where the device - /// lists it and reports its four features (`taskShader`, `meshShader`, `multiDrawIndirect` - /// and `drawIndirectCount`). + /// lists it and reports its three features (`taskShader`, `meshShader` and + /// `multiDrawIndirect`). pub extensions: Vec<&'static CStr>, /// The first queue family with graphics and compute, whose timestamps the floor checked. pub queue_family: u32, diff --git a/crates/metal2vulkan-runtime/src/render.rs b/crates/metal2vulkan-runtime/src/render.rs index f1ea7029b..c81abb664 100644 --- a/crates/metal2vulkan-runtime/src/render.rs +++ b/crates/metal2vulkan-runtime/src/render.rs @@ -947,8 +947,8 @@ impl crate::Device { /// each call: the translator gives no key of a mesh descriptor before its compile, so neither /// the device's map of contents nor the cache directory holds one, and two states of one /// descriptor are two contents, each compiled. A device without the floor's mesh set - /// (`VK_EXT_mesh_shader` with `taskShader`, `meshShader`, `multiDrawIndirect` and - /// `drawIndirectCount`) refuses the descriptor through the translator. Each of the object and + /// (`VK_EXT_mesh_shader` with `taskShader`, `meshShader` and `multiDrawIndirect`) refuses the + /// descriptor through the translator. Each of the object and /// mesh stages runs each draw's threadgroup in one workgroup of the state's maximum for the /// stage /// ([`max_total_threads_per_object_threadgroup`](RenderPipelineState::max_total_threads_per_object_threadgroup), diff --git a/crates/metal2vulkan-runtime/src/tests/device.rs b/crates/metal2vulkan-runtime/src/tests/device.rs index b13473acb..1dfae4be4 100644 --- a/crates/metal2vulkan-runtime/src/tests/device.rs +++ b/crates/metal2vulkan-runtime/src/tests/device.rs @@ -472,20 +472,16 @@ fn every_device_of_the_cfgs_kind_enables_the_consumers_extensions_it_offers() { unsafe { vk_instance.get_physical_device_features2(physical.raw(), &mut features) }; } let barycentric = weights.fragment_shader_barycentric == vk::TRUE; - // So is the mesh stages' one, beside the two core features they take. + // So is the mesh stages' one, beside the core feature they take. let mut stages = vk::PhysicalDeviceMeshShaderFeaturesEXT::default(); - let mut vulkan12 = vk::PhysicalDeviceVulkan12Features::default(); - let mut features = vk::PhysicalDeviceFeatures2::default().push_next(&mut vulkan12); + let mut features = vk::PhysicalDeviceFeatures2::default(); if lists(ash::ext::mesh_shader::NAME) { features = features.push_next(&mut stages); } - // SAFETY: as above; `stages` and `vulkan12` live through the call. + // SAFETY: as above; `stages` lives through the call. unsafe { vk_instance.get_physical_device_features2(physical.raw(), &mut features) }; let multi_draw = features.features.multi_draw_indirect == vk::TRUE; - let mesh = stages.task_shader == vk::TRUE - && stages.mesh_shader == vk::TRUE - && multi_draw - && vulkan12.draw_indirect_count == vk::TRUE; + let mesh = stages.task_shader == vk::TRUE && stages.mesh_shader == vk::TRUE && multi_draw; let mut asked = vec![ DeviceExtension::new(missing), @@ -532,7 +528,7 @@ fn every_device_of_the_cfgs_kind_enables_the_consumers_extensions_it_offers() { if device.core().indirect.is_some() { expected.extend(floor::INDIRECT_COMMANDS); } - // The mesh stages' one, where the device reports all four of their features. + // The mesh stages' one, where the device reports all three of their features. if mesh { expected.extend(floor::MESH_EXTENSIONS); } diff --git a/crates/metal2vulkan-runtime/src/tests/floor.rs b/crates/metal2vulkan-runtime/src/tests/floor.rs index 01402efe3..3de6f9d61 100644 --- a/crates/metal2vulkan-runtime/src/tests/floor.rs +++ b/crates/metal2vulkan-runtime/src/tests/floor.rs @@ -1707,13 +1707,13 @@ fn barycentrics_are_enabled_where_listed_and_reported() { assert_eq!(answer(&device), (false, false), "reported, not listed"); } -/// A device that lists `VK_EXT_mesh_shader` and reports `taskShader`, `meshShader`, -/// `multiDrawIndirect` and `drawIndirectCount` is given the extension and all four, and the -/// translator sees them; one that lacks any one of the four, or reports them without listing the -/// extension, is given none of them, so the extension is named among those enabled only with its -/// stages. +/// A device that lists `VK_EXT_mesh_shader` and reports `taskShader`, `meshShader` and +/// `multiDrawIndirect` is given the extension and all three, and the translator sees them; one +/// that lacks any one of the three, or reports them without listing the extension, is given none +/// of them, so the extension is named among those enabled only with its stages. `drawIndirectCount` +/// is not among them: a device without it is given the mesh stages. #[test] -fn mesh_stages_are_enabled_where_listed_with_all_four_features() { +fn mesh_stages_are_enabled_where_listed_with_all_three_features() { use crate::floor::{shader_enables, MESH_EXTENSIONS, MESH_STAGES}; use metal2vulkan::device::{VkExtension, VkFeature}; let answer = |device: &Queried| { @@ -1729,7 +1729,6 @@ fn mesh_stages_are_enabled_where_listed_with_all_four_features() { VkFeature::TaskShader, VkFeature::MeshShader, VkFeature::MultiDrawIndirect, - VkFeature::DrawIndirectCount, ] .iter() .filter(|feature| enables.features.contains(feature)) @@ -1746,7 +1745,6 @@ fn mesh_stages_are_enabled_where_listed_with_all_four_features() { device.features.mesh.task_shader = vk::TRUE; device.features.mesh.mesh_shader = vk::TRUE; device.features.core.multi_draw_indirect = vk::TRUE; - device.features.vulkan12.draw_indirect_count = vk::TRUE; }; let mut device = at_the_floor(); assert_eq!(answer(&device), (0, 0), "at the floor"); @@ -1755,7 +1753,9 @@ fn mesh_stages_are_enabled_where_listed_with_all_four_features() { device .extensions .push(ash::ext::mesh_shader::NAME.to_owned()); - assert_eq!(answer(&device), (1, 4), "listed and reported"); + assert_eq!(answer(&device), (1, 3), "listed and reported"); + device.features.vulkan12.draw_indirect_count = vk::FALSE; + assert_eq!(answer(&device), (1, 3), "without drawIndirectCount"); for lacking in MESH_STAGES { let mut device = at_the_floor(); device diff --git a/crates/metal2vulkan-runtime/src/tests/mesh_state.rs b/crates/metal2vulkan-runtime/src/tests/mesh_state.rs index fbda5c993..198837f5a 100644 --- a/crates/metal2vulkan-runtime/src/tests/mesh_state.rs +++ b/crates/metal2vulkan-runtime/src/tests/mesh_state.rs @@ -1,7 +1,7 @@ //! A mesh render pipeline state (`Device::new_mesh_render_pipeline_state`), under a device cfg on //! every device of the cfg's kind. Where device creation enabled the mesh set -//! (`VK_EXT_mesh_shader` with `taskShader`, `meshShader`, `multiDrawIndirect` and -//! `drawIndirectCount`), each state is made and its one `VkPipeline` with it +//! (`VK_EXT_mesh_shader` with `taskShader`, `meshShader` and `multiDrawIndirect`), each state is +//! made and its one `VkPipeline` with it //! (`finish_pipeline`), it answers Metal's thread maxima capped by its stage's device limits, //! Metal's widths and mesh-grid maximum, and a draw of primitives with it is //! `Refusal::MeshDraw`. Elsewhere each state is refused, naming `MeshShading`. diff --git a/crates/metal2vulkan-validation/runtime-sources.sha256 b/crates/metal2vulkan-validation/runtime-sources.sha256 index 0536a666d..314b6f38d 100644 --- a/crates/metal2vulkan-validation/runtime-sources.sha256 +++ b/crates/metal2vulkan-validation/runtime-sources.sha256 @@ -1 +1 @@ -f985a4212b9578205d4191b074ab95041db5e2b72b9afbec2fa17e03449bdde2 +3b7da9e90517f6110e2497fbddcfe47841190893bafc319f6540b878675345ce diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index b40237be8..d93bdf6eb 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -60,7 +60,7 @@ mod tests; /// unchanged version, and its bless records the version. Independent of the crate's version and of /// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no /// history. -pub const SEMANTICS_VERSION: u32 = 2382; +pub const SEMANTICS_VERSION: u32 = 2383; /// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the /// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another diff --git a/crates/metal2vulkan/src/device/requirements.rs b/crates/metal2vulkan/src/device/requirements.rs index 23c80d781..1c63410d8 100644 --- a/crates/metal2vulkan/src/device/requirements.rs +++ b/crates/metal2vulkan/src/device/requirements.rs @@ -90,7 +90,7 @@ pub enum VkFeature { DrawIndirectFirstInstance, MultiDrawIndirect, /// `drawIndirectCount` (Vulkan 1.2, or `VK_KHR_draw_indirect_count`): an indirect draw whose - /// draw count is GPU data (an indirect object mesh draw's pieces, `bind::mesh_arguments`). + /// draw count is GPU data. DrawIndirectCount, DepthClamp, FillModeNonSolid, diff --git a/crates/metal2vulkan/src/lower/mesh/mod.rs b/crates/metal2vulkan/src/lower/mesh/mod.rs index 5c531e53c..f4a010f3b 100644 --- a/crates/metal2vulkan/src/lower/mesh/mod.rs +++ b/crates/metal2vulkan/src/lower/mesh/mod.rs @@ -319,13 +319,12 @@ fn mesh_outputs<'e>(cx: &SelectCx<'e>) -> Option<&'e MeshOutputs> { /// The features object and mesh functions need enabled with `VK_EXT_mesh_shader`, all of them for /// either stage: `taskShader` and `meshShader` (a mesh render pipeline holds a mesh stage and may -/// hold an object stage), and `multiDrawIndirect` and `drawIndirectCount`, which a mesh draw's -/// pieces take (`bind::mesh_arguments`). -pub const FEATURES: [VkFeature; 4] = [ +/// hold an object stage), and `multiDrawIndirect`, which an object grid's pieces past the task +/// limits take (one multi-draw of host-written records). +pub const FEATURES: [VkFeature; 3] = [ VkFeature::TaskShader, VkFeature::MeshShader, VkFeature::MultiDrawIndirect, - VkFeature::DrawIndirectCount, ]; /// What profile `p` lacks of what an object (`TaskEXT`) or mesh (`MeshEXT`) entry needs enabled, diff --git a/crates/metal2vulkan/src/pipeline/compile/api.rs b/crates/metal2vulkan/src/pipeline/compile/api.rs index 34eecf9a9..3f557a516 100644 --- a/crates/metal2vulkan/src/pipeline/compile/api.rs +++ b/crates/metal2vulkan/src/pipeline/compile/api.rs @@ -479,8 +479,8 @@ impl Device { /// grid whose counts its draw's `PushField::GroupCountsAddress` points at, within Metal's and /// the device's mesh limits; `link::mesh::Launcher`): it has no vertex input and no input assembly (its /// `GraphicsState::topology` is unused), and Metal's draws of it are `drawMeshThreadgroups` and - /// `drawMeshThreads`. A device without `VK_EXT_mesh_shader`, `taskShader`, `meshShader`, - /// `multiDrawIndirect` and `drawIndirectCount`, all enabled together, refuses it, with or + /// `drawMeshThreads`. A device without `VK_EXT_mesh_shader`, `taskShader`, `meshShader` and + /// `multiDrawIndirect`, all enabled together, refuses it, with or /// without an object function (`Unsupported{MeshShading}` naming the missing ones). A `Compiled` /// stage must /// have been compiled under the same inputs and Metal's call stack depth of 1. diff --git a/crates/metal2vulkan/src/tests/engine_mesh.rs b/crates/metal2vulkan/src/tests/engine_mesh.rs index c77fee2be..9d8649ad2 100644 --- a/crates/metal2vulkan/src/tests/engine_mesh.rs +++ b/crates/metal2vulkan/src/tests/engine_mesh.rs @@ -7,7 +7,7 @@ //! `engine/mesh_simd` object and mesh functions of SIMD-group and quad-group operations. //! Each mesh function that lowers compiles, on every committed profile whose device lists //! `VK_EXT_mesh_shader` (which enables it with `taskShader` and `meshShader`, beside -//! `multiDrawIndirect` and `drawIndirectCount`), to a `MeshEXT` +//! `multiDrawIndirect`), to a `MeshEXT` //! entry that passes L3 (`spirv-val` and requirements within the profile); the entry states its //! counts and topology, initializes its outputs and culls past its count, its threadgroup memory //! is its workgroup's, and its stage interface lists its user outputs, per vertex or per @@ -166,13 +166,12 @@ fn without_the_extension_a_mesh_pipeline_is_refused() { } /// The features a device enables with `VK_EXT_mesh_shader` for object and mesh functions, needed -/// all together: `taskShader` and `meshShader`, and `multiDrawIndirect` and `drawIndirectCount`, -/// which a mesh draw's pieces take. -const MESH_FEATURES: [VkFeature; 4] = [ +/// all together: `taskShader` and `meshShader`, and `multiDrawIndirect`, which an object grid's +/// pieces take. +const MESH_FEATURES: [VkFeature; 3] = [ VkFeature::TaskShader, VkFeature::MeshShader, VkFeature::MultiDrawIndirect, - VkFeature::DrawIndirectCount, ]; /// The device of committed profile `stem` without `feature`. diff --git a/docs/API.md b/docs/API.md index 6eaf8de0c..c857bf7a6 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1173,9 +1173,9 @@ each instance. A fragment function compiled to read Vulkan's `PrimitiveId` behin `Device::compile_mesh_pipeline` compiles a `MeshPipelineDescriptor` (an optional object function, a mesh function and a fragment function). It draws mesh draws only (`drawMeshThreadgroups:`, `drawMeshThreads:` and their indirect forms). The -stages are task and mesh shaders, which need `VK_EXT_mesh_shader` with `taskShader`, `meshShader`, -`multiDrawIndirect` and `drawIndirectCount`, all enabled together, whether or not the pipeline has -an object function (a mesh draw's pieces take the two draw features). A device without any one of +stages are task and mesh shaders, which need `VK_EXT_mesh_shader` with `taskShader`, `meshShader` +and `multiDrawIndirect`, all enabled together, whether or not the pipeline has an object function +(an object grid's pieces past the task limits are one multi-draw). A device without any one of them (MoltenVK, older ANV) refuses the pipeline and each of its object and mesh functions (`Unsupported{MeshShading}`, naming what it lacks).