Add high-level extension wrapper for the 1.1 extension VK_KHR_create_renderpass2 (#414)
* Add high-level extension wrapper for the 1.1 extension VK_KHR_create_renderpass2 https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_create_renderpass2.html * Fixes * fmt
This commit is contained in:
parent
983a981a02
commit
14136e5e96
92
ash/src/extensions/khr/create_render_pass2.rs
Normal file
92
ash/src/extensions/khr/create_render_pass2.rs
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
#![allow(dead_code)]
|
||||||
|
use crate::prelude::*;
|
||||||
|
use crate::version::{DeviceV1_0, InstanceV1_0};
|
||||||
|
use crate::vk;
|
||||||
|
use crate::RawPtr;
|
||||||
|
use std::ffi::CStr;
|
||||||
|
use std::mem;
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct CreateRenderPass2 {
|
||||||
|
handle: vk::Device,
|
||||||
|
khr_create_renderpass2_fn: vk::KhrCreateRenderpass2Fn,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CreateRenderPass2 {
|
||||||
|
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> CreateRenderPass2 {
|
||||||
|
let khr_create_renderpass2_fn = vk::KhrCreateRenderpass2Fn::load(|name| unsafe {
|
||||||
|
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
|
||||||
|
});
|
||||||
|
CreateRenderPass2 {
|
||||||
|
handle: device.handle(),
|
||||||
|
khr_create_renderpass2_fn,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn name() -> &'static CStr {
|
||||||
|
vk::KhrCreateRenderpass2Fn::name()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkCreateRenderPass2.html>"]
|
||||||
|
pub unsafe fn create_render_pass2(
|
||||||
|
&self,
|
||||||
|
create_info: &vk::RenderPassCreateInfo2,
|
||||||
|
allocation_callbacks: Option<&vk::AllocationCallbacks>,
|
||||||
|
) -> VkResult<vk::RenderPass> {
|
||||||
|
let mut renderpass = mem::zeroed();
|
||||||
|
self.khr_create_renderpass2_fn
|
||||||
|
.create_render_pass2_khr(
|
||||||
|
self.handle,
|
||||||
|
create_info,
|
||||||
|
allocation_callbacks.as_raw_ptr(),
|
||||||
|
&mut renderpass,
|
||||||
|
)
|
||||||
|
.result_with_success(renderpass)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkCmdBeginRenderPass2.html>"]
|
||||||
|
pub unsafe fn cmd_begin_render_pass2(
|
||||||
|
&self,
|
||||||
|
command_buffer: vk::CommandBuffer,
|
||||||
|
render_pass_begin_info: &vk::RenderPassBeginInfo,
|
||||||
|
subpass_begin_info: &vk::SubpassBeginInfo,
|
||||||
|
) {
|
||||||
|
self.khr_create_renderpass2_fn.cmd_begin_render_pass2_khr(
|
||||||
|
command_buffer,
|
||||||
|
render_pass_begin_info,
|
||||||
|
subpass_begin_info,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkCmdNextSubpass2.html>"]
|
||||||
|
pub unsafe fn cmd_next_subpass2(
|
||||||
|
&self,
|
||||||
|
command_buffer: vk::CommandBuffer,
|
||||||
|
subpass_begin_info: &vk::SubpassBeginInfo,
|
||||||
|
subpass_end_info: &vk::SubpassEndInfo,
|
||||||
|
) {
|
||||||
|
self.khr_create_renderpass2_fn.cmd_next_subpass2_khr(
|
||||||
|
command_buffer,
|
||||||
|
subpass_begin_info,
|
||||||
|
subpass_end_info,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkCmdEndRenderPass2.html>"]
|
||||||
|
pub unsafe fn cmd_end_render_pass2(
|
||||||
|
&self,
|
||||||
|
command_buffer: vk::CommandBuffer,
|
||||||
|
subpass_end_info: &vk::SubpassEndInfo,
|
||||||
|
) {
|
||||||
|
self.khr_create_renderpass2_fn
|
||||||
|
.cmd_end_render_pass2_khr(command_buffer, subpass_end_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn fp(&self) -> &vk::KhrCreateRenderpass2Fn {
|
||||||
|
&self.khr_create_renderpass2_fn
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn device(&self) -> vk::Device {
|
||||||
|
self.handle
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
pub use self::acceleration_structure::AccelerationStructure;
|
pub use self::acceleration_structure::AccelerationStructure;
|
||||||
pub use self::android_surface::AndroidSurface;
|
pub use self::android_surface::AndroidSurface;
|
||||||
pub use self::buffer_device_address::BufferDeviceAddress;
|
pub use self::buffer_device_address::BufferDeviceAddress;
|
||||||
|
pub use self::create_render_pass2::CreateRenderPass2;
|
||||||
pub use self::deferred_host_operations::DeferredHostOperations;
|
pub use self::deferred_host_operations::DeferredHostOperations;
|
||||||
pub use self::display::Display;
|
pub use self::display::Display;
|
||||||
pub use self::display_swapchain::DisplaySwapchain;
|
pub use self::display_swapchain::DisplaySwapchain;
|
||||||
|
@ -24,6 +25,7 @@ pub use self::xlib_surface::XlibSurface;
|
||||||
mod acceleration_structure;
|
mod acceleration_structure;
|
||||||
mod android_surface;
|
mod android_surface;
|
||||||
mod buffer_device_address;
|
mod buffer_device_address;
|
||||||
|
mod create_render_pass2;
|
||||||
mod deferred_host_operations;
|
mod deferred_host_operations;
|
||||||
mod display;
|
mod display;
|
||||||
mod display_swapchain;
|
mod display_swapchain;
|
||||||
|
|
Loading…
Reference in a new issue