From e0341c52cf6e0d2a90ce1ea41c5a88934aa5743e Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Sun, 29 Oct 2023 20:22:38 -0700 Subject: [PATCH] Document nonzero surface size requirement. (#4609) --- wgpu-types/src/lib.rs | 4 ++-- wgpu/src/lib.rs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 8c39f9839..ce3ca05e6 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -4893,9 +4893,9 @@ pub struct SurfaceConfiguration { /// The texture format of the swap chain. The only formats that are guaranteed are /// `Bgra8Unorm` and `Bgra8UnormSrgb` pub format: TextureFormat, - /// Width of the swap chain. Must be the same size as the surface. + /// Width of the swap chain. Must be the same size as the surface, and nonzero. pub width: u32, - /// Height of the swap chain. Must be the same size as the surface. + /// Height of the swap chain. Must be the same size as the surface, and nonzero. pub height: u32, /// Presentation mode of the swap chain. Fifo is the only mode guaranteed to be supported. /// FifoRelaxed, Immediate, and Mailbox will crash if unsupported, while AutoVsync and diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 2c4150d31..b1c9ce2b7 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -4939,6 +4939,7 @@ impl Surface { /// /// - A old [`SurfaceTexture`] is still alive referencing an old surface. /// - Texture format requested is unsupported on the surface. + /// - `config.width` or `config.height` is zero. pub fn configure(&self, device: &Device, config: &SurfaceConfiguration) { DynContext::surface_configure( &*self.context,