This commit is contained in:
2026-03-26 11:57:50 -07:00
parent 989bc37dc4
commit 6a4c222c90

View File

@@ -138,6 +138,7 @@ fn training() {
usage: Some(wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::TEXTURE_BINDING),
..Default::default()
});
// bytes_per_row needs to be a multiple of 256.
let stride = (size.x * size_of::<f32>() as u32).next_multiple_of(256);
let mut texture_data = Vec::<u8>::with_capacity((stride * size.y) as usize);
let output_staging_buffer = device.create_buffer(&wgpu::BufferDescriptor {
@@ -258,8 +259,7 @@ fn training() {
buffer: &output_staging_buffer,
layout: wgpu::TexelCopyBufferLayout {
offset: 0,
// This needs to be a multiple of 256. Normally we would need to pad
// it but we here know it will work out anyways.
// This needs to be a multiple of 256.
bytes_per_row: Some(stride as u32),
rows_per_image: Some(size.y),
},