diff --git a/ash/src/extensions/khr/create_render_pass2.rs b/ash/src/extensions/khr/create_render_pass2.rs new file mode 100644 index 0000000..838a57f --- /dev/null +++ b/ash/src/extensions/khr/create_render_pass2.rs @@ -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(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 = ""] + pub unsafe fn create_render_pass2( + &self, + create_info: &vk::RenderPassCreateInfo2, + allocation_callbacks: Option<&vk::AllocationCallbacks>, + ) -> VkResult { + 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 = ""] + 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 = ""] + 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 = ""] + 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 + } +} diff --git a/ash/src/extensions/khr/mod.rs b/ash/src/extensions/khr/mod.rs index 610eef5..382e041 100644 --- a/ash/src/extensions/khr/mod.rs +++ b/ash/src/extensions/khr/mod.rs @@ -1,6 +1,7 @@ pub use self::acceleration_structure::AccelerationStructure; pub use self::android_surface::AndroidSurface; pub use self::buffer_device_address::BufferDeviceAddress; +pub use self::create_render_pass2::CreateRenderPass2; pub use self::deferred_host_operations::DeferredHostOperations; pub use self::display::Display; pub use self::display_swapchain::DisplaySwapchain; @@ -24,6 +25,7 @@ pub use self::xlib_surface::XlibSurface; mod acceleration_structure; mod android_surface; mod buffer_device_address; +mod create_render_pass2; mod deferred_host_operations; mod display; mod display_swapchain;