Introduce DynDevice

This commit is contained in:
Andreas Reich 2024-07-20 20:57:42 +02:00
parent b7e11c76df
commit add54f19d8
3 changed files with 17 additions and 2 deletions

View File

@ -0,0 +1,13 @@
use crate::{Device, DynBuffer};
use super::DynResourceExt;
pub trait DynDevice {
unsafe fn destroy_buffer(&self, buffer: Box<dyn DynBuffer>);
}
impl<D: Device> DynDevice for D {
unsafe fn destroy_buffer(&self, buffer: Box<dyn DynBuffer>) {
unsafe { D::destroy_buffer(self, buffer.unbox()) };
}
}

View File

@ -1,6 +1,8 @@
mod command;
mod device;
pub use self::command::DynCommandEncoder;
pub use self::device::DynDevice;
use std::any::Any;

View File

@ -266,8 +266,8 @@ mod dynamic;
pub(crate) use dynamic::impl_dyn_resource;
pub use dynamic::{
DynBindGroup, DynBuffer, DynCommandEncoder, DynComputePipeline, DynPipelineLayout, DynQuerySet,
DynRenderPipeline, DynResource, DynTexture, DynTextureView,
DynBindGroup, DynBuffer, DynCommandEncoder, DynComputePipeline, DynDevice, DynPipelineLayout,
DynQuerySet, DynRenderPipeline, DynResource, DynTexture, DynTextureView,
};
use std::{