#![allow(unused_qualifications)]
#![allow(mismatched_lifetime_syntaxes)]
use crate::sys;
use crate::sys::ffi::*;
use crate::vk::*;
use crate::vk;
use crate::{Abi, Vk, Sys};
#[derive(Debug, Clone, Copy)]
pub struct Instance(pub sys::khr::object_refresh::InstanceCommands);
impl Instance {
pub fn load(get: impl FnMut(&::core::ffi::CStr) -> Option<crate::ProcAddr>) -> Self {
Self(unsafe { sys::khr::object_refresh::InstanceCommands::load(get) })
}
}
impl Instance {
pub unsafe fn get_physical_device_refreshable_object_types(
&self,
physical_device: vk::PhysicalDevice,
refreshable_object_types: Option<&mut ::alloc::vec::Vec<ObjectType>>,
) -> crate::Result<(uint32_t, Result)> {
unsafe {
let mut _c: uint32_t = Default::default();
let mut _r = self.0.GetPhysicalDeviceRefreshableObjectTypesKHR(
physical_device.abi(),
&mut _c,
Default::default(),
).vk();
if let Some(_b) = refreshable_object_types {
_r.result(|| Some(()))?;
_b.reserve(_c as usize);
_r = self.0.GetPhysicalDeviceRefreshableObjectTypesKHR(
physical_device.abi(),
&mut _c,
(&mut **_b).abi(),
).vk();
_r.result(|| Some(()))?;
_b.set_len(_b.len() + _c as usize);
}
_r.result_multi(|| Some(_c))
}
}
}
impl crate::CommandScope<vk::Instance> for vk::extensions::khr::object_refresh {
type Commands = Instance;
}
pub trait KhrObjectRefreshInstance {
fn raw(&self) -> vk::Instance;
fn commands(&self) -> &Instance;
}
impl crate::HndScope<vk::Instance> for vk::extensions::khr::object_refresh {
type Impl = _hs_Instance::Instance;
}
mod _hs_Instance {
use super::*;
#[derive(Debug)]
pub struct Instance(pub(crate) ::alloc::sync::Arc<super::Instance>, pub(crate) crate::hnd::Instance<vk::core>);
impl Clone for Instance {
fn clone(&self) -> Self { Self(self.0.clone(), self.1.clone()) }
}
impl crate::hnd::Instance<vk::extensions::khr::object_refresh> {
pub unsafe fn new(base: &crate::hnd::Instance<vk::core>) -> Self {
unsafe {
Self(Instance(
::alloc::sync::Arc::new(super::Instance::load(|name| unsafe { base.get_proc_addr(name) })),
base.clone(),
))
}
}
}
impl crate::Extension<crate::hnd::Instance<vk::core>> for vk::extensions::khr::object_refresh {
type Output = crate::hnd::Instance<vk::extensions::khr::object_refresh>;
unsafe fn make(target: &crate::hnd::Instance<vk::core>) -> Self::Output {
unsafe { crate::hnd::Instance::<vk::extensions::khr::object_refresh>::new(target) }
}
}
impl crate::hnd::Instance<vk::extensions::khr::object_refresh> {
pub fn raw(&self) -> vk::Instance { self.0.1.raw() }
pub fn commands(&self) -> &::alloc::sync::Arc<super::Instance> { &self.0.0 }
pub fn core(&self) -> &crate::hnd::Instance<vk::core> { &self.0.1 }
}
impl ::core::fmt::Debug for crate::hnd::Instance<vk::extensions::khr::object_refresh> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.write_fmt(format_args!("Instance({:p})", self.raw()))
}
}
impl ::core::fmt::Pointer for crate::hnd::Instance<vk::extensions::khr::object_refresh> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
self.raw().fmt(f)
}
}
impl ::core::ops::Deref for crate::hnd::Instance<vk::extensions::khr::object_refresh> {
type Target = super::Instance;
fn deref(&self) -> &Self::Target { self.commands() }
}
impl super::KhrObjectRefreshInstance for crate::hnd::Instance<vk::extensions::khr::object_refresh> {
fn raw(&self) -> vk::Instance { self.raw() }
fn commands(&self) -> &super::Instance { self.commands() }
}
impl crate::HndCtx<vk::extensions::khr::object_refresh, vk::Instance> for crate::hnd::Instance<vk::extensions::khr::object_refresh> {
type Ctx = Self;
fn ctx(&self) -> Self::Ctx { self.clone() }
fn raw(&self) -> vk::Instance { self.raw() }
fn commands(&self) -> &::alloc::sync::Arc<super::Instance> { self.commands() }
}
}
pub trait KhrObjectRefreshPhysicalDevice {
fn raw(&self) -> vk::PhysicalDevice;
fn commands(&self) -> &Instance;
unsafe fn get_refreshable_object_types(
&self,
refreshable_object_types: Option<&mut ::alloc::vec::Vec<ObjectType>>,
) -> crate::Result<(uint32_t, Result)> {
unsafe {
self.commands().get_physical_device_refreshable_object_types(
self.raw(),
refreshable_object_types,
)
}
}
}
#[derive(Debug, Clone, Copy)]
pub struct Device(pub sys::khr::object_refresh::DeviceCommands);
impl Device {
pub fn load(get: impl FnMut(&::core::ffi::CStr) -> Option<crate::ProcAddr>) -> Self {
Self(unsafe { sys::khr::object_refresh::DeviceCommands::load(get) })
}
}
impl Device {
pub unsafe fn cmd_refresh_objects(
&self,
command_buffer: vk::CommandBuffer,
refresh_objects: &RefreshObjectListKHR,
) -> () {
unsafe {
self.0.CmdRefreshObjectsKHR(
command_buffer.abi(),
refresh_objects.abi(),
);
}
}
}
impl crate::CommandScope<vk::Device> for vk::extensions::khr::object_refresh {
type Commands = Device;
}
pub trait KhrObjectRefreshDevice {
fn raw(&self) -> vk::Device;
fn commands(&self) -> &Device;
}
impl crate::HndScope<vk::Device> for vk::extensions::khr::object_refresh {
type Impl = _hs_Device::Device;
}
mod _hs_Device {
use super::*;
#[derive(Debug)]
pub struct Device(pub(crate) ::alloc::sync::Arc<super::Device>, pub(crate) crate::hnd::Device<vk::core>);
impl Clone for Device {
fn clone(&self) -> Self { Self(self.0.clone(), self.1.clone()) }
}
impl crate::hnd::Device<vk::extensions::khr::object_refresh> {
pub unsafe fn new(base: &crate::hnd::Device<vk::core>) -> Self {
unsafe {
Self(Device(
::alloc::sync::Arc::new(super::Device::load(|name| unsafe { base.get_proc_addr(name) })),
base.clone(),
))
}
}
}
impl crate::Extension<crate::hnd::Device<vk::core>> for vk::extensions::khr::object_refresh {
type Output = crate::hnd::Device<vk::extensions::khr::object_refresh>;
unsafe fn make(target: &crate::hnd::Device<vk::core>) -> Self::Output {
unsafe { crate::hnd::Device::<vk::extensions::khr::object_refresh>::new(target) }
}
}
impl crate::hnd::Device<vk::extensions::khr::object_refresh> {
pub fn raw(&self) -> vk::Device { self.0.1.raw() }
pub fn commands(&self) -> &::alloc::sync::Arc<super::Device> { &self.0.0 }
pub fn core(&self) -> &crate::hnd::Device<vk::core> { &self.0.1 }
}
impl ::core::fmt::Debug for crate::hnd::Device<vk::extensions::khr::object_refresh> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.write_fmt(format_args!("Device({:p})", self.raw()))
}
}
impl ::core::fmt::Pointer for crate::hnd::Device<vk::extensions::khr::object_refresh> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
self.raw().fmt(f)
}
}
impl ::core::ops::Deref for crate::hnd::Device<vk::extensions::khr::object_refresh> {
type Target = super::Device;
fn deref(&self) -> &Self::Target { self.commands() }
}
impl super::KhrObjectRefreshDevice for crate::hnd::Device<vk::extensions::khr::object_refresh> {
fn raw(&self) -> vk::Device { self.raw() }
fn commands(&self) -> &super::Device { self.commands() }
}
impl crate::HndCtx<vk::extensions::khr::object_refresh, vk::Device> for crate::hnd::Device<vk::extensions::khr::object_refresh> {
type Ctx = Self;
fn ctx(&self) -> Self::Ctx { self.clone() }
fn raw(&self) -> vk::Device { self.raw() }
fn commands(&self) -> &::alloc::sync::Arc<super::Device> { self.commands() }
}
}
pub trait KhrObjectRefreshCommandBuffer {
fn raw(&self) -> vk::CommandBuffer;
fn commands(&self) -> &Device;
unsafe fn refresh_objects(
&self,
refresh_objects: &RefreshObjectListKHR,
) -> () {
unsafe {
self.commands().cmd_refresh_objects(
self.raw(),
refresh_objects,
)
}
}
}