Skip to content

Commit

Permalink
extensions/amd: Add VK_AMD_buffer_marker (#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 authored Jul 29, 2023
1 parent 010df1b commit 884ac46
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
45 changes: 45 additions & 0 deletions ash/src/extensions/amd/buffer_marker.rs
Original file line number Diff line number Diff line change
@@ -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
}
}
3 changes: 3 additions & 0 deletions ash/src/extensions/amd/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub use self::buffer_marker::BufferMarker;

mod buffer_marker;
1 change: 1 addition & 0 deletions ash/src/extensions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod amd;
pub mod android;
pub mod ext;
pub mod google;
Expand Down

0 comments on commit 884ac46

Please sign in to comment.