Device now has to implement DynResource

This commit is contained in:
Andreas Reich
2024-07-21 11:51:45 +02:00
parent df5cc12935
commit 3faed2bf52
6 changed files with 8 additions and 4 deletions

View File

@@ -94,6 +94,7 @@ crate::impl_dyn_resource!(
CommandBuffer,
CommandEncoder,
ComputePipeline,
Device,
Fence,
PipelineCache,
PipelineLayout,

View File

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

View File

@@ -171,6 +171,7 @@ crate::impl_dyn_resource!(
CommandBuffer,
CommandEncoder,
ComputePipeline,
Device,
Fence,
PipelineLayout,
QuerySet,

View File

@@ -394,7 +394,7 @@ pub trait Api: Clone + fmt::Debug + Sized {
type Instance: Instance<A = Self>;
type Surface: Surface<A = Self>;
type Adapter: Adapter<A = Self>;
type Device: Device<A = Self>;
type Device: DynDevice + Device<A = Self>;
type Queue: Queue<A = Self>;
type CommandEncoder: DynCommandEncoder + CommandEncoder<A = Self>;

View File

@@ -78,6 +78,7 @@ crate::impl_dyn_resource!(
CommandBuffer,
CommandEncoder,
ComputePipeline,
Device,
Fence,
PipelineLayout,
QuerySet,

View File

@@ -85,6 +85,7 @@ crate::impl_dyn_resource!(
CommandBuffer,
CommandEncoder,
ComputePipeline,
Device,
Fence,
PipelineCache,
PipelineLayout,