Skip to content

Commit f168ba5

Browse files
refactor(hal): impl. From conversions b/w wgh::CopyExtent and wgt::Extent3d
1 parent 6e5b6fb commit f168ba5

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

wgpu-hal/src/lib.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,6 +2430,36 @@ pub struct CopyExtent {
24302430
pub depth: u32,
24312431
}
24322432

2433+
impl From<wgt::Extent3d> for CopyExtent {
2434+
fn from(value: wgt::Extent3d) -> Self {
2435+
let wgt::Extent3d {
2436+
width,
2437+
height,
2438+
depth_or_array_layers,
2439+
} = value;
2440+
Self {
2441+
width,
2442+
height,
2443+
depth: depth_or_array_layers,
2444+
}
2445+
}
2446+
}
2447+
2448+
impl From<CopyExtent> for wgt::Extent3d {
2449+
fn from(value: CopyExtent) -> Self {
2450+
let CopyExtent {
2451+
width,
2452+
height,
2453+
depth,
2454+
} = value;
2455+
Self {
2456+
width,
2457+
height,
2458+
depth_or_array_layers: depth,
2459+
}
2460+
}
2461+
}
2462+
24332463
#[derive(Clone, Debug)]
24342464
pub struct TextureCopy {
24352465
pub src_base: TextureCopyBase,

0 commit comments

Comments
 (0)