Added from_custom to texture (#8315)

This commit is contained in:
Robin Cramer 2025-10-09 11:22:54 -04:00 committed by GitHub
parent 3958790a85
commit d0bb62a157
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View File

@ -72,6 +72,11 @@ SamplerDescriptor {
...
}
```
### Changes
#### General
- Texture now has `from_custom`. By @R-Cramer4 in [#8315](https://github.com/gfx-rs/wgpu/pull/8315).
### Bug Fixes

View File

@ -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<T: custom::TextureInterface>(
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.
///