diff options
Diffstat (limited to 'third_party/rust/ash/src/extensions/ext')
21 files changed, 2038 insertions, 0 deletions
diff --git a/third_party/rust/ash/src/extensions/ext/acquire_drm_display.rs b/third_party/rust/ash/src/extensions/ext/acquire_drm_display.rs new file mode 100644 index 0000000000..8c80e506e0 --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/acquire_drm_display.rs @@ -0,0 +1,55 @@ +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_EXT_acquire_drm_display.html> +#[derive(Clone)] +pub struct AcquireDrmDisplay { + fp: vk::ExtAcquireDrmDisplayFn, +} + +impl AcquireDrmDisplay { + pub fn new(entry: &Entry, instance: &Instance) -> Self { + let handle = instance.handle(); + let fp = vk::ExtAcquireDrmDisplayFn::load(|name| unsafe { + mem::transmute(entry.get_instance_proc_addr(handle, name.as_ptr())) + }); + Self { fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkAcquireDrmDisplayEXT.html> + #[inline] + pub unsafe fn acquire_drm_display( + &self, + physical_device: vk::PhysicalDevice, + drm_fd: i32, + display: vk::DisplayKHR, + ) -> VkResult<()> { + (self.fp.acquire_drm_display_ext)(physical_device, drm_fd, display).result() + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDrmDisplayEXT.html> + #[inline] + pub unsafe fn get_drm_display( + &self, + physical_device: vk::PhysicalDevice, + drm_fd: i32, + connector_id: u32, + ) -> VkResult<vk::DisplayKHR> { + let mut display = mem::MaybeUninit::uninit(); + (self.fp.get_drm_display_ext)(physical_device, drm_fd, connector_id, display.as_mut_ptr()) + .assume_init_on_success(display) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtAcquireDrmDisplayFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtAcquireDrmDisplayFn { + &self.fp + } +} diff --git a/third_party/rust/ash/src/extensions/ext/buffer_device_address.rs b/third_party/rust/ash/src/extensions/ext/buffer_device_address.rs new file mode 100644 index 0000000000..a1d304e639 --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/buffer_device_address.rs @@ -0,0 +1,44 @@ +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +#[derive(Clone)] +pub struct BufferDeviceAddress { + handle: vk::Device, + fp: vk::ExtBufferDeviceAddressFn, +} + +impl BufferDeviceAddress { + pub fn new(instance: &Instance, device: &Device) -> Self { + let handle = device.handle(); + let fp = vk::ExtBufferDeviceAddressFn::load(|name| unsafe { + mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr())) + }); + Self { handle, fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetBufferDeviceAddressEXT.html> + #[inline] + pub unsafe fn get_buffer_device_address( + &self, + info: &vk::BufferDeviceAddressInfoEXT, + ) -> vk::DeviceAddress { + (self.fp.get_buffer_device_address_ext)(self.handle, info) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtBufferDeviceAddressFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtBufferDeviceAddressFn { + &self.fp + } + + #[inline] + pub fn device(&self) -> vk::Device { + self.handle + } +} diff --git a/third_party/rust/ash/src/extensions/ext/calibrated_timestamps.rs b/third_party/rust/ash/src/extensions/ext/calibrated_timestamps.rs new file mode 100644 index 0000000000..e102fca15c --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/calibrated_timestamps.rs @@ -0,0 +1,72 @@ +use crate::prelude::*; +use crate::vk; +use crate::{Entry, Instance}; +use std::ffi::CStr; +use std::mem; + +#[derive(Clone)] +pub struct CalibratedTimestamps { + handle: vk::Instance, + fp: vk::ExtCalibratedTimestampsFn, +} + +impl CalibratedTimestamps { + pub fn new(entry: &Entry, instance: &Instance) -> Self { + let handle = instance.handle(); + let fp = vk::ExtCalibratedTimestampsFn::load(|name| unsafe { + mem::transmute(entry.get_instance_proc_addr(handle, name.as_ptr())) + }); + Self { handle, fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceCalibrateableTimeDomainsEXT.html> + #[inline] + pub unsafe fn get_physical_device_calibrateable_time_domains( + &self, + physical_device: vk::PhysicalDevice, + ) -> VkResult<Vec<vk::TimeDomainEXT>> { + read_into_uninitialized_vector(|count, data| { + (self.fp.get_physical_device_calibrateable_time_domains_ext)( + physical_device, + count, + data, + ) + }) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetCalibratedTimestampsEXT.html> + /// + /// Returns a tuple containing `(timestamps, max_deviation)` + #[inline] + pub unsafe fn get_calibrated_timestamps( + &self, + device: vk::Device, + info: &[vk::CalibratedTimestampInfoEXT], + ) -> VkResult<(Vec<u64>, Vec<u64>)> { + let mut timestamps = vec![0u64; info.len()]; + let mut max_deviation = vec![0u64; info.len()]; + (self.fp.get_calibrated_timestamps_ext)( + device, + info.len() as u32, + info.as_ptr(), + timestamps.as_mut_ptr(), + max_deviation.as_mut_ptr(), + ) + .result_with_success((timestamps, max_deviation)) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtCalibratedTimestampsFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtCalibratedTimestampsFn { + &self.fp + } + + #[inline] + pub fn instance(&self) -> vk::Instance { + self.handle + } +} diff --git a/third_party/rust/ash/src/extensions/ext/debug_marker.rs b/third_party/rust/ash/src/extensions/ext/debug_marker.rs new file mode 100755 index 0000000000..1c21a47fd9 --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/debug_marker.rs @@ -0,0 +1,71 @@ +use crate::prelude::*; +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +#[derive(Clone)] +pub struct DebugMarker { + handle: vk::Device, + fp: vk::ExtDebugMarkerFn, +} + +impl DebugMarker { + pub fn new(instance: &Instance, device: &Device) -> Self { + let handle = device.handle(); + let fp = vk::ExtDebugMarkerFn::load(|name| unsafe { + mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr())) + }); + Self { handle, fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDebugMarkerSetObjectNameEXT.html> + #[inline] + pub unsafe fn debug_marker_set_object_name( + &self, + name_info: &vk::DebugMarkerObjectNameInfoEXT, + ) -> VkResult<()> { + (self.fp.debug_marker_set_object_name_ext)(self.handle, name_info).result() + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDebugMarkerBeginEXT.html> + #[inline] + pub unsafe fn cmd_debug_marker_begin( + &self, + command_buffer: vk::CommandBuffer, + marker_info: &vk::DebugMarkerMarkerInfoEXT, + ) { + (self.fp.cmd_debug_marker_begin_ext)(command_buffer, marker_info); + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDebugMarkerEndEXT.html> + #[inline] + pub unsafe fn cmd_debug_marker_end(&self, command_buffer: vk::CommandBuffer) { + (self.fp.cmd_debug_marker_end_ext)(command_buffer); + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdDebugMarkerInsertEXT.html> + #[inline] + pub unsafe fn cmd_debug_marker_insert( + &self, + command_buffer: vk::CommandBuffer, + marker_info: &vk::DebugMarkerMarkerInfoEXT, + ) { + (self.fp.cmd_debug_marker_insert_ext)(command_buffer, marker_info); + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtDebugMarkerFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtDebugMarkerFn { + &self.fp + } + + #[inline] + pub fn device(&self) -> vk::Device { + self.handle + } +} diff --git a/third_party/rust/ash/src/extensions/ext/debug_report.rs b/third_party/rust/ash/src/extensions/ext/debug_report.rs new file mode 100755 index 0000000000..625ebf479e --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/debug_report.rs @@ -0,0 +1,68 @@ +use crate::prelude::*; +use crate::vk; +use crate::RawPtr; +use crate::{Entry, Instance}; +use std::ffi::CStr; +use std::mem; + +#[derive(Clone)] +pub struct DebugReport { + handle: vk::Instance, + fp: vk::ExtDebugReportFn, +} + +impl DebugReport { + pub fn new(entry: &Entry, instance: &Instance) -> Self { + let handle = instance.handle(); + let fp = vk::ExtDebugReportFn::load(|name| unsafe { + mem::transmute(entry.get_instance_proc_addr(handle, name.as_ptr())) + }); + Self { handle, fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyDebugReportCallbackEXT.html> + #[inline] + pub unsafe fn destroy_debug_report_callback( + &self, + debug: vk::DebugReportCallbackEXT, + allocation_callbacks: Option<&vk::AllocationCallbacks>, + ) { + (self.fp.destroy_debug_report_callback_ext)( + self.handle, + debug, + allocation_callbacks.as_raw_ptr(), + ); + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDebugReportCallbackEXT.html> + #[inline] + pub unsafe fn create_debug_report_callback( + &self, + create_info: &vk::DebugReportCallbackCreateInfoEXT, + allocation_callbacks: Option<&vk::AllocationCallbacks>, + ) -> VkResult<vk::DebugReportCallbackEXT> { + let mut debug_cb = mem::zeroed(); + (self.fp.create_debug_report_callback_ext)( + self.handle, + create_info, + allocation_callbacks.as_raw_ptr(), + &mut debug_cb, + ) + .result_with_success(debug_cb) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtDebugReportFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtDebugReportFn { + &self.fp + } + + #[inline] + pub fn instance(&self) -> vk::Instance { + self.handle + } +} diff --git a/third_party/rust/ash/src/extensions/ext/debug_utils.rs b/third_party/rust/ash/src/extensions/ext/debug_utils.rs new file mode 100755 index 0000000000..46d91769ad --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/debug_utils.rs @@ -0,0 +1,173 @@ +use crate::prelude::*; +use crate::{vk, RawPtr}; +use crate::{Entry, Instance}; +use std::ffi::CStr; +use std::mem; + +#[derive(Clone)] +pub struct DebugUtils { + handle: vk::Instance, + fp: vk::ExtDebugUtilsFn, +} + +impl DebugUtils { + pub fn new(entry: &Entry, instance: &Instance) -> Self { + let handle = instance.handle(); + let fp = vk::ExtDebugUtilsFn::load(|name| unsafe { + mem::transmute(entry.get_instance_proc_addr(handle, name.as_ptr())) + }); + Self { handle, fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSetDebugUtilsObjectNameEXT.html> + #[deprecated = "Backwards-compatible alias containing a typo, use `set_debug_utils_object_name()` instead"] + #[inline] + pub unsafe fn debug_utils_set_object_name( + &self, + device: vk::Device, + name_info: &vk::DebugUtilsObjectNameInfoEXT, + ) -> VkResult<()> { + self.set_debug_utils_object_name(device, name_info) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSetDebugUtilsObjectNameEXT.html> + #[inline] + pub unsafe fn set_debug_utils_object_name( + &self, + device: vk::Device, + name_info: &vk::DebugUtilsObjectNameInfoEXT, + ) -> VkResult<()> { + (self.fp.set_debug_utils_object_name_ext)(device, name_info).result() + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSetDebugUtilsObjectTagEXT.html> + #[deprecated = "Backwards-compatible alias containing a typo, use `set_debug_utils_object_tag()` instead"] + #[inline] + pub unsafe fn debug_utils_set_object_tag( + &self, + device: vk::Device, + tag_info: &vk::DebugUtilsObjectTagInfoEXT, + ) -> VkResult<()> { + self.set_debug_utils_object_tag(device, tag_info) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSetDebugUtilsObjectTagEXT.html> + #[inline] + pub unsafe fn set_debug_utils_object_tag( + &self, + device: vk::Device, + tag_info: &vk::DebugUtilsObjectTagInfoEXT, + ) -> VkResult<()> { + (self.fp.set_debug_utils_object_tag_ext)(device, tag_info).result() + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBeginDebugUtilsLabelEXT.html> + #[inline] + pub unsafe fn cmd_begin_debug_utils_label( + &self, + command_buffer: vk::CommandBuffer, + label: &vk::DebugUtilsLabelEXT, + ) { + (self.fp.cmd_begin_debug_utils_label_ext)(command_buffer, label); + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdEndDebugUtilsLabelEXT.html> + #[inline] + pub unsafe fn cmd_end_debug_utils_label(&self, command_buffer: vk::CommandBuffer) { + (self.fp.cmd_end_debug_utils_label_ext)(command_buffer); + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdInsertDebugUtilsLabelEXT.html> + #[inline] + pub unsafe fn cmd_insert_debug_utils_label( + &self, + command_buffer: vk::CommandBuffer, + label: &vk::DebugUtilsLabelEXT, + ) { + (self.fp.cmd_insert_debug_utils_label_ext)(command_buffer, label); + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueueBeginDebugUtilsLabelEXT.html> + #[inline] + pub unsafe fn queue_begin_debug_utils_label( + &self, + queue: vk::Queue, + label: &vk::DebugUtilsLabelEXT, + ) { + (self.fp.queue_begin_debug_utils_label_ext)(queue, label); + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueueEndDebugUtilsLabelEXT.html> + #[inline] + pub unsafe fn queue_end_debug_utils_label(&self, queue: vk::Queue) { + (self.fp.queue_end_debug_utils_label_ext)(queue); + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueueInsertDebugUtilsLabelEXT.html> + #[inline] + pub unsafe fn queue_insert_debug_utils_label( + &self, + queue: vk::Queue, + label: &vk::DebugUtilsLabelEXT, + ) { + (self.fp.queue_insert_debug_utils_label_ext)(queue, label); + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateDebugUtilsMessengerEXT.html> + #[inline] + pub unsafe fn create_debug_utils_messenger( + &self, + create_info: &vk::DebugUtilsMessengerCreateInfoEXT, + allocator: Option<&vk::AllocationCallbacks>, + ) -> VkResult<vk::DebugUtilsMessengerEXT> { + let mut messenger = mem::zeroed(); + (self.fp.create_debug_utils_messenger_ext)( + self.handle, + create_info, + allocator.as_raw_ptr(), + &mut messenger, + ) + .result_with_success(messenger) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyDebugUtilsMessengerEXT.html> + #[inline] + pub unsafe fn destroy_debug_utils_messenger( + &self, + messenger: vk::DebugUtilsMessengerEXT, + allocator: Option<&vk::AllocationCallbacks>, + ) { + (self.fp.destroy_debug_utils_messenger_ext)(self.handle, messenger, allocator.as_raw_ptr()); + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSubmitDebugUtilsMessageEXT.html> + #[inline] + pub unsafe fn submit_debug_utils_message( + &self, + message_severity: vk::DebugUtilsMessageSeverityFlagsEXT, + message_types: vk::DebugUtilsMessageTypeFlagsEXT, + callback_data: &vk::DebugUtilsMessengerCallbackDataEXT, + ) { + (self.fp.submit_debug_utils_message_ext)( + self.handle, + message_severity, + message_types, + callback_data, + ); + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtDebugUtilsFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtDebugUtilsFn { + &self.fp + } + + #[inline] + pub fn instance(&self) -> vk::Instance { + self.handle + } +} diff --git a/third_party/rust/ash/src/extensions/ext/descriptor_buffer.rs b/third_party/rust/ash/src/extensions/ext/descriptor_buffer.rs new file mode 100644 index 0000000000..4503f5bdab --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/descriptor_buffer.rs @@ -0,0 +1,211 @@ +use crate::prelude::*; +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_descriptor_buffer.html> +#[derive(Clone)] +pub struct DescriptorBuffer { + handle: vk::Device, + fp: vk::ExtDescriptorBufferFn, +} + +impl DescriptorBuffer { + pub fn new(instance: &Instance, device: &Device) -> Self { + let handle = device.handle(); + let fp = vk::ExtDescriptorBufferFn::load(|name| unsafe { + mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr())) + }); + Self { handle, fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDescriptorSetLayoutSizeEXT.html> + #[inline] + pub unsafe fn get_descriptor_set_layout_size( + &self, + layout: vk::DescriptorSetLayout, + ) -> vk::DeviceSize { + let mut count = 0; + (self.fp.get_descriptor_set_layout_size_ext)(self.handle, layout, &mut count); + count + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDescriptorSetLayoutBindingOffsetEXT.html> + #[inline] + pub unsafe fn get_descriptor_set_layout_binding_offset( + &self, + layout: vk::DescriptorSetLayout, + binding: u32, + ) -> vk::DeviceSize { + let mut offset = 0; + (self.fp.get_descriptor_set_layout_binding_offset_ext)( + self.handle, + layout, + binding, + &mut offset, + ); + offset + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDescriptorEXT.html> + #[inline] + pub unsafe fn get_descriptor( + &self, + descriptor_info: &vk::DescriptorGetInfoEXT, + descriptor: &mut [u8], + ) { + (self.fp.get_descriptor_ext)( + self.handle, + descriptor_info, + descriptor.len(), + descriptor.as_mut_ptr().cast(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBindDescriptorBuffersEXT.html> + #[inline] + pub unsafe fn cmd_bind_descriptor_buffers( + &self, + command_buffer: vk::CommandBuffer, + binding_info: &[vk::DescriptorBufferBindingInfoEXT], + ) { + (self.fp.cmd_bind_descriptor_buffers_ext)( + command_buffer, + binding_info.len() as u32, + binding_info.as_ptr(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDescriptorBufferOffsetsEXT.html> + #[inline] + pub unsafe fn cmd_set_descriptor_buffer_offsets( + &self, + command_buffer: vk::CommandBuffer, + pipeline_bind_point: vk::PipelineBindPoint, + layout: vk::PipelineLayout, + first_set: u32, + buffer_indices: &[u32], + offsets: &[vk::DeviceSize], + ) { + assert_eq!(buffer_indices.len(), offsets.len()); + (self.fp.cmd_set_descriptor_buffer_offsets_ext)( + command_buffer, + pipeline_bind_point, + layout, + first_set, + buffer_indices.len() as u32, + buffer_indices.as_ptr(), + offsets.as_ptr(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBindDescriptorBufferEmbeddedSamplersEXT.html> + #[inline] + pub unsafe fn cmd_bind_descriptor_buffer_embedded_samplers( + &self, + command_buffer: vk::CommandBuffer, + pipeline_bind_point: vk::PipelineBindPoint, + layout: vk::PipelineLayout, + set: u32, + ) { + (self.fp.cmd_bind_descriptor_buffer_embedded_samplers_ext)( + command_buffer, + pipeline_bind_point, + layout, + set, + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetBufferOpaqueCaptureDescriptorDataEXT.html> + #[inline] + pub unsafe fn get_buffer_opaque_capture_descriptor_data( + &self, + info: &vk::BufferCaptureDescriptorDataInfoEXT, + data: &mut [u8], + ) -> VkResult<()> { + (self.fp.get_buffer_opaque_capture_descriptor_data_ext)( + self.handle, + info, + data.as_mut_ptr().cast(), + ) + .result() + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageOpaqueCaptureDescriptorDataEXT.html> + #[inline] + pub unsafe fn get_image_opaque_capture_descriptor_data( + &self, + info: &vk::ImageCaptureDescriptorDataInfoEXT, + data: &mut [u8], + ) -> VkResult<()> { + (self.fp.get_image_opaque_capture_descriptor_data_ext)( + self.handle, + info, + data.as_mut_ptr().cast(), + ) + .result() + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageViewOpaqueCaptureDescriptorDataEXT.html> + #[inline] + pub unsafe fn get_image_view_opaque_capture_descriptor_data( + &self, + info: &vk::ImageViewCaptureDescriptorDataInfoEXT, + data: &mut [u8], + ) -> VkResult<()> { + (self.fp.get_image_view_opaque_capture_descriptor_data_ext)( + self.handle, + info, + data.as_mut_ptr().cast(), + ) + .result() + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetSamplerOpaqueCaptureDescriptorDataEXT.html> + #[inline] + pub unsafe fn get_sampler_opaque_capture_descriptor_data( + &self, + info: &vk::SamplerCaptureDescriptorDataInfoEXT, + data: &mut [u8], + ) -> VkResult<()> { + (self.fp.get_sampler_opaque_capture_descriptor_data_ext)( + self.handle, + info, + data.as_mut_ptr().cast(), + ) + .result() + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT.html> + #[inline] + pub unsafe fn get_acceleration_structure_opaque_capture_descriptor_data( + &self, + info: &vk::AccelerationStructureCaptureDescriptorDataInfoEXT, + data: &mut [u8], + ) -> VkResult<()> { + (self + .fp + .get_acceleration_structure_opaque_capture_descriptor_data_ext)( + self.handle, + info, + data.as_mut_ptr().cast(), + ) + .result() + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtDescriptorBufferFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtDescriptorBufferFn { + &self.fp + } + + #[inline] + pub fn device(&self) -> vk::Device { + self.handle + } +} diff --git a/third_party/rust/ash/src/extensions/ext/extended_dynamic_state.rs b/third_party/rust/ash/src/extensions/ext/extended_dynamic_state.rs new file mode 100644 index 0000000000..2e6b3eeca3 --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/extended_dynamic_state.rs @@ -0,0 +1,196 @@ +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; +use std::ptr; + +#[derive(Clone)] +pub struct ExtendedDynamicState { + fp: vk::ExtExtendedDynamicStateFn, +} + +impl ExtendedDynamicState { + pub fn new(instance: &Instance, device: &Device) -> Self { + let fp = vk::ExtExtendedDynamicStateFn::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/vkCmdSetCullModeEXT.html> + #[inline] + pub unsafe fn cmd_set_cull_mode( + &self, + command_buffer: vk::CommandBuffer, + cull_mode: vk::CullModeFlags, + ) { + (self.fp.cmd_set_cull_mode_ext)(command_buffer, cull_mode) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetFrontFaceEXT.html> + #[inline] + pub unsafe fn cmd_set_front_face( + &self, + command_buffer: vk::CommandBuffer, + front_face: vk::FrontFace, + ) { + (self.fp.cmd_set_front_face_ext)(command_buffer, front_face) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPrimitiveTopologyEXT.html> + #[inline] + pub unsafe fn cmd_set_primitive_topology( + &self, + command_buffer: vk::CommandBuffer, + primitive_topology: vk::PrimitiveTopology, + ) { + (self.fp.cmd_set_primitive_topology_ext)(command_buffer, primitive_topology) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetViewportWithCountEXT.html> + #[inline] + pub unsafe fn cmd_set_viewport_with_count( + &self, + command_buffer: vk::CommandBuffer, + viewports: &[vk::Viewport], + ) { + (self.fp.cmd_set_viewport_with_count_ext)( + command_buffer, + viewports.len() as u32, + viewports.as_ptr(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetScissorWithCountEXT.html> + #[inline] + pub unsafe fn cmd_set_scissor_with_count( + &self, + command_buffer: vk::CommandBuffer, + scissors: &[vk::Rect2D], + ) { + (self.fp.cmd_set_scissor_with_count_ext)( + command_buffer, + scissors.len() as u32, + scissors.as_ptr(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdBindVertexBuffers2EXT.html> + #[inline] + pub unsafe fn cmd_bind_vertex_buffers2( + &self, + command_buffer: vk::CommandBuffer, + first_binding: u32, + buffers: &[vk::Buffer], + offsets: &[vk::DeviceSize], + sizes: Option<&[vk::DeviceSize]>, + strides: Option<&[vk::DeviceSize]>, + ) { + assert_eq!(offsets.len(), buffers.len()); + let p_sizes = if let Some(sizes) = sizes { + assert_eq!(sizes.len(), buffers.len()); + sizes.as_ptr() + } else { + ptr::null() + }; + let p_strides = if let Some(strides) = strides { + assert_eq!(strides.len(), buffers.len()); + strides.as_ptr() + } else { + ptr::null() + }; + (self.fp.cmd_bind_vertex_buffers2_ext)( + command_buffer, + first_binding, + buffers.len() as u32, + buffers.as_ptr(), + offsets.as_ptr(), + p_sizes, + p_strides, + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthTestEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_depth_test_enable( + &self, + command_buffer: vk::CommandBuffer, + depth_test_enable: bool, + ) { + (self.fp.cmd_set_depth_test_enable_ext)(command_buffer, depth_test_enable.into()) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthWriteEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_depth_write_enable( + &self, + command_buffer: vk::CommandBuffer, + depth_write_enable: bool, + ) { + (self.fp.cmd_set_depth_write_enable_ext)(command_buffer, depth_write_enable.into()) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthCompareOpEXT.html> + #[inline] + pub unsafe fn cmd_set_depth_compare_op( + &self, + command_buffer: vk::CommandBuffer, + depth_compare_op: vk::CompareOp, + ) { + (self.fp.cmd_set_depth_compare_op_ext)(command_buffer, depth_compare_op) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthBoundsTestEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_depth_bounds_test_enable( + &self, + command_buffer: vk::CommandBuffer, + depth_bounds_test_enable: bool, + ) { + (self.fp.cmd_set_depth_bounds_test_enable_ext)( + command_buffer, + depth_bounds_test_enable.into(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetStencilTestEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_stencil_test_enable( + &self, + command_buffer: vk::CommandBuffer, + stencil_test_enable: bool, + ) { + (self.fp.cmd_set_stencil_test_enable_ext)(command_buffer, stencil_test_enable.into()) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetStencilOpEXT.html> + #[inline] + pub unsafe fn cmd_set_stencil_op( + &self, + command_buffer: vk::CommandBuffer, + face_mask: vk::StencilFaceFlags, + fail_op: vk::StencilOp, + pass_op: vk::StencilOp, + depth_fail_op: vk::StencilOp, + compare_op: vk::CompareOp, + ) { + (self.fp.cmd_set_stencil_op_ext)( + command_buffer, + face_mask, + fail_op, + pass_op, + depth_fail_op, + compare_op, + ) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtExtendedDynamicStateFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtExtendedDynamicStateFn { + &self.fp + } +} diff --git a/third_party/rust/ash/src/extensions/ext/extended_dynamic_state2.rs b/third_party/rust/ash/src/extensions/ext/extended_dynamic_state2.rs new file mode 100644 index 0000000000..b515385930 --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/extended_dynamic_state2.rs @@ -0,0 +1,85 @@ +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_extended_dynamic_state2.html> +#[derive(Clone)] +pub struct ExtendedDynamicState2 { + fp: vk::ExtExtendedDynamicState2Fn, +} + +impl ExtendedDynamicState2 { + pub fn new(instance: &Instance, device: &Device) -> Self { + let fp = vk::ExtExtendedDynamicState2Fn::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/vkCmdSetPatchControlPointsEXT.html> + #[inline] + pub unsafe fn cmd_set_patch_control_points( + &self, + command_buffer: vk::CommandBuffer, + patch_control_points: u32, + ) { + (self.fp.cmd_set_patch_control_points_ext)(command_buffer, patch_control_points) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRasterizerDiscardEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_rasterizer_discard_enable( + &self, + command_buffer: vk::CommandBuffer, + rasterizer_discard_enable: bool, + ) { + (self.fp.cmd_set_rasterizer_discard_enable_ext)( + command_buffer, + rasterizer_discard_enable.into(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthBiasEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_depth_bias_enable( + &self, + command_buffer: vk::CommandBuffer, + depth_bias_enable: bool, + ) { + (self.fp.cmd_set_depth_bias_enable_ext)(command_buffer, depth_bias_enable.into()) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLogicOpEXT.html> + #[inline] + pub unsafe fn cmd_set_logic_op( + &self, + command_buffer: vk::CommandBuffer, + logic_op: vk::LogicOp, + ) { + (self.fp.cmd_set_logic_op_ext)(command_buffer, logic_op) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPrimitiveRestartEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_primitive_restart_enable( + &self, + command_buffer: vk::CommandBuffer, + primitive_restart_enable: bool, + ) { + (self.fp.cmd_set_primitive_restart_enable_ext)( + command_buffer, + primitive_restart_enable.into(), + ) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtExtendedDynamicState2Fn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtExtendedDynamicState2Fn { + &self.fp + } +} diff --git a/third_party/rust/ash/src/extensions/ext/extended_dynamic_state3.rs b/third_party/rust/ash/src/extensions/ext/extended_dynamic_state3.rs new file mode 100644 index 0000000000..bb68f75f3e --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/extended_dynamic_state3.rs @@ -0,0 +1,409 @@ +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_extended_dynamic_state3.html> +#[derive(Clone)] +pub struct ExtendedDynamicState3 { + fp: vk::ExtExtendedDynamicState3Fn, +} + +impl ExtendedDynamicState3 { + pub fn new(instance: &Instance, device: &Device) -> Self { + let fp = vk::ExtExtendedDynamicState3Fn::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/vkCmdSetTessellationDomainOriginEXT.html> + #[inline] + pub unsafe fn cmd_set_tessellation_domain_origin( + &self, + command_buffer: vk::CommandBuffer, + domain_origin: vk::TessellationDomainOrigin, + ) { + (self.fp.cmd_set_tessellation_domain_origin_ext)(command_buffer, domain_origin) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthClampEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_depth_clamp_enable( + &self, + command_buffer: vk::CommandBuffer, + depth_clamp_enable: bool, + ) { + (self.fp.cmd_set_depth_clamp_enable_ext)(command_buffer, depth_clamp_enable.into()) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetPolygonModeEXT.html> + #[inline] + pub unsafe fn cmd_set_polygon_mode( + &self, + command_buffer: vk::CommandBuffer, + polygon_mode: vk::PolygonMode, + ) { + (self.fp.cmd_set_polygon_mode_ext)(command_buffer, polygon_mode) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRasterizationSamplesEXT.html> + #[inline] + pub unsafe fn cmd_set_rasterization_samples( + &self, + command_buffer: vk::CommandBuffer, + rasterization_samples: vk::SampleCountFlags, + ) { + (self.fp.cmd_set_rasterization_samples_ext)(command_buffer, rasterization_samples) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetSampleMaskEXT.html> + #[inline] + pub unsafe fn cmd_set_sample_mask( + &self, + command_buffer: vk::CommandBuffer, + samples: vk::SampleCountFlags, + sample_mask: &[vk::SampleMask], + ) { + assert!( + samples.as_raw().is_power_of_two(), + "Only one SampleCount bit must be set" + ); + assert_eq!(samples.as_raw() as usize / 32, sample_mask.len()); + (self.fp.cmd_set_sample_mask_ext)(command_buffer, samples, sample_mask.as_ptr()) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetAlphaToCoverageEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_alpha_to_coverage_enable( + &self, + command_buffer: vk::CommandBuffer, + alpha_to_coverage_enable: bool, + ) { + (self.fp.cmd_set_alpha_to_coverage_enable_ext)( + command_buffer, + alpha_to_coverage_enable.into(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetAlphaToOneEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_alpha_to_one_enable( + &self, + command_buffer: vk::CommandBuffer, + alpha_to_one_enable: bool, + ) { + (self.fp.cmd_set_alpha_to_one_enable_ext)(command_buffer, alpha_to_one_enable.into()) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLogicOpEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_logic_op_enable( + &self, + command_buffer: vk::CommandBuffer, + logic_op_enable: bool, + ) { + (self.fp.cmd_set_logic_op_enable_ext)(command_buffer, logic_op_enable.into()) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorBlendEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_color_blend_enable( + &self, + command_buffer: vk::CommandBuffer, + first_attachment: u32, + color_blend_enables: &[vk::Bool32], + ) { + (self.fp.cmd_set_color_blend_enable_ext)( + command_buffer, + first_attachment, + color_blend_enables.len() as u32, + color_blend_enables.as_ptr(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorBlendEquationEXT.html> + #[inline] + pub unsafe fn cmd_set_color_blend_equation( + &self, + command_buffer: vk::CommandBuffer, + first_attachment: u32, + color_blend_equations: &[vk::ColorBlendEquationEXT], + ) { + (self.fp.cmd_set_color_blend_equation_ext)( + command_buffer, + first_attachment, + color_blend_equations.len() as u32, + color_blend_equations.as_ptr(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorWriteMaskEXT.html> + #[inline] + pub unsafe fn cmd_set_color_write_mask( + &self, + command_buffer: vk::CommandBuffer, + first_attachment: u32, + color_write_masks: &[vk::ColorComponentFlags], + ) { + (self.fp.cmd_set_color_write_mask_ext)( + command_buffer, + first_attachment, + color_write_masks.len() as u32, + color_write_masks.as_ptr(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRasterizationStreamEXT.html> + #[inline] + pub unsafe fn cmd_set_rasterization_stream( + &self, + command_buffer: vk::CommandBuffer, + rasterization_stream: u32, + ) { + (self.fp.cmd_set_rasterization_stream_ext)(command_buffer, rasterization_stream) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetConservativeRasterizationModeEXT.html> + #[inline] + pub unsafe fn cmd_set_conservative_rasterization_mode( + &self, + command_buffer: vk::CommandBuffer, + conservative_rasterization_mode: vk::ConservativeRasterizationModeEXT, + ) { + (self.fp.cmd_set_conservative_rasterization_mode_ext)( + command_buffer, + conservative_rasterization_mode, + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetExtraPrimitiveOverestimationSizeEXT.html> + #[inline] + pub unsafe fn cmd_set_extra_primitive_overestimation_size( + &self, + command_buffer: vk::CommandBuffer, + extra_primitive_overestimation_size: f32, + ) { + (self.fp.cmd_set_extra_primitive_overestimation_size_ext)( + command_buffer, + extra_primitive_overestimation_size, + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthClipEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_depth_clip_enable( + &self, + command_buffer: vk::CommandBuffer, + depth_clip_enable: bool, + ) { + (self.fp.cmd_set_depth_clip_enable_ext)(command_buffer, depth_clip_enable.into()) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetSampleLocationsEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_sample_locations_enable( + &self, + command_buffer: vk::CommandBuffer, + sample_locations_enable: bool, + ) { + (self.fp.cmd_set_sample_locations_enable_ext)( + command_buffer, + sample_locations_enable.into(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetColorBlendAdvancedEXT.html> + #[inline] + pub unsafe fn cmd_set_color_blend_advanced( + &self, + command_buffer: vk::CommandBuffer, + first_attachment: u32, + color_blend_advanced: &[vk::ColorBlendAdvancedEXT], + ) { + (self.fp.cmd_set_color_blend_advanced_ext)( + command_buffer, + first_attachment, + color_blend_advanced.len() as u32, + color_blend_advanced.as_ptr(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetProvokingVertexModeEXT.html> + #[inline] + pub unsafe fn cmd_set_provoking_vertex_mode( + &self, + command_buffer: vk::CommandBuffer, + provoking_vertex_mode: vk::ProvokingVertexModeEXT, + ) { + (self.fp.cmd_set_provoking_vertex_mode_ext)(command_buffer, provoking_vertex_mode) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLineRasterizationModeEXT.html> + #[inline] + pub unsafe fn cmd_set_line_rasterization_mode( + &self, + command_buffer: vk::CommandBuffer, + line_rasterization_mode: vk::LineRasterizationModeEXT, + ) { + (self.fp.cmd_set_line_rasterization_mode_ext)(command_buffer, line_rasterization_mode) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetLineStippleEnableEXT.html> + #[inline] + pub unsafe fn cmd_set_line_stipple_enable( + &self, + command_buffer: vk::CommandBuffer, + stippled_line_enable: bool, + ) { + (self.fp.cmd_set_line_stipple_enable_ext)(command_buffer, stippled_line_enable.into()) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetDepthClipNegativeOneToOneEXT.html> + #[inline] + pub unsafe fn cmd_set_depth_clip_negative_one_to_one( + &self, + command_buffer: vk::CommandBuffer, + negative_one_to_one: bool, + ) { + (self.fp.cmd_set_depth_clip_negative_one_to_one_ext)( + command_buffer, + negative_one_to_one.into(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetViewportWScalingEnableNV.html> + #[inline] + pub unsafe fn cmd_set_viewport_w_scaling_enable_nv( + &self, + command_buffer: vk::CommandBuffer, + viewport_w_scaling_enable: bool, + ) { + (self.fp.cmd_set_viewport_w_scaling_enable_nv)( + command_buffer, + viewport_w_scaling_enable.into(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetViewportSwizzleNV.html> + #[inline] + pub unsafe fn cmd_set_viewport_swizzle_nv( + &self, + command_buffer: vk::CommandBuffer, + first_attachment: u32, + viewport_swizzles: &[vk::ViewportSwizzleNV], + ) { + (self.fp.cmd_set_viewport_swizzle_nv)( + command_buffer, + first_attachment, + viewport_swizzles.len() as u32, + viewport_swizzles.as_ptr(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageToColorEnableNV.html> + #[inline] + pub unsafe fn cmd_set_coverage_to_color_enable_nv( + &self, + command_buffer: vk::CommandBuffer, + coverage_to_color_enable: bool, + ) { + (self.fp.cmd_set_coverage_to_color_enable_nv)( + command_buffer, + coverage_to_color_enable.into(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageToColorLocationNV.html> + #[inline] + pub unsafe fn cmd_set_coverage_to_color_location_nv( + &self, + command_buffer: vk::CommandBuffer, + coverage_to_color_location: u32, + ) { + (self.fp.cmd_set_coverage_to_color_location_nv)(command_buffer, coverage_to_color_location) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageModulationModeNV.html> + #[inline] + pub unsafe fn cmd_set_coverage_modulation_mode_nv( + &self, + command_buffer: vk::CommandBuffer, + coverage_modulation_mode: vk::CoverageModulationModeNV, + ) { + (self.fp.cmd_set_coverage_modulation_mode_nv)(command_buffer, coverage_modulation_mode) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageModulationTableEnableNV.html> + #[inline] + pub unsafe fn cmd_set_coverage_modulation_table_enable_nv( + &self, + command_buffer: vk::CommandBuffer, + coverage_modulation_table_enable: bool, + ) { + (self.fp.cmd_set_coverage_modulation_table_enable_nv)( + command_buffer, + coverage_modulation_table_enable.into(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageModulationTableNV.html> + #[inline] + pub unsafe fn cmd_set_coverage_modulation_table_nv( + &self, + command_buffer: vk::CommandBuffer, + coverage_modulation_table: &[f32], + ) { + (self.fp.cmd_set_coverage_modulation_table_nv)( + command_buffer, + coverage_modulation_table.len() as u32, + coverage_modulation_table.as_ptr(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetShadingRateImageEnableNV.html> + #[inline] + pub unsafe fn cmd_set_shading_rate_image_enable_nv( + &self, + command_buffer: vk::CommandBuffer, + shading_rate_image_enable: bool, + ) { + (self.fp.cmd_set_shading_rate_image_enable_nv)( + command_buffer, + shading_rate_image_enable.into(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetRepresentativeFragmentTestEnableNV.html> + #[inline] + pub unsafe fn cmd_set_representative_fragment_test_enable_nv( + &self, + command_buffer: vk::CommandBuffer, + representative_fragment_test_enable: bool, + ) { + (self.fp.cmd_set_representative_fragment_test_enable_nv)( + command_buffer, + representative_fragment_test_enable.into(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetCoverageReductionModeNV.html> + #[inline] + pub unsafe fn cmd_set_coverage_reduction_mode_nv( + &self, + command_buffer: vk::CommandBuffer, + coverage_reduction_mode: vk::CoverageReductionModeNV, + ) { + (self.fp.cmd_set_coverage_reduction_mode_nv)(command_buffer, coverage_reduction_mode) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtExtendedDynamicState3Fn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtExtendedDynamicState3Fn { + &self.fp + } +} diff --git a/third_party/rust/ash/src/extensions/ext/full_screen_exclusive.rs b/third_party/rust/ash/src/extensions/ext/full_screen_exclusive.rs new file mode 100644 index 0000000000..3cb73cdaeb --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/full_screen_exclusive.rs @@ -0,0 +1,86 @@ +use crate::prelude::*; +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +#[derive(Clone)] +pub struct FullScreenExclusive { + handle: vk::Device, + fp: vk::ExtFullScreenExclusiveFn, +} + +impl FullScreenExclusive { + pub fn new(instance: &Instance, device: &Device) -> Self { + let handle = device.handle(); + let fp = vk::ExtFullScreenExclusiveFn::load(|name| unsafe { + mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr())) + }); + Self { handle, fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkAcquireFullScreenExclusiveModeEXT.html> + #[inline] + pub unsafe fn acquire_full_screen_exclusive_mode( + &self, + swapchain: vk::SwapchainKHR, + ) -> VkResult<()> { + (self.fp.acquire_full_screen_exclusive_mode_ext)(self.handle, swapchain).result() + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfacePresentModes2EXT.html> + #[inline] + pub unsafe fn get_physical_device_surface_present_modes2( + &self, + physical_device: vk::PhysicalDevice, + surface_info: &vk::PhysicalDeviceSurfaceInfo2KHR, + ) -> VkResult<Vec<vk::PresentModeKHR>> { + read_into_uninitialized_vector(|count, data| { + (self.fp.get_physical_device_surface_present_modes2_ext)( + physical_device, + surface_info, + count, + data, + ) + }) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkReleaseFullScreenExclusiveModeEXT.html> + #[inline] + pub unsafe fn release_full_screen_exclusive_mode( + &self, + swapchain: vk::SwapchainKHR, + ) -> VkResult<()> { + (self.fp.release_full_screen_exclusive_mode_ext)(self.handle, swapchain).result() + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetDeviceGroupSurfacePresentModes2EXT.html> + #[inline] + pub unsafe fn get_device_group_surface_present_modes2( + &self, + surface_info: &vk::PhysicalDeviceSurfaceInfo2KHR, + ) -> VkResult<vk::DeviceGroupPresentModeFlagsKHR> { + let mut present_modes = mem::zeroed(); + (self.fp.get_device_group_surface_present_modes2_ext)( + self.handle, + surface_info, + &mut present_modes, + ) + .result_with_success(present_modes) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtFullScreenExclusiveFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtFullScreenExclusiveFn { + &self.fp + } + + #[inline] + pub fn device(&self) -> vk::Device { + self.handle + } +} diff --git a/third_party/rust/ash/src/extensions/ext/headless_surface.rs b/third_party/rust/ash/src/extensions/ext/headless_surface.rs new file mode 100644 index 0000000000..fe04236aaf --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/headless_surface.rs @@ -0,0 +1,55 @@ +use crate::prelude::*; +use crate::vk; +use crate::RawPtr; +use crate::{Entry, Instance}; +use std::ffi::CStr; +use std::mem; + +/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_headless_surface.html> +#[derive(Clone)] +pub struct HeadlessSurface { + handle: vk::Instance, + fp: vk::ExtHeadlessSurfaceFn, +} + +impl HeadlessSurface { + pub fn new(entry: &Entry, instance: &Instance) -> Self { + let handle = instance.handle(); + let fp = vk::ExtHeadlessSurfaceFn::load(|name| unsafe { + mem::transmute(entry.get_instance_proc_addr(handle, name.as_ptr())) + }); + Self { handle, fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateHeadlessSurfaceEXT.html> + #[inline] + pub unsafe fn create_headless_surface( + &self, + create_info: &vk::HeadlessSurfaceCreateInfoEXT, + allocation_callbacks: Option<&vk::AllocationCallbacks>, + ) -> VkResult<vk::SurfaceKHR> { + let mut surface = mem::zeroed(); + (self.fp.create_headless_surface_ext)( + self.handle, + create_info, + allocation_callbacks.as_raw_ptr(), + &mut surface, + ) + .result_with_success(surface) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtHeadlessSurfaceFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtHeadlessSurfaceFn { + &self.fp + } + + #[inline] + pub fn instance(&self) -> vk::Instance { + self.handle + } +} diff --git a/third_party/rust/ash/src/extensions/ext/image_compression_control.rs b/third_party/rust/ash/src/extensions/ext/image_compression_control.rs new file mode 100644 index 0000000000..a326116973 --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/image_compression_control.rs @@ -0,0 +1,47 @@ +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_image_compression_control.html> +#[derive(Clone)] +pub struct ImageCompressionControl { + handle: vk::Device, + fp: vk::ExtImageCompressionControlFn, +} + +impl ImageCompressionControl { + pub fn new(instance: &Instance, device: &Device) -> Self { + let handle = device.handle(); + let fp = vk::ExtImageCompressionControlFn::load(|name| unsafe { + mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr())) + }); + Self { handle, fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout2EXT.html> + #[inline] + pub unsafe fn get_image_subresource_layout2( + &self, + image: vk::Image, + subresource: &vk::ImageSubresource2EXT, + layout: &mut vk::SubresourceLayout2EXT, + ) { + (self.fp.get_image_subresource_layout2_ext)(self.handle, image, subresource, layout) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtImageCompressionControlFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtImageCompressionControlFn { + &self.fp + } + + #[inline] + pub fn device(&self) -> vk::Device { + self.handle + } +} diff --git a/third_party/rust/ash/src/extensions/ext/image_drm_format_modifier.rs b/third_party/rust/ash/src/extensions/ext/image_drm_format_modifier.rs new file mode 100644 index 0000000000..ccdce2eb5e --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/image_drm_format_modifier.rs @@ -0,0 +1,48 @@ +use crate::prelude::*; +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_image_drm_format_modifier.html> +#[derive(Clone)] +pub struct ImageDrmFormatModifier { + handle: vk::Device, + fp: vk::ExtImageDrmFormatModifierFn, +} + +impl ImageDrmFormatModifier { + pub fn new(instance: &Instance, device: &Device) -> Self { + let handle = device.handle(); + let fp = vk::ExtImageDrmFormatModifierFn::load(|name| unsafe { + mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr())) + }); + Self { handle, fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageDrmFormatModifierPropertiesEXT.html> + #[inline] + pub unsafe fn get_image_drm_format_modifier_properties( + &self, + image: vk::Image, + properties: &mut vk::ImageDrmFormatModifierPropertiesEXT, + ) -> VkResult<()> { + (self.fp.get_image_drm_format_modifier_properties_ext)(self.handle, image, properties) + .result() + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtImageDrmFormatModifierFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtImageDrmFormatModifierFn { + &self.fp + } + + #[inline] + pub fn device(&self) -> vk::Device { + self.handle + } +} diff --git a/third_party/rust/ash/src/extensions/ext/mesh_shader.rs b/third_party/rust/ash/src/extensions/ext/mesh_shader.rs new file mode 100644 index 0000000000..7d58f0c135 --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/mesh_shader.rs @@ -0,0 +1,94 @@ +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_mesh_shader.html> +#[derive(Clone)] +pub struct MeshShader { + fp: vk::ExtMeshShaderFn, +} + +impl MeshShader { + pub fn new(instance: &Instance, device: &Device) -> Self { + let fp = vk::ExtMeshShaderFn::load(|name| unsafe { + mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) + }); + Self { fp } + } + + /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksEXT.html> + #[inline] + pub unsafe fn cmd_draw_mesh_tasks( + &self, + command_buffer: vk::CommandBuffer, + group_count_x: u32, + group_count_y: u32, + group_count_z: u32, + ) { + (self.fp.cmd_draw_mesh_tasks_ext)( + command_buffer, + group_count_x, + group_count_y, + group_count_z, + ); + } + + /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksIndirectEXT.html> + /// + /// `buffer` contains `draw_count` [`vk::DrawMeshTasksIndirectCommandEXT`] structures starting at `offset` in bytes, holding the draw parameters. + #[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_ext)( + command_buffer, + buffer, + offset, + draw_count, + stride, + ); + } + + /// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDrawMeshTasksIndirectCountEXT.html> + /// + /// `buffer` contains a maximum of `max_draw_count` [`vk::DrawMeshTasksIndirectCommandEXT`] structures starting at `offset` in bytes, holding the draw parameters. + /// `count_buffer` is the buffer containing the draw count, starting at `count_buffer_offset` in bytes. + /// The actual number of executed draw calls is the minimum of the count specified in `count_buffer` and `max_draw_count`. + #[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_ext)( + command_buffer, + buffer, + offset, + count_buffer, + count_buffer_offset, + max_draw_count, + stride, + ); + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtMeshShaderFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtMeshShaderFn { + &self.fp + } +} diff --git a/third_party/rust/ash/src/extensions/ext/metal_surface.rs b/third_party/rust/ash/src/extensions/ext/metal_surface.rs new file mode 100644 index 0000000000..9627d2f510 --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/metal_surface.rs @@ -0,0 +1,54 @@ +use crate::prelude::*; +use crate::vk; +use crate::RawPtr; +use crate::{Entry, Instance}; +use std::ffi::CStr; +use std::mem; + +#[derive(Clone)] +pub struct MetalSurface { + handle: vk::Instance, + fp: vk::ExtMetalSurfaceFn, +} + +impl MetalSurface { + pub fn new(entry: &Entry, instance: &Instance) -> Self { + let handle = instance.handle(); + let fp = vk::ExtMetalSurfaceFn::load(|name| unsafe { + mem::transmute(entry.get_instance_proc_addr(handle, name.as_ptr())) + }); + Self { handle, fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreateMetalSurfaceEXT.html> + #[inline] + pub unsafe fn create_metal_surface( + &self, + create_info: &vk::MetalSurfaceCreateInfoEXT, + allocation_callbacks: Option<&vk::AllocationCallbacks>, + ) -> VkResult<vk::SurfaceKHR> { + let mut surface = mem::zeroed(); + (self.fp.create_metal_surface_ext)( + self.handle, + create_info, + allocation_callbacks.as_raw_ptr(), + &mut surface, + ) + .result_with_success(surface) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtMetalSurfaceFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtMetalSurfaceFn { + &self.fp + } + + #[inline] + pub fn instance(&self) -> vk::Instance { + self.handle + } +} diff --git a/third_party/rust/ash/src/extensions/ext/mod.rs b/third_party/rust/ash/src/extensions/ext/mod.rs new file mode 100644 index 0000000000..26a78f77d6 --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/mod.rs @@ -0,0 +1,45 @@ +pub use self::acquire_drm_display::AcquireDrmDisplay; +pub use self::buffer_device_address::BufferDeviceAddress; +pub use self::calibrated_timestamps::CalibratedTimestamps; +#[allow(deprecated)] +pub use self::debug_marker::DebugMarker; +#[allow(deprecated)] +pub use self::debug_report::DebugReport; +pub use self::debug_utils::DebugUtils; +pub use self::descriptor_buffer::DescriptorBuffer; +pub use self::extended_dynamic_state::ExtendedDynamicState; +pub use self::extended_dynamic_state2::ExtendedDynamicState2; +pub use self::extended_dynamic_state3::ExtendedDynamicState3; +pub use self::full_screen_exclusive::FullScreenExclusive; +pub use self::headless_surface::HeadlessSurface; +pub use self::image_compression_control::ImageCompressionControl; +pub use self::image_drm_format_modifier::ImageDrmFormatModifier; +pub use self::mesh_shader::MeshShader; +pub use self::metal_surface::MetalSurface; +pub use self::physical_device_drm::PhysicalDeviceDrm; +pub use self::private_data::PrivateData; +pub use self::sample_locations::SampleLocations; +pub use self::tooling_info::ToolingInfo; + +mod acquire_drm_display; +mod buffer_device_address; +mod calibrated_timestamps; +#[deprecated(note = "Please use the [DebugUtils](struct.DebugUtils.html) extension instead.")] +mod debug_marker; +#[deprecated(note = "Please use the [DebugUtils](struct.DebugUtils.html) extension instead.")] +mod debug_report; +mod debug_utils; +mod descriptor_buffer; +mod extended_dynamic_state; +mod extended_dynamic_state2; +mod extended_dynamic_state3; +mod full_screen_exclusive; +mod headless_surface; +mod image_compression_control; +mod image_drm_format_modifier; +mod mesh_shader; +mod metal_surface; +mod physical_device_drm; +mod private_data; +mod sample_locations; +mod tooling_info; diff --git a/third_party/rust/ash/src/extensions/ext/physical_device_drm.rs b/third_party/rust/ash/src/extensions/ext/physical_device_drm.rs new file mode 100644 index 0000000000..29b6cd7b32 --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/physical_device_drm.rs @@ -0,0 +1,26 @@ +use crate::vk; +use crate::Instance; +use std::ffi::CStr; + +#[derive(Clone)] +pub struct PhysicalDeviceDrm; + +impl PhysicalDeviceDrm { + #[inline] + pub unsafe fn get_properties( + instance: &Instance, + pdevice: vk::PhysicalDevice, + ) -> vk::PhysicalDeviceDrmPropertiesEXT { + let mut props_drm = vk::PhysicalDeviceDrmPropertiesEXT::default(); + { + let mut props = vk::PhysicalDeviceProperties2::builder().push_next(&mut props_drm); + instance.get_physical_device_properties2(pdevice, &mut props); + } + props_drm + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtPhysicalDeviceDrmFn::name() + } +} diff --git a/third_party/rust/ash/src/extensions/ext/private_data.rs b/third_party/rust/ash/src/extensions/ext/private_data.rs new file mode 100644 index 0000000000..c6cc6aefb1 --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/private_data.rs @@ -0,0 +1,105 @@ +use crate::prelude::*; +use crate::vk; +use crate::RawPtr; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_private_data.html> +#[derive(Clone)] +pub struct PrivateData { + handle: vk::Device, + fp: vk::ExtPrivateDataFn, +} + +impl PrivateData { + pub fn new(instance: &Instance, device: &Device) -> Self { + let handle = device.handle(); + let fp = vk::ExtPrivateDataFn::load(|name| unsafe { + mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr())) + }); + Self { handle, fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCreatePrivateDataSlotEXT.html> + #[inline] + pub unsafe fn create_private_data_slot( + &self, + create_info: &vk::PrivateDataSlotCreateInfoEXT, + allocation_callbacks: Option<&vk::AllocationCallbacks>, + ) -> VkResult<vk::PrivateDataSlotEXT> { + let mut private_data_slot = mem::zeroed(); + (self.fp.create_private_data_slot_ext)( + self.handle, + create_info, + allocation_callbacks.as_raw_ptr(), + &mut private_data_slot, + ) + .result_with_success(private_data_slot) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkDestroyPrivateDataSlotEXT.html> + #[inline] + pub unsafe fn destroy_private_data_slot( + &self, + private_data_slot: vk::PrivateDataSlotEXT, + allocation_callbacks: Option<&vk::AllocationCallbacks>, + ) { + (self.fp.destroy_private_data_slot_ext)( + self.handle, + private_data_slot, + allocation_callbacks.as_raw_ptr(), + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkSetPrivateDataEXT.html> + #[inline] + pub unsafe fn set_private_data<T: vk::Handle>( + &self, + object: T, + private_data_slot: vk::PrivateDataSlotEXT, + data: u64, + ) -> VkResult<()> { + (self.fp.set_private_data_ext)( + self.handle, + T::TYPE, + object.as_raw(), + private_data_slot, + data, + ) + .result() + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPrivateDataEXT.html> + #[inline] + pub unsafe fn get_private_data<T: vk::Handle>( + &self, + object: T, + private_data_slot: vk::PrivateDataSlotEXT, + ) -> u64 { + let mut data = mem::zeroed(); + (self.fp.get_private_data_ext)( + self.handle, + T::TYPE, + object.as_raw(), + private_data_slot, + &mut data, + ); + data + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtPrivateDataFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtPrivateDataFn { + &self.fp + } + + #[inline] + pub fn device(&self) -> vk::Device { + self.handle + } +} diff --git a/third_party/rust/ash/src/extensions/ext/sample_locations.rs b/third_party/rust/ash/src/extensions/ext/sample_locations.rs new file mode 100644 index 0000000000..360b83a681 --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/sample_locations.rs @@ -0,0 +1,54 @@ +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_EXT_sample_locations.html> +#[derive(Clone)] +pub struct SampleLocations { + fp: vk::ExtSampleLocationsFn, +} + +impl SampleLocations { + pub fn new(entry: &Entry, instance: &Instance) -> Self { + let fp = vk::ExtSampleLocationsFn::load(|name| unsafe { + mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) + }); + Self { fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceMultisamplePropertiesEXT.html> + #[inline] + pub unsafe fn get_physical_device_multisample_properties( + &self, + physical_device: vk::PhysicalDevice, + samples: vk::SampleCountFlags, + multisample_properties: &mut vk::MultisamplePropertiesEXT, + ) { + (self.fp.get_physical_device_multisample_properties_ext)( + physical_device, + samples, + multisample_properties, + ) + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdSetSampleLocationsEXT.html> + #[inline] + pub unsafe fn cmd_set_sample_locations( + &self, + command_buffer: vk::CommandBuffer, + sample_locations_info: &vk::SampleLocationsInfoEXT, + ) { + (self.fp.cmd_set_sample_locations_ext)(command_buffer, sample_locations_info) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtSampleLocationsFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtSampleLocationsFn { + &self.fp + } +} diff --git a/third_party/rust/ash/src/extensions/ext/tooling_info.rs b/third_party/rust/ash/src/extensions/ext/tooling_info.rs new file mode 100644 index 0000000000..fd4bf994e7 --- /dev/null +++ b/third_party/rust/ash/src/extensions/ext/tooling_info.rs @@ -0,0 +1,40 @@ +use crate::prelude::*; +use crate::vk; +use crate::{Entry, Instance}; +use std::ffi::CStr; +use std::mem; + +#[derive(Clone)] +pub struct ToolingInfo { + fp: vk::ExtToolingInfoFn, +} + +impl ToolingInfo { + pub fn new(entry: &Entry, instance: &Instance) -> Self { + let fp = vk::ExtToolingInfoFn::load(|name| unsafe { + mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) + }); + Self { fp } + } + + /// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceToolPropertiesEXT.html> + #[inline] + pub unsafe fn get_physical_device_tool_properties( + &self, + physical_device: vk::PhysicalDevice, + ) -> VkResult<Vec<vk::PhysicalDeviceToolPropertiesEXT>> { + read_into_defaulted_vector(|count, data| { + (self.fp.get_physical_device_tool_properties_ext)(physical_device, count, data) + }) + } + + #[inline] + pub const fn name() -> &'static CStr { + vk::ExtToolingInfoFn::name() + } + + #[inline] + pub fn fp(&self) -> &vk::ExtToolingInfoFn { + &self.fp + } +} |