Skip to content

Commit 00a8f44

Browse files
committed
Bug 1829305: refactor(wgpu_bindings): move ImageDataLayout to crate root r=webgpu-reviewers,jimb
Differential Revision: https://phabricator.services.mozilla.com/D176206 UltraBlame original commit: 2a0fc0206bf071f59eaeedb78609318c241897bf
1 parent 1bc6bce commit 00a8f44

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

gfx/wgpu_bindings/src/client.rs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use crate::{
66
cow_label, wgpu_string, AdapterInformation, ByteBuf, CommandEncoderAction, DeviceAction,
7-
DropAction, ImplicitLayout, QueueWriteAction, RawString, TextureAction,
7+
DropAction, ImplicitLayout, QueueWriteAction, RawString, TextureAction, ImageDataLayout,
88
};
99

1010
use wgc::{hub::IdentityManager, id};
@@ -1108,25 +1108,6 @@ pub unsafe extern "C" fn wgpu_queue_write_buffer(
11081108
*bb = make_byte_buf(&action);
11091109
}
11101110

1111-
1112-
1113-
#[repr(C)]
1114-
pub struct ImageDataLayout<'a> {
1115-
pub offset: wgt::BufferAddress,
1116-
pub bytes_per_row: Option<&'a u32>,
1117-
pub rows_per_image: Option<&'a u32>,
1118-
}
1119-
1120-
impl<'a> ImageDataLayout<'a> {
1121-
fn into_wgt(&self) -> wgt::ImageDataLayout {
1122-
wgt::ImageDataLayout {
1123-
offset: self.offset,
1124-
bytes_per_row: self.bytes_per_row.map(|bpr| *bpr),
1125-
rows_per_image: self.rows_per_image.map(|rpi| *rpi),
1126-
}
1127-
}
1128-
}
1129-
11301111
#[no_mangle]
11311112
pub unsafe extern "C" fn wgpu_queue_write_texture(
11321113
dst: wgt::ImageCopyTexture<id::TextureId>,

gfx/wgpu_bindings/src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,20 @@ impl DropAction {
193193
ByteBuf::from_vec(data)
194194
}
195195
}
196+
197+
#[repr(C)]
198+
pub struct ImageDataLayout<'a> {
199+
pub offset: wgt::BufferAddress,
200+
pub bytes_per_row: Option<&'a u32>,
201+
pub rows_per_image: Option<&'a u32>,
202+
}
203+
204+
impl<'a> ImageDataLayout<'a> {
205+
fn into_wgt(&self) -> wgt::ImageDataLayout {
206+
wgt::ImageDataLayout {
207+
offset: self.offset,
208+
bytes_per_row: self.bytes_per_row.map(|bpr| *bpr),
209+
rows_per_image: self.rows_per_image.map(|rpi| *rpi),
210+
}
211+
}
212+
}

0 commit comments

Comments
 (0)