diff options
| author | Mark Lobodzinski <mark@lunarg.com> | 2017-01-27 15:16:01 -0700 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2017-01-31 09:55:10 -0700 |
| commit | 4cfb4e2ad89d0a1c0d6e69de3b5460e35c1196b1 (patch) | |
| tree | 33d7b7ea201db3947e8c6e3cbc93efcac6683ff9 /layers/buffer_validation.cpp | |
| parent | 33dc2b9e2c0b56dd81868eb66a29e959c15caf5b (diff) | |
| download | usermoji-4cfb4e2ad89d0a1c0d6e69de3b5460e35c1196b1.tar.xz | |
layers: Migrate image layer CmdClearColorImage
The image layer checks for this API were moved to the
buffer_validation module and a call was added to CV.
Change-Id: I04b23843519d2354c952afebc3a3428b196339e3
Diffstat (limited to 'layers/buffer_validation.cpp')
| -rw-r--r-- | layers/buffer_validation.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index 8fca611d..2dfbf40b 100644 --- a/layers/buffer_validation.cpp +++ b/layers/buffer_validation.cpp @@ -232,3 +232,34 @@ void PostCallRecordDestroyImage(core_validation::layer_data *device_data, VkImag imageSubresourceMap->erase(sub_entry); } } + +bool ValidateImageAttributes(core_validation::layer_data *device_data, IMAGE_STATE *image_state, VkImageSubresourceRange range) { + bool skip = false; + const debug_report_data *report_data = core_validation::GetReportData(device_data); + + if (range.aspectMask != VK_IMAGE_ASPECT_COLOR_BIT) { + char const str[] = "vkCmdClearColorImage aspectMasks for all subresource ranges must be set to VK_IMAGE_ASPECT_COLOR_BIT"; + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + reinterpret_cast<uint64_t &>(image_state->image), __LINE__, DRAWSTATE_INVALID_IMAGE_ASPECT, "IMAGE", str); + } + + if (vk_format_is_depth_or_stencil(image_state->createInfo.format)) { + char const str[] = "vkCmdClearColorImage called with depth/stencil image."; + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + reinterpret_cast<uint64_t &>(image_state->image), __LINE__, VALIDATION_ERROR_01088, "IMAGE", "%s. %s", str, + validation_error_map[VALIDATION_ERROR_01088]); + } else if (vk_format_is_compressed(image_state->createInfo.format)) { + char const str[] = "vkCmdClearColorImage called with compressed image."; + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + reinterpret_cast<uint64_t &>(image_state->image), __LINE__, VALIDATION_ERROR_01088, "IMAGE", "%s. %s", str, + validation_error_map[VALIDATION_ERROR_01088]); + } + + if (!(image_state->createInfo.usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT)) { + char const str[] = "vkCmdClearColorImage called with image created without VK_IMAGE_USAGE_TRANSFER_DST_BIT."; + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + reinterpret_cast<uint64_t &>(image_state->image), __LINE__, VALIDATION_ERROR_01084, "IMAGE", "%s. %s", str, + validation_error_map[VALIDATION_ERROR_01084]); + } + return skip; +} |
