Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions wgpu-hal/src/vulkan/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,19 +495,20 @@ impl PhysicalDeviceFeatures {
None
},
mesh_shader: if enabled_extensions.contains(&ext::mesh_shader::NAME) {
let needed = requested_features.contains(wgt::Features::MESH_SHADER);
let needed = requested_features.contains(wgt::Features::EXPERIMENTAL_MESH_SHADER);
let multiview_needed =
requested_features.contains(wgt::Features::EXPERIMENTAL_MESH_SHADER_MULTIVIEW);
Some(
vk::PhysicalDeviceMeshShaderFeaturesEXT::default()
.mesh_shader(needed)
.task_shader(needed)
// Multiview needs some special work https://github.com/gfx-rs/wgpu/issues/7262
.multiview_mesh_shader(false),
.multiview_mesh_shader(multiview_needed),
)
} else {
None
},
maintenance4: if enabled_extensions.contains(&khr::maintenance4::NAME) {
let needed = requested_features.contains(wgt::Features::MESH_SHADER);
let needed = requested_features.contains(wgt::Features::EXPERIMENTAL_MESH_SHADER);
Some(vk::PhysicalDeviceMaintenance4FeaturesKHR::default().maintenance4(needed))
} else {
None
Expand Down Expand Up @@ -836,9 +837,15 @@ impl PhysicalDeviceFeatures {
caps.supports_extension(khr::external_memory_win32::NAME),
);
features.set(
F::MESH_SHADER,
F::EXPERIMENTAL_MESH_SHADER,
caps.supports_extension(ext::mesh_shader::NAME),
);
if let Some(ref mesh_shader) = self.mesh_shader {
features.set(
F::EXPERIMENTAL_MESH_SHADER_MULTIVIEW,
mesh_shader.multiview_mesh_shader != 0,
);
}
(features, dl_flags)
}
}
Expand Down Expand Up @@ -1005,7 +1012,7 @@ impl PhysicalDeviceProperties {
}
}

if requested_features.intersects(wgt::Features::MESH_SHADER) {
if requested_features.intersects(wgt::Features::EXPERIMENTAL_MESH_SHADER) {
extensions.push(khr::spirv_1_4::NAME);
}

Expand All @@ -1024,7 +1031,7 @@ impl PhysicalDeviceProperties {
extensions.push(ext::subgroup_size_control::NAME);
}

if requested_features.intersects(wgt::Features::MESH_SHADER) {
if requested_features.intersects(wgt::Features::EXPERIMENTAL_MESH_SHADER) {
extensions.push(khr::maintenance4::NAME);
}
}
Expand Down Expand Up @@ -1105,7 +1112,7 @@ impl PhysicalDeviceProperties {
extensions.push(google::display_timing::NAME);
}

if requested_features.contains(wgt::Features::MESH_SHADER) {
if requested_features.contains(wgt::Features::EXPERIMENTAL_MESH_SHADER) {
extensions.push(ext::mesh_shader::NAME);
}

Expand Down
15 changes: 14 additions & 1 deletion wgpu-types/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,8 @@ bitflags_array! {
/// - Metal
///
/// This is a native only feature.
const MESH_SHADER = 1 << 47;
const EXPERIMENTAL_MESH_SHADER = 1 << 47;

/// ***THIS IS EXPERIMENTAL:*** Features enabled by this may have
/// major bugs in them and are expected to be subject to breaking changes, suggestions
/// for the API exposed by this should be posted on [the ray-tracing issue](https://github.com/gfx-rs/wgpu/issues/6762)
Expand All @@ -1179,6 +1180,18 @@ bitflags_array! {
///
/// [`AccelerationStructureFlags::ALLOW_RAY_HIT_VERTEX_RETURN`]: super::AccelerationStructureFlags::ALLOW_RAY_HIT_VERTEX_RETURN
const EXPERIMENTAL_RAY_HIT_VERTEX_RETURN = 1 << 48;

/// Enables multiview in mesh shader pipelines
///
/// Supported platforms:
/// - Vulkan (with [VK_EXT_mesh_shader](https://registry.khronos.org/vulkan/specs/latest/man/html/VK_EXT_mesh_shader.html))
///
/// Potential Platforms:
/// - DX12
/// - Metal
///
/// This is a native only feature.
const EXPERIMENTAL_MESH_SHADER_MULTIVIEW = 1 << 49;
}

/// Features that are not guaranteed to be supported.
Expand Down