diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e47efd63..c61d56134 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -163,6 +163,7 @@ By @cwfitzgerald in [#8609](https://github.com/gfx-rs/wgpu/pull/8609). - Implement shader triangle barycentric coordinate builtins. By @atlv24 in [#8320](https://github.com/gfx-rs/wgpu/pull/8320). - Added support for binding arrays of storage textures on Metal. By @msvbg in [#8464](https://github.com/gfx-rs/wgpu/pull/8464) - Added support for multisampled texture arrays on Vulkan through adapter feature `MULTISAMPLE_ARRAY`. By @LaylBongers in [#8571](https://github.com/gfx-rs/wgpu/pull/8571). +- Added `get_configuration` to `wgpu::Surface`, that returns the current configuration of `wgpu::Surface`. By @sagudev in [#8664](https://github.com/gfx-rs/wgpu/pull/8664). ### Changes diff --git a/wgpu/src/api/surface.rs b/wgpu/src/api/surface.rs index a8e1c3790..f063f2ba5 100644 --- a/wgpu/src/api/surface.rs +++ b/wgpu/src/api/surface.rs @@ -99,6 +99,13 @@ impl Surface<'_> { *conf = Some(config.clone()); } + /// Returns the current configuration of [`Surface`], if configured. + /// + /// This is similar to [WebGPU `GPUcCanvasContext::getConfiguration`](https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-getconfiguration). + pub fn get_configuration(&self) -> Option { + self.config.lock().clone() + } + /// Returns the next texture to be presented by the swapchain for drawing. /// /// In order to present the [`SurfaceTexture`] returned by this method,