Review feedback / fix validate_linear_texture_data

This commit is contained in:
Andreas Reich 2021-03-21 09:01:31 +01:00
parent 50043875e5
commit 720c73fa9c
2 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -401,14 +401,14 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
)?;
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.