impl DynSurfaceTexture for all surface textures

This commit is contained in:
Andreas Reich 2024-07-21 12:04:44 +02:00
parent 1d19a205a5
commit 70f7641193
7 changed files with 12 additions and 2 deletions

View File

@ -456,6 +456,7 @@ pub struct Texture {
}
impl crate::DynTexture for Texture {}
impl crate::DynSurfaceTexture for Texture {}
unsafe impl Send for Texture {}
unsafe impl Sync for Texture {}

View File

@ -101,6 +101,7 @@ pub trait DynQuerySet: DynResource + std::fmt::Debug {}
pub trait DynRenderPipeline: DynResource + std::fmt::Debug {}
pub trait DynSampler: DynResource + std::fmt::Debug {}
pub trait DynShaderModule: DynResource + std::fmt::Debug {}
pub trait DynSurfaceTexture: DynResource + std::fmt::Debug {}
pub trait DynTexture: DynResource + std::fmt::Debug {}
pub trait DynTextureView: DynResource + std::fmt::Debug {}

View File

@ -51,6 +51,7 @@ impl crate::DynPipelineLayout for Resource {}
impl crate::DynQuerySet for Resource {}
impl crate::DynRenderPipeline for Resource {}
impl crate::DynShaderModule for Resource {}
impl crate::DynSurfaceTexture for Resource {}
impl crate::DynTexture for Resource {}
impl crate::DynTextureView for Resource {}

View File

@ -375,6 +375,7 @@ pub struct Texture {
}
impl crate::DynTexture for Texture {}
impl crate::DynSurfaceTexture for Texture {}
impl Texture {
pub fn default_framebuffer(format: wgt::TextureFormat) -> Self {

View File

@ -269,7 +269,7 @@ pub use dynamic::{
DynAccelerationStructure, DynBindGroup, DynBindGroupLayout, DynBuffer, DynCommandBuffer,
DynCommandEncoder, DynComputePipeline, DynDevice, DynFence, DynPipelineCache,
DynPipelineLayout, DynQuerySet, DynRenderPipeline, DynResource, DynSampler, DynShaderModule,
DynTexture, DynTextureView,
DynSurfaceTexture, DynTexture, DynTextureView,
};
use std::{
@ -411,7 +411,7 @@ pub trait Api: Clone + fmt::Debug + Sized {
type Buffer: DynBuffer;
type Texture: DynTexture;
type SurfaceTexture: fmt::Debug + WasmNotSendSync + Borrow<Self::Texture>;
type SurfaceTexture: DynSurfaceTexture + fmt::Debug + Borrow<Self::Texture>;
type TextureView: DynTextureView;
type Sampler: fmt::Debug + WasmNotSendSync;
type QuerySet: DynQuerySet;

View File

@ -86,6 +86,7 @@ crate::impl_dyn_resource!(
Sampler,
ShaderModule,
Surface,
SurfaceTexture,
Texture,
TextureView
);
@ -381,6 +382,8 @@ pub struct SurfaceTexture {
present_with_transaction: bool,
}
impl crate::DynSurfaceTexture for SurfaceTexture {}
impl std::borrow::Borrow<Texture> for SurfaceTexture {
fn borrow(&self) -> &Texture {
&self.texture

View File

@ -94,6 +94,7 @@ crate::impl_dyn_resource!(
Sampler,
ShaderModule,
Surface,
SurfaceTexture,
Texture,
TextureView
);
@ -377,6 +378,8 @@ pub struct SurfaceTexture {
surface_semaphores: Arc<Mutex<SwapchainImageSemaphores>>,
}
impl crate::DynSurfaceTexture for SurfaceTexture {}
impl Borrow<Texture> for SurfaceTexture {
fn borrow(&self) -> &Texture {
&self.texture