Translator and runtime: the mesh stages no longer require drawIndirectCount
Since the step-4 ruling no mesh draw reads a GPU-written draw count: an indirect draw of an object function is the runtime's refusal at the draw (DrawKind::IndirectObjectGrid), a mesh-only indirect draw is the launcher's one task workgroup (vkCmdDrawMeshTasksEXT(1, 1, 1)), and an object grid's pieces past the task limits take a host-written count through multiDrawIndirect. Rule 4 (anything unused is deleted) drops it, as the planner ruled through main: - lower::mesh::FEATURES and floor::MESH_STAGES hold taskShader, meshShader and multiDrawIndirect; device creation enables VK_EXT_mesh_shader with those three where the device reports all three. - The cond-1 tests iterate the three; the floor test also shows a device without drawIndirectCount given the mesh stages, and the device test no longer reads it. - The README's Mesh stages section and its extension row, docs/API.md, the compile_mesh_pipeline and new_mesh_render_pipeline_state docs, and the requirement's own doc say three. - SEMANTICS_VERSION 2370 (placeholder; main renumbers): the MeshShading refusal's needs change on a profile without drawIndirectCount (the M3 Max under MoltenVK reports it false). No lab device changes: every card that lists VK_EXT_mesh_shader reports drawIndirectCount (vulkaninfo on the RTX 3090, RTX 2080, RTX 5080 Laptop, RX 7900 XTX, Radeon 780M and lavapipe). REFUSALS.md and the signatures were regenerated and did not move; the runtime sources pin was rewritten. Verified: JOBLINE
This commit is contained in:
1 parent
ab493847c9
commit
07d9577c20
13 files changed
+52
-62
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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`.
|
||||
|
||||
@@ -1 +1 @@
|
||||
f985a4212b9578205d4191b074ab95041db5e2b72b9afbec2fa17e03449bdde2
|
||||
3b7da9e90517f6110e2497fbddcfe47841190893bafc319f6540b878675345ce
|
||||
Vendored
+1
-1
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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`.
|
||||
|
||||
+3
-3
@@ -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).
|
||||
|
||||
|
||||
Reference in new issue
Block a user