aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2017-02-01 10:57:21 -0700
committerMark Lobodzinski <mark@lunarg.com>2017-02-02 10:02:21 -0700
commitd2fc3184ae47dd3aebaeb59a853740a7a66aa6e8 (patch)
treeebbf0f9cad470826166db41152c01192af98f35b
parent9996425e3cb273d2a05b53a33a5deab9fd83f03f (diff)
downloadusermoji-d2fc3184ae47dd3aebaeb59a853740a7a66aa6e8.tar.xz
layers: Move ClearDepthStencilImage val out of CV
Moved this image layer validation into the existing routines in the buffer_validation module. Change-Id: If809b5ef484fccdd2d9715adc06c5e439b0b8942
-rw-r--r--layers/buffer_validation.cpp33
-rw-r--r--layers/core_validation_types.h1
-rw-r--r--layers/image.cpp33
3 files changed, 25 insertions, 42 deletions
diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp
index e50d6431..975af3aa 100644
--- a/layers/buffer_validation.cpp
+++ b/layers/buffer_validation.cpp
@@ -415,19 +415,36 @@ void PreCallRecordCmdClearImage(core_validation::layer_data *dev_data, VkCommand
}
}
-bool PreCallValidateCmdClearDepthStencilImage(core_validation::layer_data *dev_data, VkCommandBuffer commandBuffer, VkImage image,
- VkImageLayout imageLayout, uint32_t rangeCount,
+bool PreCallValidateCmdClearDepthStencilImage(core_validation::layer_data *device_data, VkCommandBuffer commandBuffer,
+ VkImage image, VkImageLayout imageLayout, uint32_t rangeCount,
const VkImageSubresourceRange *pRanges) {
bool skip = false;
+ const debug_report_data *report_data = core_validation::GetReportData(device_data);
+
// TODO : Verify memory is in VK_IMAGE_STATE_CLEAR state
- auto cb_node = getCBNode(dev_data, commandBuffer);
- auto image_state = getImageState(dev_data, image);
+ auto cb_node = getCBNode(device_data, commandBuffer);
+ auto image_state = getImageState(device_data, image);
if (cb_node && image_state) {
- skip |= ValidateMemoryIsBoundToImage(dev_data, image_state, "vkCmdClearDepthStencilImage()", VALIDATION_ERROR_02528);
- skip |= ValidateCmd(dev_data, cb_node, CMD_CLEARDEPTHSTENCILIMAGE, "vkCmdClearDepthStencilImage()");
- skip |= insideRenderPass(dev_data, cb_node, "vkCmdClearDepthStencilImage()", VALIDATION_ERROR_01111);
+ skip |= ValidateMemoryIsBoundToImage(device_data, image_state, "vkCmdClearDepthStencilImage()", VALIDATION_ERROR_02528);
+ skip |= ValidateCmd(device_data, cb_node, CMD_CLEARDEPTHSTENCILIMAGE, "vkCmdClearDepthStencilImage()");
+ skip |= insideRenderPass(device_data, cb_node, "vkCmdClearDepthStencilImage()", VALIDATION_ERROR_01111);
for (uint32_t i = 0; i < rangeCount; ++i) {
- skip |= VerifyClearImageLayout(dev_data, cb_node, image, pRanges[i], imageLayout, "vkCmdClearDepthStencilImage()");
+ skip |= VerifyClearImageLayout(device_data, cb_node, image, pRanges[i], imageLayout, "vkCmdClearDepthStencilImage()");
+ // Image aspect must be depth or stencil or both
+ if (((pRanges[i].aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) != VK_IMAGE_ASPECT_DEPTH_BIT) &&
+ ((pRanges[i].aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) != VK_IMAGE_ASPECT_STENCIL_BIT)) {
+ char const str[] =
+ "vkCmdClearDepthStencilImage aspectMasks for all subresource ranges must be "
+ "set to VK_IMAGE_ASPECT_DEPTH_BIT and/or VK_IMAGE_ASPECT_STENCIL_BIT";
+ skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
+ (uint64_t)commandBuffer, __LINE__, DRAWSTATE_INVALID_IMAGE_ASPECT, "IMAGE", str);
+ }
+ }
+ if (image_state && !vk_format_is_depth_or_stencil(image_state->createInfo.format)) {
+ char const str[] = "vkCmdClearDepthStencilImage called without a depth/stencil image.";
+ skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
+ reinterpret_cast<uint64_t &>(image), __LINE__, VALIDATION_ERROR_01103, "IMAGE", "%s. %s", str,
+ validation_error_map[VALIDATION_ERROR_01103]);
}
}
return skip;
diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h
index e5924856..db5538bb 100644
--- a/layers/core_validation_types.h
+++ b/layers/core_validation_types.h
@@ -742,7 +742,6 @@ void UpdateCmdBufferLastCmd(layer_data *my_data, GLOBAL_CB_NODE *cb_state, const
void SetLayout(GLOBAL_CB_NODE *pCB, ImageSubresourcePair imgpair, const IMAGE_CMD_BUF_LAYOUT_NODE &node);
void SetLayout(GLOBAL_CB_NODE *pCB, ImageSubresourcePair imgpair, const VkImageLayout &layout);
-
// Prototypes for layer_data accessor functions. These should be in their own header file at some point
PFN_vkGetPhysicalDeviceFormatProperties GetFormatPropertiesPointer(layer_data *);
PFN_vkGetPhysicalDeviceImageFormatProperties GetImageFormatPropertiesPointer(layer_data *);
diff --git a/layers/image.cpp b/layers/image.cpp
index 41108936..9153b83a 100644
--- a/layers/image.cpp
+++ b/layers/image.cpp
@@ -241,38 +241,6 @@ VKAPI_ATTR void VKAPI_CALL DestroyImage(VkDevice device, VkImage image, const Vk
device_data->device_dispatch_table->DestroyImage(device, image, pAllocator);
}
-VKAPI_ATTR void VKAPI_CALL CmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
- const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount,
- const VkImageSubresourceRange *pRanges) {
- bool skipCall = false;
- layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- // For each range, Image aspect must be depth or stencil or both
- for (uint32_t i = 0; i < rangeCount; i++) {
- if (((pRanges[i].aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) != VK_IMAGE_ASPECT_DEPTH_BIT) &&
- ((pRanges[i].aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) != VK_IMAGE_ASPECT_STENCIL_BIT)) {
- char const str[] =
- "vkCmdClearDepthStencilImage aspectMasks for all subresource ranges must be "
- "set to VK_IMAGE_ASPECT_DEPTH_BIT and/or VK_IMAGE_ASPECT_STENCIL_BIT";
- 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", str);
- }
- }
-
- auto image_state = getImageState(device_data, image);
- if (image_state && !vk_format_is_depth_or_stencil(image_state->format)) {
- char const str[] = "vkCmdClearDepthStencilImage called without a depth/stencil image.";
- skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
- reinterpret_cast<uint64_t &>(image), __LINE__, VALIDATION_ERROR_01103, "IMAGE", "%s. %s", str,
- validation_error_map[VALIDATION_ERROR_01103]);
- }
-
- if (!skipCall) {
- device_data->device_dispatch_table->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount,
- pRanges);
- }
-}
-
// Returns true if [x, xoffset] and [y, yoffset] overlap
static bool RangesIntersect(int32_t start, uint32_t start_offset, int32_t end, uint32_t end_offset) {
bool result = false;
@@ -1106,7 +1074,6 @@ static PFN_vkVoidFunction intercept_core_device_command(const char *name) {
{"vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(DestroyDevice)},
{"vkCreateImage", reinterpret_cast<PFN_vkVoidFunction>(CreateImage)},
{"vkDestroyImage", reinterpret_cast<PFN_vkVoidFunction>(DestroyImage)},
- {"vkCmdClearDepthStencilImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearDepthStencilImage)},
{"vkCmdClearAttachments", reinterpret_cast<PFN_vkVoidFunction>(CmdClearAttachments)},
{"vkCmdCopyImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImage)},
{"vkCmdCopyImageToBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImageToBuffer)},