From 21a9545f151c15d6f413d98eaf5411f2fd8074b0 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Mon, 6 Feb 2017 15:44:49 -0700 Subject: layers: Move GetImageSubresourceLayout to CV Moved the validation routine from the image layer into the core validation layer. Change-Id: Ic2402de60934356d6582c3c938bba8695336ba83 --- layers/image.cpp | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'layers/image.cpp') diff --git a/layers/image.cpp b/layers/image.cpp index 4fe04d23..31a28e20 100644 --- a/layers/image.cpp +++ b/layers/image.cpp @@ -344,44 +344,6 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyBufferToImage(VkCommandBuffer commandBuffer, V } } -VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, - VkSubresourceLayout *pLayout) { - bool skipCall = false; - layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); - VkFormat format; - - auto imageEntry = getImageState(device_data, image); - - // Validate that image aspects match formats - if (imageEntry) { - format = imageEntry->format; - if (vk_format_is_color(format)) { - if (pSubresource->aspectMask != VK_IMAGE_ASPECT_COLOR_BIT) { - std::stringstream ss; - ss << "vkGetImageSubresourceLayout: For color formats, the aspectMask field of VkImageSubresource must be " - "VK_IMAGE_ASPECT_COLOR."; - skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - (uint64_t)image, __LINE__, VALIDATION_ERROR_00741, "IMAGE", "%s. %s", ss.str().c_str(), - validation_error_map[VALIDATION_ERROR_00741]); - } - } else if (vk_format_is_depth_or_stencil(format)) { - if ((pSubresource->aspectMask != VK_IMAGE_ASPECT_DEPTH_BIT) && - (pSubresource->aspectMask != VK_IMAGE_ASPECT_STENCIL_BIT)) { - std::stringstream ss; - ss << "vkGetImageSubresourceLayout: For depth/stencil formats, the aspectMask selects either the depth or stencil " - "image aspectMask."; - skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - (uint64_t)image, __LINE__, VALIDATION_ERROR_00741, "IMAGE", "%s. %s", ss.str().c_str(), - validation_error_map[VALIDATION_ERROR_00741]); - } - } - } - - if (!skipCall) { - device_data->device_dispatch_table->GetImageSubresourceLayout(device, image, pSubresource, pLayout); - } -} - VKAPI_ATTR void VKAPI_CALL GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) { layer_data *phy_dev_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map); phy_dev_data->instance_dispatch_table->GetPhysicalDeviceProperties(physicalDevice, pProperties); @@ -496,7 +458,6 @@ static PFN_vkVoidFunction intercept_core_device_command(const char *name) { {"vkDestroyImage", reinterpret_cast(DestroyImage)}, {"vkCmdCopyImageToBuffer", reinterpret_cast(CmdCopyImageToBuffer)}, {"vkCmdCopyBufferToImage", reinterpret_cast(CmdCopyBufferToImage)}, - {"vkGetImageSubresourceLayout", reinterpret_cast(GetImageSubresourceLayout)}, }; for (size_t i = 0; i < ARRAY_SIZE(core_device_commands); i++) { -- cgit v1.2.3