AccelerationStructureGeometryMotionTrianglesDataNv = 1000327000,
PhysicalDeviceRayTracingMotionBlurFeaturesNv = 1000327001,
AccelerationStructureMotionInfoNv = 1000327002,
+ // Provided by VK_EXT_mesh_shader
+ PhysicalDeviceMeshShaderFeaturesExt = 1000328000,
+ // Provided by VK_EXT_mesh_shader
+ PhysicalDeviceMeshShaderPropertiesExt = 1000328001,
PhysicalDeviceYcbcr2Plane444FormatsFeaturesExt = 1000330000,
PhysicalDeviceFragmentDensityMap2FeaturesExt = 1000332000,
PhysicalDeviceFragmentDensityMap2PropertiesExt = 1000332001,
pub const MISS_KHR: Self = Self(2048);
pub const INTERSECTION_KHR: Self = Self(4096);
pub const CALLABLE_KHR: Self = Self(8192);
+ // Provided by VK_EXT_mesh_shader
+ pub const TASK_EXT: Self = Self(0x00000040);
+ // Provided by VK_EXT_mesh_shader
+ pub const MESH_EXT: Self = Self(0x00000080);
pub const TASK_NV: Self = Self(64);
pub const MESH_NV: Self = Self(128);
pub const SUBPASS_SHADING_HUAWEI: Self = Self(16384);
pub const ACCELERATION_STRUCTURE_BUILD_NV: Self = Self(0x02000000);
// Provided by VK_KHR_synchronization2 with VK_EXT_fragment_density_map
pub const FRAGMENT_DENSITY_PROCESS_EXT: Self = Self(0x00800000);
- // Provided by VK_KHR_synchronization2 with VK_NV_mesh_shader
- pub const TASK_SHADER_NV: Self = Self(0x00080000);
- // Provided by VK_KHR_synchronization2 with VK_NV_mesh_shader
- pub const MESH_SHADER_NV: Self = Self(0x00100000);
+ // Provided by VK_KHR_synchronization2 with VK_EXT_mesh_shader
+ pub const TASK_SHADER_EXT: Self = Self(0x00080000);
+ // Provided by VK_KHR_synchronization2 with VK_EXT_mesh_shader
+ pub const MESH_SHADER_EXT: Self = Self(0x00100000);
// Provided by VK_HUAWEI_subpass_shading
pub const SUBPASS_SHADING_HUAWEI: Self = Self(0x8000000000);
// Provided by VK_HUAWEI_invocation_mask
callback_data: &DebugUtilsMessengerCallbackDataExt,
user_data: *mut c_void,
) -> Bool32;
+
+// Provided by VK_EXT_mesh_shader
+pub type FnCmdDrawMeshTasksExt = extern "system" fn(
+ command_buffer: CommandBuffer,
+ group_count_x: u32,
+ group_count_y: u32,
+ group_count_z: u32,
+);
+
+// Provided by VK_EXT_mesh_shader
+pub type FnCmdDrawMeshTasksIndirectExt = extern "system" fn(
+ command_buffer: CommandBuffer,
+ buffer: Buffer,
+ offset: DeviceSize,
+ draw_count: u32,
+ stride: u32,
+);
+
+// Provided by VK_EXT_mesh_shader
+pub type FnCmdDrawMeshTasksIndirectCountExt = extern "system" fn(
+ command_buffer: CommandBuffer,
+ buffer: Buffer,
+ offset: DeviceSize,
+ count_buffer: Buffer,
+ count_buffer_offset: DeviceSize,
+ max_draw_count: u32,
+ stride: u32,
+);
)
}
}
+
+pub struct MeshShaderFunctions {
+ cmd_draw_mesh_tasks_ext: FnCmdDrawMeshTasksExt,
+ cmd_draw_mesh_tasks_indirect_ext: FnCmdDrawMeshTasksIndirectExt,
+ cmd_draw_mesh_tasks_indirect_count_ext: FnCmdDrawMeshTasksIndirectCountExt,
+}
+
+impl MeshShaderFunctions {
+ pub fn new(instance_functions: &InstanceFunctions, device: Device) -> Self {
+ unsafe {
+ let load_device = |name: &CStr| {
+ instance_functions
+ .get_device_proc_addr(device, name)
+ .unwrap_or_else(
+ #[cold]
+ || panic!("failed to load device function {}", name.to_string_lossy()),
+ )
+ };
+
+ Self {
+ cmd_draw_mesh_tasks_ext: transmute::<_, _>(load_device(c"vkCmdDrawMeshTasksEXT")),
+ cmd_draw_mesh_tasks_indirect_ext: transmute::<_, _>(load_device(
+ c"vkCmdDrawMeshTasksIndirectEXT",
+ )),
+ cmd_draw_mesh_tasks_indirect_count_ext: transmute::<_, _>(load_device(
+ c"vkCmdDrawMeshTasksIndirectCountEXT",
+ )),
+ }
+ }
+ }
+
+ #[inline]
+ pub unsafe fn cmd_draw_mesh_tasks_ext(
+ &self,
+ command_buffer: CommandBuffer,
+ group_count_x: u32,
+ group_count_y: u32,
+ group_count_z: u32,
+ ) {
+ (self.cmd_draw_mesh_tasks_ext)(command_buffer, group_count_x, group_count_y, group_count_z)
+ }
+
+ #[inline]
+ pub unsafe fn cmd_draw_mesh_tasks_indirect_ext(
+ &self,
+ command_buffer: CommandBuffer,
+ buffer: Buffer,
+ offset: DeviceSize,
+ draw_count: u32,
+ stride: u32,
+ ) {
+ (self.cmd_draw_mesh_tasks_indirect_ext)(command_buffer, buffer, offset, draw_count, stride)
+ }
+
+ #[inline]
+ pub unsafe fn cmd_draw_mesh_tasks_indirect_count_ext(
+ &self,
+ command_buffer: CommandBuffer,
+ buffer: Buffer,
+ offset: DeviceSize,
+ count_buffer: Buffer,
+ count_buffer_offset: DeviceSize,
+ max_draw_count: u32,
+ stride: u32,
+ ) {
+ (self.cmd_draw_mesh_tasks_indirect_count_ext)(
+ command_buffer,
+ buffer,
+ offset,
+ count_buffer,
+ count_buffer_offset,
+ max_draw_count,
+ stride,
+ )
+ }
+}
}
}
+#[repr(C)]
+pub struct PhysicalDeviceMeshShaderFeaturesExt {
+ pub _type: StructureType,
+ pub _next: *mut c_void,
+ pub task_shader: Bool32,
+ pub mesh_shader: Bool32,
+ pub multiview_mesh_shader: Bool32,
+ pub primitive_fragment_shading_rate_mesh_shader: Bool32,
+ pub mesh_shader_queries: Bool32,
+}
+
+impl Default for PhysicalDeviceMeshShaderFeaturesExt {
+ fn default() -> Self {
+ let mut x = unsafe { MaybeUninit::<Self>::zeroed().assume_init() };
+ x._type = StructureType::PhysicalDeviceMeshShaderFeaturesExt;
+ x
+ }
+}
+
+#[repr(C)]
+pub struct PhysicalDeviceMeshShaderPropertiesExt {
+ pub _type: StructureType,
+ pub _next: *mut c_void,
+ pub max_task_work_group_total_count: u32,
+ pub max_task_work_group_count: [u32; 3],
+ pub max_task_work_group_invocations: u32,
+ pub max_task_work_group_size: [u32; 3],
+ pub max_task_payload_size: u32,
+ pub max_task_shared_memory_size: u32,
+ pub max_task_payload_and_shared_memory_size: u32,
+ pub max_mesh_work_group_total_count: u32,
+ pub max_mesh_work_group_count: [u32; 3],
+ pub max_mesh_work_group_invocations: u32,
+ pub max_mesh_work_group_size: [u32; 3],
+ pub max_mesh_shared_memory_size: u32,
+ pub max_mesh_payload_and_shared_memory_size: u32,
+ pub max_mesh_output_memory_size: u32,
+ pub max_mesh_payload_and_output_memory_size: u32,
+ pub max_mesh_output_components: u32,
+ pub max_mesh_output_vertices: u32,
+ pub max_mesh_output_primitives: u32,
+ pub max_mesh_output_layers: u32,
+ pub max_mesh_multiview_view_count: u32,
+ pub mesh_output_per_vertex_granularity: u32,
+ pub mesh_output_per_primitive_granularity: u32,
+ pub max_preferred_task_work_group_invocations: u32,
+ pub max_preferred_mesh_work_group_invocations: u32,
+ pub prefers_local_invocation_vertex_output: Bool32,
+ pub prefers_local_invocation_primitive_output: Bool32,
+ pub prefers_compact_vertex_output: Bool32,
+ pub prefers_compact_primitive_output: Bool32,
+}
+
+impl Default for PhysicalDeviceMeshShaderPropertiesExt {
+ fn default() -> Self {
+ let mut x = unsafe { MaybeUninit::<Self>::zeroed().assume_init() };
+ x._type = StructureType::PhysicalDeviceMeshShaderPropertiesExt;
+ x
+ }
+}
+
#[cfg(test)]
mod test {
use super::*;