Add texture_from_raw method for metal/dx12 device

This commit is contained in:
xiaopengli89 authored and Dzmitry Malyshau committed 2021-10-28 09:14:15 -04:00
1 parent 8568188558
commit cd9498d447
2 files changed
+36

No files matched your search

+18
View File
@@ -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<super::Api> for super::Device {
+18
View File
@@ -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<super::Api> for super::Device {