From ecd55b523ef3c500a4435e91d5210437ddee54e8 Mon Sep 17 00:00:00 2001 From: Robin Cramer Date: Tue, 7 Oct 2025 10:51:38 -0400 Subject: [PATCH 1/2] Added from_custom to texture --- CHANGELOG.md | 11 +++++++++++ wgpu/src/api/texture.rs | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fa8bd6303c..7e20fe7ad94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 98136ece4cc..2f10343312e 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. /// From ee3eaffacf895ec9eab5b7771b00ce6aa5f66e95 Mon Sep 17 00:00:00 2001 From: Robin Cramer Date: Tue, 7 Oct 2025 10:57:46 -0400 Subject: [PATCH 2/2] CI fixes --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e20fe7ad94..3916352b613 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