aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2017-02-06 15:44:49 -0700
committerMark Lobodzinski <mark@lunarg.com>2017-02-07 14:02:48 -0700
commit21a9545f151c15d6f413d98eaf5411f2fd8074b0 (patch)
tree7af9a39e81704321a64521f438cc9351f62b5ae4
parentadf0c3def4934a902b450e70b4b098e8d306b0ea (diff)
downloadusermoji-21a9545f151c15d6f413d98eaf5411f2fd8074b0.tar.xz
layers: Move GetImageSubresourceLayout to CV
Moved the validation routine from the image layer into the core validation layer. Change-Id: Ic2402de60934356d6582c3c938bba8695336ba83
-rw-r--r--layers/core_validation.cpp39
-rw-r--r--layers/image.cpp39
2 files changed, 39 insertions, 39 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 7ffff872..5e98b813 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -8425,6 +8425,44 @@ VKAPI_ATTR void VKAPI_CALL CmdResolveImage(VkCommandBuffer commandBuffer, VkImag
}
}
+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->createInfo.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->dispatch_table.GetImageSubresourceLayout(device, image, pSubresource, pLayout);
+ }
+}
+
bool setEventStageMask(VkQueue queue, VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
layer_data *dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
GLOBAL_CB_NODE *pCB = getCBNode(dev_data, commandBuffer);
@@ -12325,6 +12363,7 @@ static PFN_vkVoidFunction intercept_core_device_command(const char *name) {
{"vkCmdClearDepthStencilImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearDepthStencilImage)},
{"vkCmdClearAttachments", reinterpret_cast<PFN_vkVoidFunction>(CmdClearAttachments)},
{"vkCmdResolveImage", reinterpret_cast<PFN_vkVoidFunction>(CmdResolveImage)},
+ {"vkGetImageSubresourceLayout", reinterpret_cast<PFN_vkVoidFunction>(GetImageSubresourceLayout) },
{"vkCmdSetEvent", reinterpret_cast<PFN_vkVoidFunction>(CmdSetEvent)},
{"vkCmdResetEvent", reinterpret_cast<PFN_vkVoidFunction>(CmdResetEvent)},
{"vkCmdWaitEvents", reinterpret_cast<PFN_vkVoidFunction>(CmdWaitEvents)},
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<PFN_vkVoidFunction>(DestroyImage)},
{"vkCmdCopyImageToBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImageToBuffer)},
{"vkCmdCopyBufferToImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyBufferToImage)},
- {"vkGetImageSubresourceLayout", reinterpret_cast<PFN_vkVoidFunction>(GetImageSubresourceLayout)},
};
for (size_t i = 0; i < ARRAY_SIZE(core_device_commands); i++) {