extensions/amd: Add VK_AMD_buffer_marker (#772)

This commit is contained in:
Marijn Suijten 2023-07-29 10:45:11 +02:00 committed by GitHub
parent 010df1b1b3
commit 884ac46e82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 0 deletions

View file

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `VK_NV_memory_decompression` device extension (#761)
- Added `VK_GOOGLE_display_timing` device extension (#765)
- Added `VK_ANDROID_external_memory_android_hardware_buffer` device extension (#769)
- Added `VK_AMD_buffer_marker` device extension (#772)
### Changed

View file

@ -0,0 +1,45 @@
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_AMD_buffer_marker.html>
#[derive(Clone)]
pub struct BufferMarker {
fp: vk::AmdBufferMarkerFn,
}
impl BufferMarker {
pub fn new(instance: &Instance, device: &Device) -> Self {
let fp = vk::AmdBufferMarkerFn::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/vkCmdWriteBufferMarkerAMD.html>
#[inline]
pub unsafe fn cmd_write_buffer_marker(
&self,
command_buffer: vk::CommandBuffer,
pipeline_stage: vk::PipelineStageFlags,
dst_buffer: vk::Buffer,
dst_offset: vk::DeviceSize,
marker: u32,
) {
(self.fp.cmd_write_buffer_marker_amd)(
command_buffer,
pipeline_stage,
dst_buffer,
dst_offset,
marker,
)
}
pub const NAME: &'static CStr = vk::AmdBufferMarkerFn::NAME;
#[inline]
pub fn fp(&self) -> &vk::AmdBufferMarkerFn {
&self.fp
}
}

View file

@ -0,0 +1,3 @@
pub use self::buffer_marker::BufferMarker;
mod buffer_marker;

View file

@ -1,3 +1,4 @@
pub mod amd;
pub mod android;
pub mod ext;
pub mod google;