From 3a5e2c4b186cfce1344c768c8f1f7826470ee2c8 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Thu, 22 May 2025 12:51:51 -0400 Subject: [PATCH] refactor(hal): impl. `From` conversions b/w `wgh::CopyExtent` and `wgt::Extent3d` --- wgpu-hal/src/lib.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/wgpu-hal/src/lib.rs b/wgpu-hal/src/lib.rs index a1a7eb147..aa6f119f6 100644 --- a/wgpu-hal/src/lib.rs +++ b/wgpu-hal/src/lib.rs @@ -2438,6 +2438,36 @@ pub struct CopyExtent { pub depth: u32, } +impl From for CopyExtent { + fn from(value: wgt::Extent3d) -> Self { + let wgt::Extent3d { + width, + height, + depth_or_array_layers, + } = value; + Self { + width, + height, + depth: depth_or_array_layers, + } + } +} + +impl From for wgt::Extent3d { + fn from(value: CopyExtent) -> Self { + let CopyExtent { + width, + height, + depth, + } = value; + Self { + width, + height, + depth_or_array_layers: depth, + } + } +} + #[derive(Clone, Debug)] pub struct TextureCopy { pub src_base: TextureCopyBase,