aboutsummaryrefslogtreecommitdiff
path: root/layers/image.cpp
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2017-02-06 14:01:54 -0700
committerMark Lobodzinski <mark@lunarg.com>2017-02-07 14:02:48 -0700
commit2875ae8e5ed76043ddd68b0c62c9ee148abac428 (patch)
treebed5de1de9f6c5eed0e8408ac6b867babc575d2a /layers/image.cpp
parent917253c6001e311d44b87f9f5d036f8775c02936 (diff)
downloadusermoji-2875ae8e5ed76043ddd68b0c62c9ee148abac428.tar.xz
layers: Move image layer BlitImage val into CV
Moved the guts of this layer's CmdBlitImage API into the PreCall- Validation routine in the buffer module. Change-Id: I353c30c72faf577be22e36c786ed7851997a0011
Diffstat (limited to 'layers/image.cpp')
-rw-r--r--layers/image.cpp154
1 files changed, 0 insertions, 154 deletions
diff --git a/layers/image.cpp b/layers/image.cpp
index 655c3418..c2c81094 100644
--- a/layers/image.cpp
+++ b/layers/image.cpp
@@ -350,160 +350,6 @@ VKAPI_ATTR void VKAPI_CALL CmdBlitImage(VkCommandBuffer commandBuffer, VkImage s
bool skipCall = false;
layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- // Warn for zero-sized regions
- for (uint32_t i = 0; i < regionCount; i++) {
- if ((pRegions[i].srcOffsets[0].x == pRegions[i].srcOffsets[1].x) ||
- (pRegions[i].srcOffsets[0].y == pRegions[i].srcOffsets[1].y) ||
- (pRegions[i].srcOffsets[0].z == pRegions[i].srcOffsets[1].z)) {
- std::stringstream ss;
- ss << "vkCmdBlitImage: pRegions[" << i << "].srcOffsets specify a zero-volume area.";
- skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t>(commandBuffer), __LINE__,
- IMAGE_INVALID_EXTENTS, "IMAGE", "%s", ss.str().c_str());
- }
- if ((pRegions[i].dstOffsets[0].x == pRegions[i].dstOffsets[1].x) ||
- (pRegions[i].dstOffsets[0].y == pRegions[i].dstOffsets[1].y) ||
- (pRegions[i].dstOffsets[0].z == pRegions[i].dstOffsets[1].z)) {
- std::stringstream ss;
- ss << "vkCmdBlitImage: pRegions[" << i << "].dstOffsets specify a zero-volume area.";
- skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t>(commandBuffer), __LINE__,
- IMAGE_INVALID_EXTENTS, "IMAGE", "%s", ss.str().c_str());
- }
- }
-
- auto srcImageEntry = getImageState(device_data, srcImage);
- auto dstImageEntry = getImageState(device_data, dstImage);
-
- if (srcImageEntry && dstImageEntry) {
- VkFormat srcFormat = srcImageEntry->format;
- VkFormat dstFormat = dstImageEntry->format;
-
- // Validate consistency for unsigned formats
- if (vk_format_is_uint(srcFormat) != vk_format_is_uint(dstFormat)) {
- std::stringstream ss;
- ss << "vkCmdBlitImage: If one of srcImage and dstImage images has unsigned integer format, "
- << "the other one must also have unsigned integer format. "
- << "Source format is " << string_VkFormat(srcFormat) << " Destination format is " << string_VkFormat(dstFormat);
- skipCall |=
- log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_02191, "IMAGE", "%s. %s", ss.str().c_str(),
- validation_error_map[VALIDATION_ERROR_02191]);
- }
-
- // Validate consistency for signed formats
- if (vk_format_is_sint(srcFormat) != vk_format_is_sint(dstFormat)) {
- std::stringstream ss;
- ss << "vkCmdBlitImage: If one of srcImage and dstImage images has signed integer format, "
- << "the other one must also have signed integer format. "
- << "Source format is " << string_VkFormat(srcFormat) << " Destination format is " << string_VkFormat(dstFormat);
- skipCall |=
- log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_02190, "IMAGE", "%s. %s", ss.str().c_str(),
- validation_error_map[VALIDATION_ERROR_02190]);
- }
-
- // Validate aspect bits and formats for depth/stencil images
- if (vk_format_is_depth_or_stencil(srcFormat) || vk_format_is_depth_or_stencil(dstFormat)) {
- if (srcFormat != dstFormat) {
- std::stringstream ss;
- ss << "vkCmdBlitImage: If one of srcImage and dstImage images has a format of depth, stencil or depth "
- << "stencil, the other one must have exactly the same format. "
- << "Source format is " << string_VkFormat(srcFormat) << " Destination format is " << string_VkFormat(dstFormat);
- skipCall |=
- log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_02192, "IMAGE", "%s. %s", ss.str().c_str(),
- validation_error_map[VALIDATION_ERROR_02192]);
- }
-
- // TODO: Confirm that all these checks are intended to be nested under depth/stencil only
- for (uint32_t i = 0; i < regionCount; i++) {
- if (pRegions[i].srcSubresource.layerCount == 0) {
- char const str[] = "vkCmdBlitImage: number of layers in source subresource is zero";
- // TODO: Verify against Valid Use section of spec, if this case yields undefined results, then it's an error
- skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
- IMAGE_MISMATCHED_IMAGE_ASPECT, "IMAGE", str);
- }
-
- if (pRegions[i].dstSubresource.layerCount == 0) {
- char const str[] = "vkCmdBlitImage: number of layers in destination subresource is zero";
- // TODO: Verify against Valid Use section of spec, if this case yields undefined results, then it's an error
- skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
- IMAGE_MISMATCHED_IMAGE_ASPECT, "IMAGE", str);
- }
-
- if (pRegions[i].srcSubresource.layerCount != pRegions[i].dstSubresource.layerCount) {
- char const str[] = "vkCmdBlitImage: number of layers in source and destination subresources must match";
- skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
- IMAGE_MISMATCHED_IMAGE_ASPECT, "IMAGE", str);
- }
-
- VkImageAspectFlags srcAspect = pRegions[i].srcSubresource.aspectMask;
- VkImageAspectFlags dstAspect = pRegions[i].dstSubresource.aspectMask;
-
- if (srcAspect != dstAspect) {
- std::stringstream ss;
- ss << "vkCmdBlitImage: Image aspects of depth/stencil images should match";
- // TODO: Verify against Valid Use section of spec, if this case yields undefined results, then it's an error
- skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
- IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str());
- }
- if (vk_format_is_depth_and_stencil(srcFormat)) {
- if ((srcAspect != VK_IMAGE_ASPECT_DEPTH_BIT) && (srcAspect != VK_IMAGE_ASPECT_STENCIL_BIT)) {
- std::stringstream ss;
- ss << "vkCmdBlitImage: Combination depth/stencil image formats must have only one of "
- "VK_IMAGE_ASPECT_DEPTH_BIT "
- << "and VK_IMAGE_ASPECT_STENCIL_BIT set in srcImage and dstImage";
- skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
- IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str());
- }
- } else if (vk_format_is_stencil_only(srcFormat)) {
- if (srcAspect != VK_IMAGE_ASPECT_STENCIL_BIT) {
- std::stringstream ss;
- ss << "vkCmdBlitImage: Stencil-only image formats must have only the VK_IMAGE_ASPECT_STENCIL_BIT "
- << "set in both the srcImage and dstImage";
- skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
- IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str());
- }
- } else if (vk_format_is_depth_only(srcFormat)) {
- if (srcAspect != VK_IMAGE_ASPECT_DEPTH_BIT) {
- std::stringstream ss;
- ss << "vkCmdBlitImage: Depth-only image formats must have only the VK_IMAGE_ASPECT_DEPTH "
- << "set in both the srcImage and dstImage";
- skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
- IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str());
- }
- }
- }
- }
-
- // Validate filter
- if (vk_format_is_depth_or_stencil(srcFormat) && (filter != VK_FILTER_NEAREST)) {
- std::stringstream ss;
- ss << "vkCmdBlitImage: If the format of srcImage is a depth, stencil, or depth stencil "
- << "then filter must be VK_FILTER_NEAREST.";
- skipCall |=
- log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_02193, "IMAGE", "%s. %s", ss.str().c_str(),
- validation_error_map[VALIDATION_ERROR_02193]);
- }
- if (vk_format_is_int(srcFormat) && (filter != VK_FILTER_NEAREST)) {
- std::stringstream ss;
- ss << "vkCmdBlitImage: If the format of srcImage is an integer-based format "
- << "then filter must be VK_FILTER_NEAREST.";
- skipCall |=
- log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)commandBuffer, __LINE__, IMAGE_INVALID_FILTER, "IMAGE", "%s", ss.str().c_str());
- }
- }
-
if (!skipCall) {
device_data->device_dispatch_table->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout,
regionCount, pRegions, filter);