#![allow(unused_imports)]
use crate::{vk::Result as VkResult, vk::*, *};
use core::ffi::{CStr, c_char, c_int, c_void};
use core::mem::transmute;
use core::ptr;
pub const EXTENSION_NAME: &CStr = c"VK_KHR_create_renderpass2";
pub(super) mod defs {
#![allow(non_camel_case_types, unused_imports)]
use crate::{vk::*, *};
use core::ffi::{CStr, c_char, c_int, c_void};
use core::fmt;
use core::marker::PhantomData;
use core::ptr;
pub type AttachmentDescription2KHR<'a> = AttachmentDescription2<'a>;
pub type AttachmentReference2KHR<'a> = AttachmentReference2<'a>;
pub type SubpassDescription2KHR<'a> = SubpassDescription2<'a>;
pub type SubpassDependency2KHR<'a> = SubpassDependency2<'a>;
pub type RenderPassCreateInfo2KHR<'a> = RenderPassCreateInfo2<'a>;
pub type SubpassBeginInfoKHR<'a> = SubpassBeginInfo<'a>;
pub type SubpassEndInfoKHR<'a> = SubpassEndInfo<'a>;
pub type PFN_vkCreateRenderPass2KHR = PFN_vkCreateRenderPass2;
pub type PFN_vkCmdBeginRenderPass2KHR = PFN_vkCmdBeginRenderPass2;
pub type PFN_vkCmdNextSubpass2KHR = PFN_vkCmdNextSubpass2;
pub type PFN_vkCmdEndRenderPass2KHR = PFN_vkCmdEndRenderPass2;
}
#[cfg(feature = "ffi")]
pub(super) mod ffi {
#![allow(non_camel_case_types)]
use super::defs::*;
pub type VkAttachmentDescription2KHR = AttachmentDescription2KHR<'static>;
pub type VkAttachmentReference2KHR = AttachmentReference2KHR<'static>;
pub type VkSubpassDescription2KHR = SubpassDescription2KHR<'static>;
pub type VkSubpassDependency2KHR = SubpassDependency2KHR<'static>;
pub type VkRenderPassCreateInfo2KHR = RenderPassCreateInfo2KHR<'static>;
pub type VkSubpassBeginInfoKHR = SubpassBeginInfoKHR<'static>;
pub type VkSubpassEndInfoKHR = SubpassEndInfoKHR<'static>;
}
pub struct DeviceFn {
create_render_pass2: PFN_vkCreateRenderPass2,
cmd_begin_render_pass2: PFN_vkCmdBeginRenderPass2,
cmd_next_subpass2: PFN_vkCmdNextSubpass2,
cmd_end_render_pass2: PFN_vkCmdEndRenderPass2,
}
impl LoadDeviceFn for DeviceFn {
unsafe fn load_with(
load: impl Fn(&CStr) -> Option<PFN_vkVoidFunction>,
) -> core::result::Result<Self, MissingEntryPointError> {
unsafe {
Ok(Self {
create_render_pass2: transmute(
load(c"vkCreateRenderPass2KHR").ok_or(MissingEntryPointError)?,
),
cmd_begin_render_pass2: transmute(
load(c"vkCmdBeginRenderPass2KHR").ok_or(MissingEntryPointError)?,
),
cmd_next_subpass2: transmute(
load(c"vkCmdNextSubpass2KHR").ok_or(MissingEntryPointError)?,
),
cmd_end_render_pass2: transmute(
load(c"vkCmdEndRenderPass2KHR").ok_or(MissingEntryPointError)?,
),
})
}
}
}
impl DeviceFn {
#[inline]
pub unsafe fn create_render_pass2(
&self,
device: Device,
create_info: &RenderPassCreateInfo2<'_>,
allocator: Option<&AllocationCallbacks<'_>>,
) -> crate::Result<RenderPass> {
unsafe {
let mut render_pass = core::mem::MaybeUninit::uninit();
let result = (self.create_render_pass2)(
device,
create_info,
allocator.to_raw_ptr(),
render_pass.as_mut_ptr(),
);
match result {
VkResult::SUCCESS => Ok(render_pass.assume_init()),
err => Err(err),
}
}
}
#[inline]
pub unsafe fn cmd_begin_render_pass2(
&self,
command_buffer: CommandBuffer,
render_pass_begin: &RenderPassBeginInfo<'_>,
subpass_begin_info: &SubpassBeginInfo<'_>,
) {
unsafe {
(self.cmd_begin_render_pass2)(command_buffer, render_pass_begin, subpass_begin_info)
}
}
#[inline]
pub unsafe fn cmd_next_subpass2(
&self,
command_buffer: CommandBuffer,
subpass_begin_info: &SubpassBeginInfo<'_>,
subpass_end_info: &SubpassEndInfo<'_>,
) {
unsafe { (self.cmd_next_subpass2)(command_buffer, subpass_begin_info, subpass_end_info) }
}
#[inline]
pub unsafe fn cmd_end_render_pass2(
&self,
command_buffer: CommandBuffer,
subpass_end_info: &SubpassEndInfo<'_>,
) {
unsafe { (self.cmd_end_render_pass2)(command_buffer, subpass_end_info) }
}
}