Skip to content

Commit d0bb62a

Browse files
authored
Added from_custom to texture (gfx-rs#8315)
1 parent 3958790 commit d0bb62a

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ SamplerDescriptor {
7272
...
7373
}
7474
```
75+
### Changes
76+
77+
#### General
78+
79+
- Texture now has `from_custom`. By @R-Cramer4 in [#8315](https://github.com/gfx-rs/wgpu/pull/8315).
7580

7681
### Bug Fixes
7782

wgpu/src/api/texture.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,22 @@ impl Texture {
6969
self.inner.as_custom()
7070
}
7171

72+
#[cfg(custom)]
73+
/// Creates a texture from already created custom implementation with the given description
74+
pub fn from_custom<T: custom::TextureInterface>(
75+
texture: T,
76+
desc: &TextureDescriptor<'_>,
77+
) -> Self {
78+
Self {
79+
inner: dispatch::DispatchTexture::custom(texture),
80+
descriptor: TextureDescriptor {
81+
label: None,
82+
view_formats: &[],
83+
..desc.clone()
84+
},
85+
}
86+
}
87+
7288
/// Creates a view of this texture, specifying an interpretation of its texels and
7389
/// possibly a subset of its layers and mip levels.
7490
///

0 commit comments

Comments
 (0)