diff options
| author | Mark Lobodzinski <mark@lunarg.com> | 2016-11-22 14:46:39 -0700 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2016-11-23 07:56:43 -0700 |
| commit | c04ef0b2d87b0db0d4ec98c31db1f6b95ac71191 (patch) | |
| tree | d2a5c70cf521701cdd98faefc323245520546793 | |
| parent | 894ead5671267985b040cb4a7d753cd86b82e9bc (diff) | |
| download | usermoji-c04ef0b2d87b0db0d4ec98c31db1f6b95ac71191.tar.xz | |
layers: GH1182, Validate VkBufferImageCopy depth
Validate that for buffer<-->image copies that (for 1D and 2D image
types) the offset is 0 and the depth is 1.
Change-Id: I8114ce78be926411a2938148bf4c60d86006f8a4
| -rw-r--r-- | layers/image.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/layers/image.cpp b/layers/image.cpp index 93574ca7..a07e7b3b 100644 --- a/layers/image.cpp +++ b/layers/image.cpp @@ -851,6 +851,18 @@ static bool ValidateBufferImageCopyData(layer_data *dev_data, uint32_t regionCou auto image_info = getImageState(dev_data, image); if (image_info) { + + if ((image_info->imageType == VK_IMAGE_TYPE_1D) || (image_info->imageType == VK_IMAGE_TYPE_2D)) { + if ((pRegions[i].imageOffset.z != 0) || (pRegions[i].imageExtent.depth != 1)) { + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + reinterpret_cast<uint64_t &>(image), __LINE__, VALIDATION_ERROR_01269, "IMAGE", + "%s(): pRegion[%d] imageOffset.z is %d and imageExtent.depth is %d. These must be 0 and 1, " + "respectively. %s", + function, i, pRegions[i].imageOffset.z, pRegions[i].imageExtent.depth, + validation_error_map[VALIDATION_ERROR_01269]); + } + } + // BufferOffset must be a multiple of the calling command's VkImage parameter's texel size auto texel_size = vk_format_get_size(image_info->format); if (vk_safe_modulo(pRegions[i].bufferOffset, texel_size) != 0) { @@ -860,6 +872,7 @@ static bool ValidateBufferImageCopyData(layer_data *dev_data, uint32_t regionCou " must be a multiple of this format's texel size (" PRINTF_SIZE_T_SPECIFIER "). %s", function, i, pRegions[i].bufferOffset, texel_size, validation_error_map[VALIDATION_ERROR_01263]); } + // BufferOffset must be a multiple of 4 if (vk_safe_modulo(pRegions[i].bufferOffset, 4) != 0) { skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, |
