Additional check_copy_buffer_image checks (#1703)

* additional check_copy_buffer_image checks

* rustfmt
This commit is contained in:
Austin Johnson 2021-09-13 09:23:35 -05:00 committed by GitHub
parent 7b306f4952
commit dc84f31120
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,7 @@ use crate::format::Format;
use crate::format::IncompatiblePixelsType; use crate::format::IncompatiblePixelsType;
use crate::format::Pixel; use crate::format::Pixel;
use crate::image::ImageAccess; use crate::image::ImageAccess;
use crate::image::ImageDimensions;
use crate::image::SampleCount; use crate::image::SampleCount;
use crate::DeviceSize; use crate::DeviceSize;
use crate::VulkanObject; use crate::VulkanObject;
@ -106,6 +107,32 @@ where
return Err(CheckCopyBufferImageError::ImageCoordinatesOutOfRange); return Err(CheckCopyBufferImageError::ImageCoordinatesOutOfRange);
} }
match image.dimensions() {
ImageDimensions::Dim1d { .. } => {
// VUID-vkCmdCopyBufferToImage-srcImage-00199
if image_offset[1] != 0 || image_size[1] != 1 {
return Err(CheckCopyBufferImageError::ImageCoordinatesOutOfRange);
}
// VUID-vkCmdCopyBufferToImage-srcImage-00201
if image_offset[2] != 0 || image_size[2] != 1 {
return Err(CheckCopyBufferImageError::ImageCoordinatesOutOfRange);
}
}
ImageDimensions::Dim2d { .. } => {
// VUID-vkCmdCopyBufferToImage-srcImage-00201
if image_offset[2] != 0 || image_size[2] != 1 {
return Err(CheckCopyBufferImageError::ImageCoordinatesOutOfRange);
}
}
ImageDimensions::Dim3d { .. } => {
// VUID-vkCmdCopyBufferToImage-baseArrayLayer-00213
if image_first_layer != 0 || image_num_layers != 1 {
return Err(CheckCopyBufferImageError::ImageCoordinatesOutOfRange);
}
}
}
Px::ensure_accepts(image.format())?; Px::ensure_accepts(image.format())?;
{ {