summaryrefslogtreecommitdiffstats
path: root/third_party/rust/ash/src/extensions/nv
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /third_party/rust/ash/src/extensions/nv
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/ash/src/extensions/nv')
-rw-r--r--third_party/rust/ash/src/extensions/nv/coverage_reduction_mode.rs70
-rw-r--r--third_party/rust/ash/src/extensions/nv/device_diagnostic_checkpoints.rs63
-rwxr-xr-xthird_party/rust/ash/src/extensions/nv/mesh_shader.rs81
-rw-r--r--third_party/rust/ash/src/extensions/nv/mod.rs9
-rwxr-xr-xthird_party/rust/ash/src/extensions/nv/ray_tracing.rs271
5 files changed, 494 insertions, 0 deletions
diff --git a/third_party/rust/ash/src/extensions/nv/coverage_reduction_mode.rs b/third_party/rust/ash/src/extensions/nv/coverage_reduction_mode.rs
new file mode 100644
index 0000000000..b4304772e3
--- /dev/null
+++ b/third_party/rust/ash/src/extensions/nv/coverage_reduction_mode.rs
@@ -0,0 +1,70 @@
+use crate::prelude::*;
+use crate::vk;
+use crate::{Entry, Instance};
+use std::ffi::CStr;
+use std::mem;
+
+/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_NV_coverage_reduction_mode.html>
+#[derive(Clone)]
+pub struct CoverageReductionMode {
+ fp: vk::NvCoverageReductionModeFn,
+}
+
+impl CoverageReductionMode {
+ pub fn new(entry: &Entry, instance: &Instance) -> Self {
+ let fp = vk::NvCoverageReductionModeFn::load(|name| unsafe {
+ mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr()))
+ });
+ Self { fp }
+ }
+
+ /// Retrieve the number of elements to pass to [`get_physical_device_supported_framebuffer_mixed_samples_combinations()`][Self::get_physical_device_supported_framebuffer_mixed_samples_combinations()]
+ #[inline]
+ pub unsafe fn get_physical_device_supported_framebuffer_mixed_samples_combinations_len(
+ &self,
+ physical_device: vk::PhysicalDevice,
+ ) -> VkResult<usize> {
+ let mut count = 0;
+ (self
+ .fp
+ .get_physical_device_supported_framebuffer_mixed_samples_combinations_nv)(
+ physical_device,
+ &mut count,
+ std::ptr::null_mut(),
+ )
+ .result_with_success(count as usize)
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV.html>
+ ///
+ /// Call [`get_physical_device_supported_framebuffer_mixed_samples_combinations_len()`][Self::get_physical_device_supported_framebuffer_mixed_samples_combinations_len()] to query the number of elements to pass to `out`.
+ /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
+ #[inline]
+ pub unsafe fn get_physical_device_supported_framebuffer_mixed_samples_combinations(
+ &self,
+ physical_device: vk::PhysicalDevice,
+ out: &mut [vk::FramebufferMixedSamplesCombinationNV],
+ ) -> VkResult<()> {
+ let mut count = out.len() as u32;
+ (self
+ .fp
+ .get_physical_device_supported_framebuffer_mixed_samples_combinations_nv)(
+ physical_device,
+ &mut count,
+ out.as_mut_ptr(),
+ )
+ .result()?;
+ assert_eq!(count as usize, out.len());
+ Ok(())
+ }
+
+ #[inline]
+ pub const fn name() -> &'static CStr {
+ vk::NvCoverageReductionModeFn::name()
+ }
+
+ #[inline]
+ pub fn fp(&self) -> &vk::NvCoverageReductionModeFn {
+ &self.fp
+ }
+}
diff --git a/third_party/rust/ash/src/extensions/nv/device_diagnostic_checkpoints.rs b/third_party/rust/ash/src/extensions/nv/device_diagnostic_checkpoints.rs
new file mode 100644
index 0000000000..ce43d046e6
--- /dev/null
+++ b/third_party/rust/ash/src/extensions/nv/device_diagnostic_checkpoints.rs
@@ -0,0 +1,63 @@
+use crate::vk;
+use crate::{Device, Instance};
+use std::ffi::CStr;
+use std::mem;
+use std::os::raw::c_void;
+
+/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_NV_device_diagnostic_checkpoints.html>
+#[derive(Clone)]
+pub struct DeviceDiagnosticCheckpoints {
+ fp: vk::NvDeviceDiagnosticCheckpointsFn,
+}
+
+impl DeviceDiagnosticCheckpoints {
+ pub fn new(instance: &Instance, device: &Device) -> Self {
+ let fp = vk::NvDeviceDiagnosticCheckpointsFn::load(|name| unsafe {
+ mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
+ });
+ Self { fp }
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCheckpointNV.html>
+ #[inline]
+ pub unsafe fn cmd_set_checkpoint(
+ &self,
+ command_buffer: vk::CommandBuffer,
+ p_checkpoint_marker: *const c_void,
+ ) {
+ (self.fp.cmd_set_checkpoint_nv)(command_buffer, p_checkpoint_marker);
+ }
+
+ /// Retrieve the number of elements to pass to [`get_queue_checkpoint_data()`][Self::get_queue_checkpoint_data()]
+ #[inline]
+ pub unsafe fn get_queue_checkpoint_data_len(&self, queue: vk::Queue) -> usize {
+ let mut count = 0;
+ (self.fp.get_queue_checkpoint_data_nv)(queue, &mut count, std::ptr::null_mut());
+ count as usize
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetQueueCheckpointDataNV.html>
+ ///
+ /// Call [`get_queue_checkpoint_data_len()`][Self::get_queue_checkpoint_data_len()] to query the number of elements to pass to `out`.
+ /// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
+ #[inline]
+ pub unsafe fn get_queue_checkpoint_data(
+ &self,
+ queue: vk::Queue,
+ out: &mut [vk::CheckpointDataNV],
+ ) {
+ let mut count = out.len() as u32;
+ (self.fp.get_queue_checkpoint_data_nv)(queue, &mut count, out.as_mut_ptr());
+ assert_eq!(count as usize, out.len());
+ }
+
+ #[inline]
+ pub const fn name() -> &'static CStr {
+ vk::NvDeviceDiagnosticCheckpointsFn::name()
+ }
+
+ #[inline]
+ pub fn fp(&self) -> &vk::NvDeviceDiagnosticCheckpointsFn {
+ &self.fp
+ }
+}
diff --git a/third_party/rust/ash/src/extensions/nv/mesh_shader.rs b/third_party/rust/ash/src/extensions/nv/mesh_shader.rs
new file mode 100755
index 0000000000..14ef8d44ac
--- /dev/null
+++ b/third_party/rust/ash/src/extensions/nv/mesh_shader.rs
@@ -0,0 +1,81 @@
+use crate::vk;
+use crate::{Device, Instance};
+use std::ffi::CStr;
+use std::mem;
+
+#[derive(Clone)]
+pub struct MeshShader {
+ fp: vk::NvMeshShaderFn,
+}
+
+impl MeshShader {
+ pub fn new(instance: &Instance, device: &Device) -> Self {
+ let fp = vk::NvMeshShaderFn::load(|name| unsafe {
+ mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
+ });
+ Self { fp }
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksNV.html>
+ #[inline]
+ pub unsafe fn cmd_draw_mesh_tasks(
+ &self,
+ command_buffer: vk::CommandBuffer,
+ task_count: u32,
+ first_task: u32,
+ ) {
+ (self.fp.cmd_draw_mesh_tasks_nv)(command_buffer, task_count, first_task);
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksIndirectNV.html>
+ #[inline]
+ pub unsafe fn cmd_draw_mesh_tasks_indirect(
+ &self,
+ command_buffer: vk::CommandBuffer,
+ buffer: vk::Buffer,
+ offset: vk::DeviceSize,
+ draw_count: u32,
+ stride: u32,
+ ) {
+ (self.fp.cmd_draw_mesh_tasks_indirect_nv)(
+ command_buffer,
+ buffer,
+ offset,
+ draw_count,
+ stride,
+ );
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksIndirectCountNV.html>
+ #[inline]
+ pub unsafe fn cmd_draw_mesh_tasks_indirect_count(
+ &self,
+ command_buffer: vk::CommandBuffer,
+ buffer: vk::Buffer,
+ offset: vk::DeviceSize,
+ count_buffer: vk::Buffer,
+ count_buffer_offset: vk::DeviceSize,
+ max_draw_count: u32,
+ stride: u32,
+ ) {
+ (self.fp.cmd_draw_mesh_tasks_indirect_count_nv)(
+ command_buffer,
+ buffer,
+ offset,
+ count_buffer,
+ count_buffer_offset,
+ max_draw_count,
+ stride,
+ );
+ }
+
+ #[inline]
+ pub const fn name() -> &'static CStr {
+ vk::NvMeshShaderFn::name()
+ }
+
+ #[inline]
+ pub fn fp(&self) -> &vk::NvMeshShaderFn {
+ &self.fp
+ }
+}
diff --git a/third_party/rust/ash/src/extensions/nv/mod.rs b/third_party/rust/ash/src/extensions/nv/mod.rs
new file mode 100644
index 0000000000..bfde37a55c
--- /dev/null
+++ b/third_party/rust/ash/src/extensions/nv/mod.rs
@@ -0,0 +1,9 @@
+pub use self::coverage_reduction_mode::CoverageReductionMode;
+pub use self::device_diagnostic_checkpoints::DeviceDiagnosticCheckpoints;
+pub use self::mesh_shader::MeshShader;
+pub use self::ray_tracing::RayTracing;
+
+mod coverage_reduction_mode;
+mod device_diagnostic_checkpoints;
+mod mesh_shader;
+mod ray_tracing;
diff --git a/third_party/rust/ash/src/extensions/nv/ray_tracing.rs b/third_party/rust/ash/src/extensions/nv/ray_tracing.rs
new file mode 100755
index 0000000000..d97ec85dfe
--- /dev/null
+++ b/third_party/rust/ash/src/extensions/nv/ray_tracing.rs
@@ -0,0 +1,271 @@
+use crate::prelude::*;
+use crate::vk;
+use crate::RawPtr;
+use crate::{Device, Instance};
+use std::ffi::CStr;
+use std::mem;
+
+#[derive(Clone)]
+pub struct RayTracing {
+ handle: vk::Device,
+ fp: vk::NvRayTracingFn,
+}
+
+impl RayTracing {
+ pub fn new(instance: &Instance, device: &Device) -> Self {
+ let handle = device.handle();
+ let fp = vk::NvRayTracingFn::load(|name| unsafe {
+ mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
+ });
+ Self { handle, fp }
+ }
+
+ #[inline]
+ pub unsafe fn get_properties(
+ instance: &Instance,
+ pdevice: vk::PhysicalDevice,
+ ) -> vk::PhysicalDeviceRayTracingPropertiesNV {
+ let mut props_rt = vk::PhysicalDeviceRayTracingPropertiesNV::default();
+ {
+ let mut props = vk::PhysicalDeviceProperties2::builder().push_next(&mut props_rt);
+ instance.get_physical_device_properties2(pdevice, &mut props);
+ }
+ props_rt
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateAccelerationStructureNV.html>
+ #[inline]
+ pub unsafe fn create_acceleration_structure(
+ &self,
+ create_info: &vk::AccelerationStructureCreateInfoNV,
+ allocation_callbacks: Option<&vk::AllocationCallbacks>,
+ ) -> VkResult<vk::AccelerationStructureNV> {
+ let mut accel_struct = mem::zeroed();
+ (self.fp.create_acceleration_structure_nv)(
+ self.handle,
+ create_info,
+ allocation_callbacks.as_raw_ptr(),
+ &mut accel_struct,
+ )
+ .result_with_success(accel_struct)
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyAccelerationStructureNV.html>
+ #[inline]
+ pub unsafe fn destroy_acceleration_structure(
+ &self,
+ accel_struct: vk::AccelerationStructureNV,
+ allocation_callbacks: Option<&vk::AllocationCallbacks>,
+ ) {
+ (self.fp.destroy_acceleration_structure_nv)(
+ self.handle,
+ accel_struct,
+ allocation_callbacks.as_raw_ptr(),
+ );
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureMemoryRequirementsNV.html>
+ #[inline]
+ pub unsafe fn get_acceleration_structure_memory_requirements(
+ &self,
+ info: &vk::AccelerationStructureMemoryRequirementsInfoNV,
+ ) -> vk::MemoryRequirements2KHR {
+ let mut requirements = mem::zeroed();
+ (self.fp.get_acceleration_structure_memory_requirements_nv)(
+ self.handle,
+ info,
+ &mut requirements,
+ );
+ requirements
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkBindAccelerationStructureMemoryNV.html>
+ #[inline]
+ pub unsafe fn bind_acceleration_structure_memory(
+ &self,
+ bind_info: &[vk::BindAccelerationStructureMemoryInfoNV],
+ ) -> VkResult<()> {
+ (self.fp.bind_acceleration_structure_memory_nv)(
+ self.handle,
+ bind_info.len() as u32,
+ bind_info.as_ptr(),
+ )
+ .result()
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBuildAccelerationStructureNV.html>
+ #[inline]
+ pub unsafe fn cmd_build_acceleration_structure(
+ &self,
+ command_buffer: vk::CommandBuffer,
+ info: &vk::AccelerationStructureInfoNV,
+ instance_data: vk::Buffer,
+ instance_offset: vk::DeviceSize,
+ update: bool,
+ dst: vk::AccelerationStructureNV,
+ src: vk::AccelerationStructureNV,
+ scratch: vk::Buffer,
+ scratch_offset: vk::DeviceSize,
+ ) {
+ (self.fp.cmd_build_acceleration_structure_nv)(
+ command_buffer,
+ info,
+ instance_data,
+ instance_offset,
+ if update { vk::TRUE } else { vk::FALSE },
+ dst,
+ src,
+ scratch,
+ scratch_offset,
+ );
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdCopyAccelerationStructureNV.html>
+ #[inline]
+ pub unsafe fn cmd_copy_acceleration_structure(
+ &self,
+ command_buffer: vk::CommandBuffer,
+ dst: vk::AccelerationStructureNV,
+ src: vk::AccelerationStructureNV,
+ mode: vk::CopyAccelerationStructureModeNV,
+ ) {
+ (self.fp.cmd_copy_acceleration_structure_nv)(command_buffer, dst, src, mode);
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdTraceRaysNV.html>
+ #[inline]
+ pub unsafe fn cmd_trace_rays(
+ &self,
+ command_buffer: vk::CommandBuffer,
+ raygen_shader_binding_table_buffer: vk::Buffer,
+ raygen_shader_binding_offset: vk::DeviceSize,
+ miss_shader_binding_table_buffer: vk::Buffer,
+ miss_shader_binding_offset: vk::DeviceSize,
+ miss_shader_binding_stride: vk::DeviceSize,
+ hit_shader_binding_table_buffer: vk::Buffer,
+ hit_shader_binding_offset: vk::DeviceSize,
+ hit_shader_binding_stride: vk::DeviceSize,
+ callable_shader_binding_table_buffer: vk::Buffer,
+ callable_shader_binding_offset: vk::DeviceSize,
+ callable_shader_binding_stride: vk::DeviceSize,
+ width: u32,
+ height: u32,
+ depth: u32,
+ ) {
+ (self.fp.cmd_trace_rays_nv)(
+ command_buffer,
+ raygen_shader_binding_table_buffer,
+ raygen_shader_binding_offset,
+ miss_shader_binding_table_buffer,
+ miss_shader_binding_offset,
+ miss_shader_binding_stride,
+ hit_shader_binding_table_buffer,
+ hit_shader_binding_offset,
+ hit_shader_binding_stride,
+ callable_shader_binding_table_buffer,
+ callable_shader_binding_offset,
+ callable_shader_binding_stride,
+ width,
+ height,
+ depth,
+ );
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateRayTracingPipelinesNV.html>
+ #[inline]
+ pub unsafe fn create_ray_tracing_pipelines(
+ &self,
+ pipeline_cache: vk::PipelineCache,
+ create_info: &[vk::RayTracingPipelineCreateInfoNV],
+ allocation_callbacks: Option<&vk::AllocationCallbacks>,
+ ) -> VkResult<Vec<vk::Pipeline>> {
+ let mut pipelines = vec![mem::zeroed(); create_info.len()];
+ (self.fp.create_ray_tracing_pipelines_nv)(
+ self.handle,
+ pipeline_cache,
+ create_info.len() as u32,
+ create_info.as_ptr(),
+ allocation_callbacks.as_raw_ptr(),
+ pipelines.as_mut_ptr(),
+ )
+ .result_with_success(pipelines)
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetRayTracingShaderGroupHandlesNV.html>
+ #[inline]
+ pub unsafe fn get_ray_tracing_shader_group_handles(
+ &self,
+ pipeline: vk::Pipeline,
+ first_group: u32,
+ group_count: u32,
+ data: &mut [u8],
+ ) -> VkResult<()> {
+ (self.fp.get_ray_tracing_shader_group_handles_nv)(
+ self.handle,
+ pipeline,
+ first_group,
+ group_count,
+ data.len(),
+ data.as_mut_ptr().cast(),
+ )
+ .result()
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureHandleNV.html>
+ #[inline]
+ pub unsafe fn get_acceleration_structure_handle(
+ &self,
+ accel_struct: vk::AccelerationStructureNV,
+ ) -> VkResult<u64> {
+ let mut handle: u64 = 0;
+ let handle_ptr: *mut u64 = &mut handle;
+ (self.fp.get_acceleration_structure_handle_nv)(
+ self.handle,
+ accel_struct,
+ std::mem::size_of::<u64>(),
+ handle_ptr.cast(),
+ )
+ .result_with_success(handle)
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdWriteAccelerationStructuresPropertiesNV.html>
+ #[inline]
+ pub unsafe fn cmd_write_acceleration_structures_properties(
+ &self,
+ command_buffer: vk::CommandBuffer,
+ structures: &[vk::AccelerationStructureNV],
+ query_type: vk::QueryType,
+ query_pool: vk::QueryPool,
+ first_query: u32,
+ ) {
+ (self.fp.cmd_write_acceleration_structures_properties_nv)(
+ command_buffer,
+ structures.len() as u32,
+ structures.as_ptr(),
+ query_type,
+ query_pool,
+ first_query,
+ );
+ }
+
+ /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCompileDeferredNV.html>
+ #[inline]
+ pub unsafe fn compile_deferred(&self, pipeline: vk::Pipeline, shader: u32) -> VkResult<()> {
+ (self.fp.compile_deferred_nv)(self.handle, pipeline, shader).result()
+ }
+
+ #[inline]
+ pub const fn name() -> &'static CStr {
+ vk::NvRayTracingFn::name()
+ }
+
+ #[inline]
+ pub fn fp(&self) -> &vk::NvRayTracingFn {
+ &self.fp
+ }
+
+ #[inline]
+ pub fn device(&self) -> vk::Device {
+ self.handle
+ }
+}