diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-10-26 10:42:49 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-10-27 07:59:34 -0600 |
| commit | cd92219253b508f28a2b7e5b68b4cbf07cdf042f (patch) | |
| tree | 8cdaa652f41aa3a8f8fa2aa179f5de862a732fe8 | |
| parent | b5729cc6fccbb3cb7b03030d2139a9efeca2a0e0 (diff) | |
| download | usermoji-cd92219253b508f28a2b7e5b68b4cbf07cdf042f.tar.xz | |
layers:Migrate CreateImageView checks
Move CreateImageView checks from image layer to core_validation.
This is in preparation of dual-purposing the aspect mask checking
code to perform the same check on barriers.
Also updated these checks to use unique errors enums and made
corresponsing changes to the database file.
| -rw-r--r-- | layers/core_validation.cpp | 150 | ||||
| -rw-r--r-- | layers/image.cpp | 178 | ||||
| -rw-r--r-- | layers/vk_validation_error_database.txt | 10 |
3 files changed, 165 insertions, 173 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index be1b3607..21c2a90b 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -6494,9 +6494,9 @@ static void ResolveRemainingLevelsLayers(layer_data *dev_data, uint32_t *levels, } } -static bool PreCallValidateCreateImageView(layer_data *dev_data, const VkImageViewCreateInfo *pCreateInfo) { +static bool PreCallValidateCreateImageView(layer_data *dev_data, const VkImageViewCreateInfo *create_info) { bool skip = false; - IMAGE_STATE *image_state = getImageState(dev_data, pCreateInfo->image); + IMAGE_STATE *image_state = getImageState(dev_data, create_info->image); if (image_state) { skip |= ValidateImageUsageFlags( dev_data, image_state, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT | @@ -6505,13 +6505,153 @@ static bool PreCallValidateCreateImageView(layer_data *dev_data, const VkImageVi "VK_IMAGE_USAGE_[SAMPLED|STORAGE|COLOR_ATTACHMENT|DEPTH_STENCIL_ATTACHMENT|INPUT_ATTACHMENT]_BIT"); // If this isn't a sparse image, it needs to have memory backing it at CreateImageView time skip |= ValidateMemoryIsBoundToImage(dev_data, image_state, "vkCreateImageView()"); + // Checks imported from image layer + if (create_info->subresourceRange.baseMipLevel >= image_state->createInfo.mipLevels) { + std::stringstream ss; + ss << "vkCreateImageView called with baseMipLevel " << create_info->subresourceRange.baseMipLevel << " for image " + << create_info->image << " that only has " << image_state->createInfo.mipLevels << " mip levels."; + skip |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, + VALIDATION_ERROR_00768, "IMAGE", "%s %s", ss.str().c_str(), validation_error_map[VALIDATION_ERROR_00768]); + } + if (create_info->subresourceRange.baseArrayLayer >= image_state->createInfo.arrayLayers) { + std::stringstream ss; + ss << "vkCreateImageView called with baseArrayLayer " << create_info->subresourceRange.baseArrayLayer << " for image " + << create_info->image << " that only has " << image_state->createInfo.arrayLayers << " array layers."; + skip |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, + VALIDATION_ERROR_00769, "IMAGE", "%s %s", ss.str().c_str(), validation_error_map[VALIDATION_ERROR_00769]); + } + // TODO: Need new valid usage language for levelCount == 0 & layerCount == 0 + if (!create_info->subresourceRange.levelCount) { + std::stringstream ss; + ss << "vkCreateImageView called with 0 in create_info->subresourceRange.levelCount."; + skip |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, + VALIDATION_ERROR_00768, "IMAGE", "%s %s", ss.str().c_str(), validation_error_map[VALIDATION_ERROR_00768]); + } + if (!create_info->subresourceRange.layerCount) { + std::stringstream ss; + ss << "vkCreateImageView called with 0 in create_info->subresourceRange.layerCount."; + skip |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, + VALIDATION_ERROR_00769, "IMAGE", "%s %s", ss.str().c_str(), validation_error_map[VALIDATION_ERROR_00769]); + } + + VkImageCreateFlags image_flags = image_state->createInfo.flags; + VkFormat image_format = image_state->createInfo.format; + VkFormat view_format = create_info->format; + VkImageAspectFlags aspect_mask = create_info->subresourceRange.aspectMask; + + // Validate VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT state + if (image_flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) { + // Format MUST be compatible (in the same format compatibility class) as the format the image was created with + if (vk_format_get_compatibility_class(image_format) != vk_format_get_compatibility_class(view_format)) { + std::stringstream ss; + ss << "vkCreateImageView(): ImageView format " << string_VkFormat(view_format) + << " is not in the same format compatibility class as image (" << (uint64_t)create_info->image << ") format " + << string_VkFormat(image_format) << ". Images created with the VK_IMAGE_CREATE_MUTABLE_FORMAT BIT " + << "can support ImageViews with differing formats but they must be in the same compatibility class."; + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, + VALIDATION_ERROR_02171, "IMAGE", "%s %s", ss.str().c_str(), + validation_error_map[VALIDATION_ERROR_02171]); + } + } else { + // Format MUST be IDENTICAL to the format the image was created with + if (image_format != view_format) { + std::stringstream ss; + ss << "vkCreateImageView() format " << string_VkFormat(view_format) << " differs from image " + << (uint64_t)create_info->image << " format " << string_VkFormat(image_format) + << ". Formats MUST be IDENTICAL unless VK_IMAGE_CREATE_MUTABLE_FORMAT BIT was set on image creation."; + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, + VALIDATION_ERROR_02172, "IMAGE", "%s %s", ss.str().c_str(), + validation_error_map[VALIDATION_ERROR_02172]); + } + } + + // Validate correct image aspect bits for desired formats and format consistency + if (vk_format_is_color(image_format)) { + if ((aspect_mask & VK_IMAGE_ASPECT_COLOR_BIT) != VK_IMAGE_ASPECT_COLOR_BIT) { + std::stringstream ss; + ss << "vkCreateImageView: Color image formats must have the VK_IMAGE_ASPECT_COLOR_BIT set"; + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + (uint64_t)create_info->image, __LINE__, VALIDATION_ERROR_00741, "IMAGE", "%s %s", ss.str().c_str(), + validation_error_map[VALIDATION_ERROR_00741]); + } + if ((aspect_mask & VK_IMAGE_ASPECT_COLOR_BIT) != aspect_mask) { + std::stringstream ss; + ss << "vkCreateImageView: Color image formats must have ONLY the VK_IMAGE_ASPECT_COLOR_BIT set"; + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + (uint64_t)create_info->image, __LINE__, VALIDATION_ERROR_00741, "IMAGE", "%s %s", ss.str().c_str(), + validation_error_map[VALIDATION_ERROR_00741]); + } + if (!vk_format_is_color(view_format)) { + std::stringstream ss; + ss << "vkCreateImageView: The image view's format can differ from the parent image's format, but both must be " + << "color formats. ImageFormat is " << string_VkFormat(image_format) << " ImageViewFormat is " + << string_VkFormat(view_format); + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + (uint64_t)create_info->image, __LINE__, VALIDATION_ERROR_02171, "IMAGE", "%s %s", ss.str().c_str(), + validation_error_map[VALIDATION_ERROR_02171]); + } + // TODO: Uncompressed formats are compatible if they occupy they same number of bits per pixel. + // Compressed formats are compatible if the only difference between them is the numerical type of + // the uncompressed pixels (e.g. signed vs. unsigned, or sRGB vs. UNORM encoding). + } else if (vk_format_is_depth_and_stencil(image_format)) { + if ((aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) == 0) { + std::stringstream ss; + ss << "vkCreateImageView: Depth/stencil image formats must have at least one of VK_IMAGE_ASPECT_DEPTH_BIT and " + "VK_IMAGE_ASPECT_STENCIL_BIT set"; + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + (uint64_t)create_info->image, __LINE__, VALIDATION_ERROR_00741, "IMAGE", "%s %s", ss.str().c_str(), + validation_error_map[VALIDATION_ERROR_00741]); + } + if ((aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) != aspect_mask) { + std::stringstream ss; + ss << "vkCreateImageView: Combination depth/stencil image formats can have only the VK_IMAGE_ASPECT_DEPTH_BIT and " + "VK_IMAGE_ASPECT_STENCIL_BIT set"; + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + (uint64_t)create_info->image, __LINE__, VALIDATION_ERROR_00741, "IMAGE", "%s %s", ss.str().c_str(), + validation_error_map[VALIDATION_ERROR_00741]); + } + } else if (vk_format_is_depth_only(image_format)) { + if ((aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT) != VK_IMAGE_ASPECT_DEPTH_BIT) { + std::stringstream ss; + ss << "vkCreateImageView: Depth-only image formats must have the VK_IMAGE_ASPECT_DEPTH_BIT set"; + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + (uint64_t)create_info->image, __LINE__, VALIDATION_ERROR_00741, "IMAGE", "%s %s", ss.str().c_str(), + validation_error_map[VALIDATION_ERROR_00741]); + } + if ((aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT) != aspect_mask) { + std::stringstream ss; + ss << "vkCreateImageView: Depth-only image formats can have only the VK_IMAGE_ASPECT_DEPTH_BIT set"; + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + (uint64_t)create_info->image, __LINE__, VALIDATION_ERROR_00741, "IMAGE", "%s %s", ss.str().c_str(), + validation_error_map[VALIDATION_ERROR_00741]); + } + } else if (vk_format_is_stencil_only(image_format)) { + if ((aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT) != VK_IMAGE_ASPECT_STENCIL_BIT) { + std::stringstream ss; + ss << "vkCreateImageView: Stencil-only image formats must have the VK_IMAGE_ASPECT_STENCIL_BIT set"; + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + (uint64_t)create_info->image, __LINE__, VALIDATION_ERROR_00741, "IMAGE", "%s %s", ss.str().c_str(), + validation_error_map[VALIDATION_ERROR_00741]); + } + if ((aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT) != aspect_mask) { + std::stringstream ss; + ss << "vkCreateImageView: Stencil-only image formats can have only the VK_IMAGE_ASPECT_STENCIL_BIT set"; + skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + (uint64_t)create_info->image, __LINE__, VALIDATION_ERROR_00741, "IMAGE", "%s %s", ss.str().c_str(), + validation_error_map[VALIDATION_ERROR_00741]); + } + } } return skip; } -static inline void PostCallRecordCreateImageView(layer_data *dev_data, const VkImageViewCreateInfo *pCreateInfo, VkImageView view) { - dev_data->imageViewMap[view] = unique_ptr<IMAGE_VIEW_STATE>(new IMAGE_VIEW_STATE(view, pCreateInfo)); - ResolveRemainingLevelsLayers(dev_data, &dev_data->imageViewMap[view].get()->create_info.subresourceRange, pCreateInfo->image); +static inline void PostCallRecordCreateImageView(layer_data *dev_data, const VkImageViewCreateInfo *create_info, VkImageView view) { + dev_data->imageViewMap[view] = unique_ptr<IMAGE_VIEW_STATE>(new IMAGE_VIEW_STATE(view, create_info)); + ResolveRemainingLevelsLayers(dev_data, &dev_data->imageViewMap[view].get()->create_info.subresourceRange, create_info->image); } VKAPI_ATTR VkResult VKAPI_CALL CreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, diff --git a/layers/image.cpp b/layers/image.cpp index 383693d1..f3bfacdc 100644 --- a/layers/image.cpp +++ b/layers/image.cpp @@ -464,153 +464,6 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass(VkDevice device, const VkRenderP return result; } -VKAPI_ATTR VkResult VKAPI_CALL CreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkImageView *pView) { - bool skipCall = false; - layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); - auto imageEntry = getImageState(device_data, pCreateInfo->image); - if (imageEntry) { - if (pCreateInfo->subresourceRange.baseMipLevel >= imageEntry->mipLevels) { - std::stringstream ss; - ss << "vkCreateImageView called with baseMipLevel " << pCreateInfo->subresourceRange.baseMipLevel << " for image " - << pCreateInfo->image << " that only has " << imageEntry->mipLevels << " mip levels."; - skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, - IMAGE_VIEW_CREATE_ERROR, "IMAGE", "%s", ss.str().c_str()); - } - if (pCreateInfo->subresourceRange.baseArrayLayer >= imageEntry->arraySize) { - std::stringstream ss; - ss << "vkCreateImageView called with baseArrayLayer " << pCreateInfo->subresourceRange.baseArrayLayer << " for image " - << pCreateInfo->image << " that only has " << imageEntry->arraySize << " array layers."; - skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, - IMAGE_VIEW_CREATE_ERROR, "IMAGE", "%s", ss.str().c_str()); - } - if (!pCreateInfo->subresourceRange.levelCount) { - std::stringstream ss; - ss << "vkCreateImageView called with 0 in pCreateInfo->subresourceRange.levelCount."; - skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, - IMAGE_VIEW_CREATE_ERROR, "IMAGE", "%s", ss.str().c_str()); - } - if (!pCreateInfo->subresourceRange.layerCount) { - std::stringstream ss; - ss << "vkCreateImageView called with 0 in pCreateInfo->subresourceRange.layerCount."; - skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, - IMAGE_VIEW_CREATE_ERROR, "IMAGE", "%s", ss.str().c_str()); - } - - VkImageCreateFlags imageFlags = imageEntry->flags; - VkFormat imageFormat = imageEntry->format; - VkFormat ivciFormat = pCreateInfo->format; - VkImageAspectFlags aspectMask = pCreateInfo->subresourceRange.aspectMask; - - // Validate VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT state - if (imageFlags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) { - // Format MUST be compatible (in the same format compatibility class) as the format the image was created with - if (vk_format_get_compatibility_class(imageFormat) != vk_format_get_compatibility_class(ivciFormat)) { - std::stringstream ss; - ss << "vkCreateImageView(): ImageView format " << string_VkFormat(ivciFormat) - << " is not in the same format compatibility class as image (" << (uint64_t)pCreateInfo->image << ") format " - << string_VkFormat(imageFormat) << ". Images created with the VK_IMAGE_CREATE_MUTABLE_FORMAT BIT " - << "can support ImageViews with differing formats but they must be in the same compatibility class."; - skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, - __LINE__, IMAGE_VIEW_CREATE_ERROR, "IMAGE", "%s", ss.str().c_str()); - } - } else { - // Format MUST be IDENTICAL to the format the image was created with - if (imageFormat != ivciFormat) { - std::stringstream ss; - ss << "vkCreateImageView() format " << string_VkFormat(ivciFormat) << " differs from image " - << (uint64_t)pCreateInfo->image << " format " << string_VkFormat(imageFormat) - << ". Formats MUST be IDENTICAL unless VK_IMAGE_CREATE_MUTABLE_FORMAT BIT was set on image creation."; - skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, - __LINE__, IMAGE_VIEW_CREATE_ERROR, "IMAGE", "%s", ss.str().c_str()); - } - } - - // Validate correct image aspect bits for desired formats and format consistency - if (vk_format_is_color(imageFormat)) { - if ((aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) != VK_IMAGE_ASPECT_COLOR_BIT) { - std::stringstream ss; - ss << "vkCreateImageView: Color image formats must have the VK_IMAGE_ASPECT_COLOR_BIT set"; - skipCall |= - log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - (uint64_t)pCreateInfo->image, __LINE__, IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str()); - } - if ((aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) != aspectMask) { - std::stringstream ss; - ss << "vkCreateImageView: Color image formats must have ONLY the VK_IMAGE_ASPECT_COLOR_BIT set"; - skipCall |= - log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - (uint64_t)pCreateInfo->image, __LINE__, IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str()); - } - if (!vk_format_is_color(ivciFormat)) { - std::stringstream ss; - ss << "vkCreateImageView: The image view's format can differ from the parent image's format, but both must be " - << "color formats. ImageFormat is " << string_VkFormat(imageFormat) << " ImageViewFormat is " - << string_VkFormat(ivciFormat); - skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - (uint64_t)pCreateInfo->image, __LINE__, IMAGE_INVALID_FORMAT, "IMAGE", "%s", ss.str().c_str()); - } - // TODO: Uncompressed formats are compatible if they occupy they same number of bits per pixel. - // Compressed formats are compatible if the only difference between them is the numerical type of - // the uncompressed pixels (e.g. signed vs. unsigned, or sRGB vs. UNORM encoding). - } else if (vk_format_is_depth_and_stencil(imageFormat)) { - if ((aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) == 0) { - std::stringstream ss; - ss << "vkCreateImageView: Depth/stencil image formats must have at least one of VK_IMAGE_ASPECT_DEPTH_BIT and " - "VK_IMAGE_ASPECT_STENCIL_BIT set"; - skipCall |= - log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - (uint64_t)pCreateInfo->image, __LINE__, IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str()); - } - if ((aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) != aspectMask) { - std::stringstream ss; - ss << "vkCreateImageView: Combination depth/stencil image formats can have only the VK_IMAGE_ASPECT_DEPTH_BIT and " - "VK_IMAGE_ASPECT_STENCIL_BIT set"; - skipCall |= - log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - (uint64_t)pCreateInfo->image, __LINE__, IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str()); - } - } else if (vk_format_is_depth_only(imageFormat)) { - if ((aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) != VK_IMAGE_ASPECT_DEPTH_BIT) { - std::stringstream ss; - ss << "vkCreateImageView: Depth-only image formats must have the VK_IMAGE_ASPECT_DEPTH_BIT set"; - skipCall |= - log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - (uint64_t)pCreateInfo->image, __LINE__, IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str()); - } - if ((aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) != aspectMask) { - std::stringstream ss; - ss << "vkCreateImageView: Depth-only image formats can have only the VK_IMAGE_ASPECT_DEPTH_BIT set"; - skipCall |= - log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - (uint64_t)pCreateInfo->image, __LINE__, IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str()); - } - } else if (vk_format_is_stencil_only(imageFormat)) { - if ((aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) != VK_IMAGE_ASPECT_STENCIL_BIT) { - std::stringstream ss; - ss << "vkCreateImageView: Stencil-only image formats must have the VK_IMAGE_ASPECT_STENCIL_BIT set"; - skipCall |= - log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - (uint64_t)pCreateInfo->image, __LINE__, IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str()); - } - if ((aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) != aspectMask) { - std::stringstream ss; - ss << "vkCreateImageView: Stencil-only image formats can have only the VK_IMAGE_ASPECT_STENCIL_BIT set"; - skipCall |= - log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - (uint64_t)pCreateInfo->image, __LINE__, IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str()); - } - } - } - - if (skipCall) { - return VK_ERROR_VALIDATION_FAILED_EXT; - } - - VkResult result = device_data->device_dispatch_table->CreateImageView(device, pCreateInfo, pAllocator, pView); - return result; -} - VKAPI_ATTR void VKAPI_CALL CmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue *pColor, uint32_t rangeCount, const VkImageSubresourceRange *pRanges) { @@ -1500,22 +1353,21 @@ intercept_core_device_command(const char *name) { const char *name; PFN_vkVoidFunction proc; } core_device_commands[] = { - { "vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr) }, - { "vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(DestroyDevice) }, - { "vkCreateImage", reinterpret_cast<PFN_vkVoidFunction>(CreateImage) }, - { "vkDestroyImage", reinterpret_cast<PFN_vkVoidFunction>(DestroyImage) }, - { "vkCreateImageView", reinterpret_cast<PFN_vkVoidFunction>(CreateImageView) }, - { "vkCreateRenderPass", reinterpret_cast<PFN_vkVoidFunction>(CreateRenderPass) }, - { "vkCmdClearColorImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearColorImage) }, - { "vkCmdClearDepthStencilImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearDepthStencilImage) }, - { "vkCmdClearAttachments", reinterpret_cast<PFN_vkVoidFunction>(CmdClearAttachments) }, - { "vkCmdCopyImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImage) }, - { "vkCmdCopyImageToBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImageToBuffer) }, - { "vkCmdCopyBufferToImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyBufferToImage) }, - { "vkCmdBlitImage", reinterpret_cast<PFN_vkVoidFunction>(CmdBlitImage) }, - { "vkCmdPipelineBarrier", reinterpret_cast<PFN_vkVoidFunction>(CmdPipelineBarrier) }, - { "vkCmdResolveImage", reinterpret_cast<PFN_vkVoidFunction>(CmdResolveImage) }, - { "vkGetImageSubresourceLayout", reinterpret_cast<PFN_vkVoidFunction>(GetImageSubresourceLayout) }, + {"vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr)}, + {"vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(DestroyDevice)}, + {"vkCreateImage", reinterpret_cast<PFN_vkVoidFunction>(CreateImage)}, + {"vkDestroyImage", reinterpret_cast<PFN_vkVoidFunction>(DestroyImage)}, + {"vkCreateRenderPass", reinterpret_cast<PFN_vkVoidFunction>(CreateRenderPass)}, + {"vkCmdClearColorImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearColorImage)}, + {"vkCmdClearDepthStencilImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearDepthStencilImage)}, + {"vkCmdClearAttachments", reinterpret_cast<PFN_vkVoidFunction>(CmdClearAttachments)}, + {"vkCmdCopyImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImage)}, + {"vkCmdCopyImageToBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImageToBuffer)}, + {"vkCmdCopyBufferToImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyBufferToImage)}, + {"vkCmdBlitImage", reinterpret_cast<PFN_vkVoidFunction>(CmdBlitImage)}, + {"vkCmdPipelineBarrier", reinterpret_cast<PFN_vkVoidFunction>(CmdPipelineBarrier)}, + {"vkCmdResolveImage", reinterpret_cast<PFN_vkVoidFunction>(CmdResolveImage)}, + {"vkGetImageSubresourceLayout", reinterpret_cast<PFN_vkVoidFunction>(GetImageSubresourceLayout)}, }; for (size_t i = 0; i < ARRAY_SIZE(core_device_commands); i++) { diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt index db74eb33..6f2a3956 100644 --- a/layers/vk_validation_error_database.txt +++ b/layers/vk_validation_error_database.txt @@ -731,7 +731,7 @@ VALIDATION_ERROR_00737~^~U~^~Unknown~^~vkGetImageSubresourceLayout~^~For more in VALIDATION_ERROR_00738~^~U~^~Unknown~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'image must have been created, allocated, or retrieved from device' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkGetImageSubresourceLayout)~^~ VALIDATION_ERROR_00739~^~U~^~Unknown~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'mipLevel must be less than the mipLevels specified in VkImageCreateInfo when the image was created' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageSubresource)~^~ VALIDATION_ERROR_00740~^~U~^~Unknown~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'arrayLayer must be less than the arrayLayers specified in VkImageCreateInfo when the image was created' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageSubresource)~^~ -VALIDATION_ERROR_00741~^~U~^~Unknown~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'aspectMask must be a valid combination of VkImageAspectFlagBits values' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageSubresource)~^~ +VALIDATION_ERROR_00741~^~Y~^~InvalidImageViewAspect~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'aspectMask must be a valid combination of VkImageAspectFlagBits values' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageSubresource)~^~Multi-purposing this enum for various invalid aspect usage. There is some "must" language in spec at VkImageAspectFlagBits definition that we need specific enums for. Also need more tests for these cases. VALIDATION_ERROR_00742~^~U~^~Unknown~^~vkGetImageSubresourceLayout~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'aspectMask must not be 0' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageSubresource)~^~ VALIDATION_ERROR_00743~^~Y~^~FramebufferImageInUseDestroyedSignaled~^~vkDestroyImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'All submitted commands that refer to image, either directly or via a VkImageView, must have completed execution' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkDestroyImage)~^~ VALIDATION_ERROR_00744~^~U~^~Unknown~^~vkDestroyImage~^~For more information refer to Vulkan Spec Section '11.3. Images' which states 'If VkAllocationCallbacks were provided when image was created, a compatible set of callbacks must be provided here' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkDestroyImage)~^~ @@ -758,8 +758,8 @@ VALIDATION_ERROR_00764~^~U~^~Unknown~^~vkCreateImageView~^~For more information VALIDATION_ERROR_00765~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'format must be a valid VkFormat value' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-image-views-compatibility)~^~ VALIDATION_ERROR_00766~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'components must be a valid VkComponentMapping structure' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-image-views-compatibility)~^~ VALIDATION_ERROR_00767~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'subresourceRange must be a valid VkImageSubresourceRange structure' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-image-views-compatibility)~^~ -VALIDATION_ERROR_00768~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'If levelCount is not VK_REMAINING_MIP_LEVELS, (baseMipLevel + levelCount) must be less than or equal to the mipLevels specified in VkImageCreateInfo when the image was created' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageAspectFlagBits)~^~ -VALIDATION_ERROR_00769~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'If layerCount is not VK_REMAINING_ARRAY_LAYERS, (baseArrayLayer + layerCount) must be less than or equal to the arrayLayers specified in VkImageCreateInfo when the image was created' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageAspectFlagBits)~^~ +VALIDATION_ERROR_00768~^~Y~^~InvalidImageView,ImageLayerViewTests~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'If levelCount is not VK_REMAINING_MIP_LEVELS, (baseMipLevel + levelCount) must be less than or equal to the mipLevels specified in VkImageCreateInfo when the image was created' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageAspectFlagBits)~^~Dual purposing this for when levelCount is 0, need new valid usage language for that case +VALIDATION_ERROR_00769~^~Y~^~ImageLayerViewTests~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'If layerCount is not VK_REMAINING_ARRAY_LAYERS, (baseArrayLayer + layerCount) must be less than or equal to the arrayLayers specified in VkImageCreateInfo when the image was created' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageAspectFlagBits)~^~Dual purposing this for when layerCount is 0, need new valid usage language for that case VALIDATION_ERROR_00770~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'aspectMask must be a valid combination of VkImageAspectFlagBits values' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageAspectFlagBits)~^~ VALIDATION_ERROR_00771~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'aspectMask must not be 0' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#VkImageAspectFlagBits)~^~ VALIDATION_ERROR_00772~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'r must be a valid VkComponentSwizzle value' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-image-views-identity-mappings)~^~ @@ -2116,8 +2116,8 @@ VALIDATION_ERROR_02167~^~U~^~Unknown~^~vkCreateImageView~^~For more information VALIDATION_ERROR_02168~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'If image was created with VK_IMAGE_TILING_OPTIMAL and usage containing VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, format must be supported for color attachments, as specified by the VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT flag in VkFormatProperties::optimalTilingFeatures returned by vkGetPhysicalDeviceFormatProperties with the same value of format' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-image-views-compatibility)~^~ VALIDATION_ERROR_02169~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'If image was created with VK_IMAGE_TILING_OPTIMAL and usage containing VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, format must be supported for depth/stencil attachments, as specified by the VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT flag in VkFormatProperties::optimalTilingFeatures returned by vkGetPhysicalDeviceFormatProperties with the same value of format' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-image-views-compatibility)~^~ VALIDATION_ERROR_02170~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'subresourceRange must be a valid image subresource range for image (see Section 11.5, Image Views)' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-image-views-compatibility)~^~ -VALIDATION_ERROR_02171~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'If image was created with the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT flag, format must be compatible with the format used to create image, as defined in Format Compatibility Classes' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-image-views-compatibility)~^~ -VALIDATION_ERROR_02172~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'If image was not created with the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT flag, format must be identical to the format used to create image' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-image-views-compatibility)~^~ +VALIDATION_ERROR_02171~^~Y~^~ImageLayerViewTests~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'If image was created with the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT flag, format must be compatible with the format used to create image, as defined in Format Compatibility Classes' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-image-views-compatibility)~^~Multi-purposing this for some format compatibility checks, need unique enums. +VALIDATION_ERROR_02172~^~Y~^~ImageLayerViewTests~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'If image was not created with the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT flag, format must be identical to the format used to create image' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-image-views-compatibility)~^~ VALIDATION_ERROR_02173~^~U~^~Unknown~^~vkCreateImageView~^~For more information refer to Vulkan Spec Section '11.5. Image Views' which states 'subResourceRange and viewType must be compatible with the image, as described in the compatibility table' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-image-views-compatibility)~^~ VALIDATION_ERROR_02174~^~U~^~Unknown~^~vkBindBufferMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'memoryOffset must be an integer multiple of the alignment member of the VkMemoryRequirements structure returned from a call to vkGetBufferMemoryRequirements with buffer' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindBufferMemory)~^~ VALIDATION_ERROR_02175~^~U~^~Unknown~^~vkBindBufferMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'The size member of the VkMemoryRequirements structure returned from a call to vkGetBufferMemoryRequirements with buffer must be less than or equal to the size of memory minus memoryOffset' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindBufferMemory)~^~ |
