From 2875ae8e5ed76043ddd68b0c62c9ee148abac428 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Mon, 6 Feb 2017 14:01:54 -0700 Subject: [PATCH] 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 --- layers/buffer_validation.cpp | 159 +++++++++++++++++++++++++++++++++-- layers/buffer_validation.h | 2 +- layers/core_validation.cpp | 2 +- layers/core_validation_error_enums.h | 3 + layers/image.cpp | 154 --------------------------------- 5 files changed, 159 insertions(+), 161 deletions(-) diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index 066bcd8..6e418a1 100644 --- a/layers/buffer_validation.cpp +++ b/layers/buffer_validation.cpp @@ -1269,21 +1269,170 @@ void PreCallRecordCmdResolveImage(core_validation::layer_data *device_data, GLOB } bool PreCallValidateCmdBlitImage(core_validation::layer_data *device_data, GLOBAL_CB_NODE *cb_node, IMAGE_STATE *src_image_state, - IMAGE_STATE *dst_image_state) { + IMAGE_STATE *dst_image_state, uint32_t regionCount, const VkImageBlit *pRegions, VkFilter filter) { + const debug_report_data *report_data = core_validation::GetReportData(device_data); + bool skip = false; if (cb_node && src_image_state && dst_image_state) { skip |= ValidateImageSampleCount(device_data, src_image_state, VK_SAMPLE_COUNT_1_BIT, "vkCmdBlitImage(): srcImage", - VALIDATION_ERROR_02194); + VALIDATION_ERROR_02194); skip |= ValidateImageSampleCount(device_data, dst_image_state, VK_SAMPLE_COUNT_1_BIT, "vkCmdBlitImage(): dstImage", - VALIDATION_ERROR_02195); + VALIDATION_ERROR_02195); skip |= ValidateMemoryIsBoundToImage(device_data, src_image_state, "vkCmdBlitImage()", VALIDATION_ERROR_02539); skip |= ValidateMemoryIsBoundToImage(device_data, dst_image_state, "vkCmdBlitImage()", VALIDATION_ERROR_02540); skip |= ValidateImageUsageFlags(device_data, src_image_state, VK_IMAGE_USAGE_TRANSFER_SRC_BIT, true, VALIDATION_ERROR_02182, - "vkCmdBlitImage()", "VK_IMAGE_USAGE_TRANSFER_SRC_BIT"); + "vkCmdBlitImage()", "VK_IMAGE_USAGE_TRANSFER_SRC_BIT"); skip |= ValidateImageUsageFlags(device_data, dst_image_state, VK_IMAGE_USAGE_TRANSFER_DST_BIT, true, VALIDATION_ERROR_02186, - "vkCmdBlitImage()", "VK_IMAGE_USAGE_TRANSFER_DST_BIT"); + "vkCmdBlitImage()", "VK_IMAGE_USAGE_TRANSFER_DST_BIT"); skip |= ValidateCmd(device_data, cb_node, CMD_BLITIMAGE, "vkCmdBlitImage()"); skip |= insideRenderPass(device_data, cb_node, "vkCmdBlitImage()", VALIDATION_ERROR_01300); + + // 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."; + skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, DRAWSTATE_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."; + skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, DRAWSTATE_INVALID_EXTENTS, "IMAGE", + "%s", ss.str().c_str()); + } + } + + VkFormat src_format = src_image_state->createInfo.format; + VkFormat dst_format = dst_image_state->createInfo.format; + + // Validate consistency for unsigned formats + if (vk_format_is_uint(src_format) != vk_format_is_uint(dst_format)) { + 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(src_format) << " Destination format is " << string_VkFormat(dst_format); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->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(src_format) != vk_format_is_sint(dst_format)) { + 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(src_format) << " Destination format is " << string_VkFormat(dst_format); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->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(src_format) || vk_format_is_depth_or_stencil(dst_format)) { + if (src_format != dst_format) { + 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(src_format) << " Destination format is " + << string_VkFormat(dst_format); + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->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 + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, DRAWSTATE_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 + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, DRAWSTATE_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"; + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, DRAWSTATE_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 + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, DRAWSTATE_INVALID_IMAGE_ASPECT, + "IMAGE", "%s", ss.str().c_str()); + } + if (vk_format_is_depth_and_stencil(src_format)) { + 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"; + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, + DRAWSTATE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str()); + } + } else if (vk_format_is_stencil_only(src_format)) { + 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"; + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, + DRAWSTATE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str()); + } + } else if (vk_format_is_depth_only(src_format)) { + 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"; + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, + DRAWSTATE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str()); + } + } + } + } + + // Validate filter + if (vk_format_is_depth_or_stencil(src_format) && (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."; + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, VALIDATION_ERROR_02193, "IMAGE", "%s. %s", + ss.str().c_str(), validation_error_map[VALIDATION_ERROR_02193]); + } + if (vk_format_is_int(src_format) && (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."; + skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(cb_node->commandBuffer), __LINE__, DRAWSTATE_INVALID_IMAGE_FILTER, "IMAGE", + "%s", ss.str().c_str()); + } + } else { assert(0); } diff --git a/layers/buffer_validation.h b/layers/buffer_validation.h index 8622f09..bd196e3 100644 --- a/layers/buffer_validation.h +++ b/layers/buffer_validation.h @@ -135,7 +135,7 @@ void PreCallRecordCmdResolveImage(core_validation::layer_data *device_data, GLOB IMAGE_STATE *dst_image_state); bool PreCallValidateCmdBlitImage(core_validation::layer_data *device_data, GLOBAL_CB_NODE *cb_node, IMAGE_STATE *src_image_state, - IMAGE_STATE *dst_image_state); + IMAGE_STATE *dst_image_state, uint32_t regionCount, const VkImageBlit *pRegions, VkFilter filter); void PreCallRecordCmdBlitImage(core_validation::layer_data *device_data, GLOBAL_CB_NODE *cb_node, IMAGE_STATE *src_image_state, IMAGE_STATE *dst_image_state); diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 560b0e9..651f2cc 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -8196,7 +8196,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBlitImage(VkCommandBuffer commandBuffer, VkImage s auto src_image_state = getImageState(dev_data, srcImage); auto dst_image_state = getImageState(dev_data, dstImage); - bool skip = PreCallValidateCmdBlitImage(dev_data, cb_node, src_image_state, dst_image_state); + bool skip = PreCallValidateCmdBlitImage(dev_data, cb_node, src_image_state, dst_image_state, regionCount, pRegions, filter); if (!skip) { PreCallRecordCmdBlitImage(dev_data, cb_node, src_image_state, dst_image_state); diff --git a/layers/core_validation_error_enums.h b/layers/core_validation_error_enums.h index 1de410d..4b5a542 100644 --- a/layers/core_validation_error_enums.h +++ b/layers/core_validation_error_enums.h @@ -70,6 +70,7 @@ enum DRAW_STATE_ERROR { DRAWSTATE_INVALID_SAMPLER, DRAWSTATE_INVALID_FRAMEBUFFER, DRAWSTATE_INVALID_DEVICE_MEMORY, + DRAWSTATE_INVALID_EXTENTS, DRAWSTATE_VTX_INDEX_OUT_OF_BOUNDS, DRAWSTATE_VTX_INDEX_ALIGNMENT_ERROR, DRAWSTATE_OUT_OF_MEMORY, @@ -136,6 +137,8 @@ enum DRAW_STATE_ERROR { DRAWSTATE_PUSH_CONSTANTS_ERROR, DRAWSTATE_INVALID_SUBPASS_INDEX, DRAWSTATE_MISMATCHED_IMAGE_FORMAT, + DRAWSTATE_MISMATCHED_IMAGE_ASPECT, + DRAWSTATE_INVALID_IMAGE_FILTER, DRAWSTATE_SWAPCHAIN_NO_SYNC_FOR_ACQUIRE, DRAWSTATE_SWAPCHAIN_INVALID_IMAGE, DRAWSTATE_SWAPCHAIN_IMAGE_NOT_ACQUIRED, diff --git a/layers/image.cpp b/layers/image.cpp index 655c341..c2c8109 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(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(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); -- 2.7.4