diff --git a/wgpu-core/src/command/transfer.rs b/wgpu-core/src/command/transfer.rs index e589fce35f..87eefd8082 100644 --- a/wgpu-core/src/command/transfer.rs +++ b/wgpu-core/src/command/transfer.rs @@ -181,7 +181,7 @@ pub(crate) fn validate_linear_texture_data( let bytes_per_row = if let Some(bytes_per_row) = layout.bytes_per_row { bytes_per_row.get() as BufferAddress } else { - if copy_depth > 1 || block_height > 1 { + if copy_depth > 1 || height_in_blocks > 1 { return Err(TransferError::UnspecifiedBytesPerRow); } bytes_per_block * width_in_blocks diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index 1ed4338986..e26c9a4eba 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -401,14 +401,14 @@ impl Global { )?; dst.life_guard.use_at(device.active_submission_index + 1); + let bytes_per_row = if let Some(bytes_per_row) = data_layout.bytes_per_row { + bytes_per_row.get() + } else { + width_blocks * bytes_per_block + }; + let ptr = stage.memory.map(&device.raw, 0, stage_size)?; unsafe { - let bytes_per_row = if let Some(bytes_per_row) = data_layout.bytes_per_row { - bytes_per_row.get() - } else { - width_blocks * bytes_per_block - }; - //TODO: https://github.com/zakarumych/gpu-alloc/issues/13 if stage_bytes_per_row == bytes_per_row { // Fast path if the data isalready being aligned optimally.