diff --git a/wgpu-hal/src/dx12/device.rs b/wgpu-hal/src/dx12/device.rs index 49be25e906..95eccb3b9b 100644 --- a/wgpu-hal/src/dx12/device.rs +++ b/wgpu-hal/src/dx12/device.rs @@ -280,6 +280,24 @@ impl super::Device { ); result } + + pub unsafe fn texture_from_raw( + resource: native::Resource, + format: wgt::TextureFormat, + dimension: wgt::TextureDimension, + size: wgt::Extent3d, + mip_level_count: u32, + sample_count: u32, + ) -> super::Texture { + super::Texture { + resource, + format, + dimension, + size, + mip_level_count, + sample_count, + } + } } impl crate::Device for super::Device { diff --git a/wgpu-hal/src/metal/device.rs b/wgpu-hal/src/metal/device.rs index 91aa0a5e0c..da3a73ed10 100644 --- a/wgpu-hal/src/metal/device.rs +++ b/wgpu-hal/src/metal/device.rs @@ -174,6 +174,24 @@ impl super::Device { .set_mutability(mtl::MTLMutability::Immutable); } } + + pub unsafe fn texture_from_raw( + raw: mtl::Texture, + raw_format: mtl::MTLPixelFormat, + raw_type: mtl::MTLTextureType, + array_layers: u32, + mip_levels: u32, + copy_size: crate::CopyExtent, + ) -> super::Texture { + super::Texture { + raw, + raw_format, + raw_type, + array_layers, + mip_levels, + copy_size, + } + } } impl crate::Device for super::Device {