#[repr(C)]
pub struct MemoryMapFlags(u32);
+#[repr(C)]
+pub struct MemoryAllocateFlags(u32);
+
+impl MemoryAllocateFlags {
+ pub const DEVICE_MASK: Self = Self(0x00000001);
+ pub const DEVICE_ADDRESS_BIT: Self = Self(0x00000002);
+ pub const DEVICE_ADDRESS_CAPTURE_REPLAY_BIT: Self = Self(0x00000004);
+}
+
#[repr(C)]
pub struct ImageAspectFlags(u32);
impl ImageAspectFlags {
MemoryPropertyFlags,
MemoryHeapFlags,
MemoryMapFlags,
+ MemoryAllocateFlags,
ImageAspectFlags,
SparseMemoryBindFlags,
SparseImageFormatFlags,
pub type FnBindBufferMemory2 =
extern "system" fn(device: Device, bind_info_count: u32, *const BindBufferMemoryInfo);
+pub type FnGetBufferDeviceAddress =
+ extern "system" fn(device: Device, info: *const BufferDeviceAddressInfo) -> DeviceAddress;
+
pub type FnCmdWriteTimestamp = extern "system" fn(
command_buffer: CommandBuffer,
pipeline_stage: PipelineStageFlags,
destroy_render_pass: FnDestroyRenderPass,
create_semaphore: FnCreateSemaphore,
destroy_semaphore: FnDestroySemaphore,
- get_semaphore_counter_value: FnGetSemaphoreCounterValue,
wait_semaphores: FnWaitSemaphores,
signal_semaphore: FnSignalSemaphore,
create_fence: FnCreateFence,
get_buffer_memory_requirements2: FnGetBufferMemoryRequirements2,
bind_buffer_memory2: FnBindBufferMemory2,
+ // VERSION_1_2
+ get_buffer_device_address: FnGetBufferDeviceAddress,
+ get_semaphore_counter_value: FnGetSemaphoreCounterValue,
+
// VERSION_1_3
cmd_pipeline_barrier2: FnCmdPipelineBarrier2,
cmd_wait_events2: FnCmdWaitEvents2,
bind_buffer_memory2: transmute::<_, _>(load(c"vkBindBufferMemory2", VERSION_1_1)),
// VERSION_1_2
+ get_buffer_device_address: transmute::<_, _>(load(
+ c"vkGetBufferDeviceAddress",
+ VERSION_1_2,
+ )),
+
get_semaphore_counter_value: transmute::<_, _>(load(
c"vkGetSemaphoreCounterValue",
VERSION_1_2,
(self.bind_buffer_memory2)(device, bind_infos.len() as u32, bind_infos.as_ptr())
}
+ #[inline]
+ pub unsafe fn get_buffer_device_address(
+ &self,
+ device: Device,
+ info: &BufferDeviceAddressInfo,
+ ) -> DeviceAddress {
+ (self.get_buffer_device_address)(device, info)
+ }
+
#[inline]
pub unsafe fn queue_wait_idle(&self, queue: Queue) -> Result {
(self.queue_wait_idle)(queue)
}
}
+#[repr(C)]
+pub struct MemoryAllocateFlagsInfo {
+ pub _type: StructureType,
+ pub _next: *const c_void,
+ pub flags: MemoryAllocateFlags,
+ pub device_mask: u32,
+}
+
+impl Default for MemoryAllocateFlagsInfo {
+ fn default() -> Self {
+ MemoryAllocateFlagsInfo {
+ _type: StructureType::MemoryAllocateFlagsInfo,
+ _next: std::ptr::null(),
+ flags: MemoryAllocateFlags::default(),
+ device_mask: 0,
+ }
+ }
+}
+
#[repr(C)]
pub struct MemoryRequirements {
pub size: DeviceSize, // Specified in bytes
}
}
+#[repr(C)]
+pub struct BufferDeviceAddressInfo {
+ pub _type: StructureType,
+ pub _next: *const c_void,
+ pub buffer: Buffer,
+}
+
+impl Default for BufferDeviceAddressInfo {
+ fn default() -> Self {
+ BufferDeviceAddressInfo {
+ _type: StructureType::BufferDeviceAddressInfo,
+ _next: std::ptr::null(),
+ buffer: Buffer::null(),
+ }
+ }
+}
+
#[repr(C)]
pub struct ImageSubresource {
pub aspect_mask: ImageAspectFlags,