diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fa8bd6303..3916352b61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,7 +42,7 @@ Bottom level categories: #### 'wgpu::Instance::enumerate_adapters` is now `async` & available on WebGPU -Making `enumerate_adapters` async allows custom backends to use it along with elimnating some native/non-native distinctions +Making `enumerate_adapters` async allows custom backends to use it along with eliminating some native/non-native distinctions This is a breaking change @@ -54,6 +54,17 @@ This is a breaking change By @R-Cramer4 in [#8230](https://github.com/gfx-rs/wgpu/pull/8230) +### New Features + +#### Texture now has `from_custom` + + - Allows the creation of a wgpu texture from a custom texture and a `TextureDescriptor` + - The texture is unable to have a label or view formats + +```diff ++ pub fn from_custom(texture: T, desc: &TextureDescriptor<'_>) -> Self { +``` + ## v27.0.2 (2025-10-03) ### Bug Fixes diff --git a/wgpu/src/api/texture.rs b/wgpu/src/api/texture.rs index 98136ece4c..2f10343312 100644 --- a/wgpu/src/api/texture.rs +++ b/wgpu/src/api/texture.rs @@ -69,6 +69,22 @@ impl Texture { self.inner.as_custom() } + #[cfg(custom)] + /// Creates a texture from already created custom implementation with the given description + pub fn from_custom( + texture: T, + desc: &TextureDescriptor<'_>, + ) -> Self { + Self { + inner: dispatch::DispatchTexture::custom(texture), + descriptor: TextureDescriptor { + label: None, + view_formats: &[], + ..desc.clone() + }, + } + } + /// Creates a view of this texture, specifying an interpretation of its texels and /// possibly a subset of its layers and mip levels. ///