extensions/khr: Add VK_KHR_dynamic_rendering wrapper (#488)
This commit is contained in:
parent
3947675aaa
commit
6857f7b4d3
43
ash/src/extensions/khr/dynamic_rendering.rs
Normal file
43
ash/src/extensions/khr/dynamic_rendering.rs
Normal file
|
@ -0,0 +1,43 @@
|
|||
use crate::vk;
|
||||
use crate::{Device, Instance};
|
||||
use std::ffi::CStr;
|
||||
use std::mem;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct DynamicRendering {
|
||||
fns: vk::KhrDynamicRenderingFn,
|
||||
}
|
||||
|
||||
impl DynamicRendering {
|
||||
pub fn new(instance: &Instance, device: &Device) -> Self {
|
||||
let dynamic_rendering_fn = vk::KhrDynamicRenderingFn::load(|name| unsafe {
|
||||
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
|
||||
});
|
||||
Self {
|
||||
fns: dynamic_rendering_fn,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name() -> &'static CStr {
|
||||
vk::KhrDynamicRenderingFn::name()
|
||||
}
|
||||
|
||||
pub fn fp(&self) -> &vk::KhrDynamicRenderingFn {
|
||||
&self.fns
|
||||
}
|
||||
|
||||
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkCmdBeginRenderingKHR.html>"]
|
||||
pub unsafe fn cmd_begin_rendering(
|
||||
&self,
|
||||
command_buffer: vk::CommandBuffer,
|
||||
rendering_info: &vk::RenderingInfoKHR,
|
||||
) {
|
||||
self.fns
|
||||
.cmd_begin_rendering_khr(command_buffer, rendering_info)
|
||||
}
|
||||
|
||||
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkCmdEndRenderingKHR.html>"]
|
||||
pub unsafe fn cmd_end_rendering(&self, command_buffer: vk::CommandBuffer) {
|
||||
self.fns.cmd_end_rendering_khr(command_buffer)
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ pub use self::deferred_host_operations::DeferredHostOperations;
|
|||
pub use self::display::Display;
|
||||
pub use self::display_swapchain::DisplaySwapchain;
|
||||
pub use self::draw_indirect_count::DrawIndirectCount;
|
||||
pub use self::dynamic_rendering::DynamicRendering;
|
||||
pub use self::external_fence_fd::ExternalFenceFd;
|
||||
pub use self::external_memory_fd::ExternalMemoryFd;
|
||||
pub use self::external_semaphore_fd::ExternalSemaphoreFd;
|
||||
|
@ -33,6 +34,7 @@ mod deferred_host_operations;
|
|||
mod display;
|
||||
mod display_swapchain;
|
||||
mod draw_indirect_count;
|
||||
mod dynamic_rendering;
|
||||
mod external_fence_fd;
|
||||
mod external_memory_fd;
|
||||
mod external_semaphore_fd;
|
||||
|
|
Loading…
Reference in a new issue