Skip to content
This repository was archived by the owner on Jun 18, 2021. It is now read-only.

Commit aeab013

Browse files
bors[bot]rukai
andauthored
Merge #212
212: Improve BufferCopyView documentation r=kvark a=rukai groves suggested that the alignment/multiple requirements are not implemented yet. So I changed the documentation to reflect that. Ideally we would change the examples to demonstrate how to work around this requirement, but I think its best to wait until we know for certain that this IS a requirement, currently the WebGPU spec does not have this as a requirement. Additionally it seems like every example except for the skybox example failed to follow this part of the WebGPU spec. "Note: rowsPerImage must be zero for copies with a copySize.depth of 1, and must be greater than zero otherwise." So I fixed those examples and documented the requirement on the field. Co-authored-by: Rukai <[email protected]>
2 parents 04db8c9 + 111f6c4 commit aeab013

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

examples/capture/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async fn run() {
7777
buffer: &output_buffer,
7878
offset: 0,
7979
bytes_per_row: size_of::<u32>() as u32 * size,
80-
rows_per_image: size,
80+
rows_per_image: 0,
8181
},
8282
texture_extent,
8383
);

examples/cube/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl framework::Example for Example {
180180
buffer: &temp_buf,
181181
offset: 0,
182182
bytes_per_row: 4 * size,
183-
rows_per_image: size,
183+
rows_per_image: 0,
184184
},
185185
wgpu::TextureCopyView {
186186
texture: &texture,

examples/mipmap/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ impl framework::Example for Example {
268268
buffer: &temp_buf,
269269
offset: 0,
270270
bytes_per_row: 4 * size,
271-
rows_per_image: size,
271+
rows_per_image: 0,
272272
},
273273
wgpu::TextureCopyView {
274274
texture: &texture,

src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,16 @@ pub struct BufferCopyView<'a> {
408408
/// The buffer to be copied to or from.
409409
pub buffer: &'a Buffer,
410410

411-
/// The offset in bytes from the start of the buffer. This must be aligned to 512 bytes.
411+
/// The offset in bytes from the start of the buffer.
412+
/// In the future this must be aligned to 512 bytes, however the requirement is currently unimplemented.
412413
pub offset: BufferAddress,
413414

414-
/// The size in bytes of a single row of the texture. This must be a multiple of 256 bytes.
415+
/// The size in bytes of a single row of the texture.
416+
/// In the future this must be a multiple of 256 bytes, however the requirement is currently unimplemented.
415417
pub bytes_per_row: u32,
416418

417419
/// The height in texels of the imaginary texture view overlaid on the buffer.
420+
/// Must be zero for copies where `copy_size.depth == 1`.
418421
pub rows_per_image: u32,
419422
}
420423

0 commit comments

Comments
 (0)