(*pNewNode)->pNext = NULL;
return skipCall;
}
+
+static VkBool32 validateDescriptorSetImageView(VkDevice device, uint32_t writeDsCount, const VkWriteDescriptorSet *pWDS)
+{
+ VkBool32 skipCall = VK_FALSE;
+ layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
+
+ // Check ImageAspects of each descriptorSet in each writeDescriptorSet array
+ for (uint32_t i = 0; i < writeDsCount; i++) {
+ for (uint32_t j = 0; j < pWDS[i].count; j++) {
+ const VkDescriptorInfo *dInfo = &pWDS[i].pDescriptors[j];
+ auto imageViewItem = dev_data->imageViewMap.find(dInfo->imageView.handle);
+ if (imageViewItem != dev_data->imageViewMap.end()) {
+ VkImageAspectFlags flags = ((*imageViewItem).second)->subresourceRange.aspectMask;
+ if ((flags & VK_IMAGE_ASPECT_DEPTH_BIT) &&
+ (flags & VK_IMAGE_ASPECT_STENCIL_BIT)) {
+ skipCall |= log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_IMAGE_VIEW, dInfo->imageView.handle, 0,
+ DRAWSTATE_INVALID_IMAGE_ASPECT, "DS", "vkUpdateDescriptorSets: DesriptorSet[%d] in WriteDesriptorSet[%d] "
+ "has ImageView with both STENCIL and DEPTH aspects set", i, j);
+ }
+ }
+ }
+ }
+ return skipCall;
+}
+
// update DS mappings based on ppUpdateArray
static VkBool32 dsUpdate(layer_data* my_data, VkDevice device, VkStructureType type, uint32_t updateCount, const void* pUpdateArray)
{
const VkCopyDescriptorSet *pCDS = NULL;
VkBool32 skipCall = VK_FALSE;
- if (type == VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET)
- pWDS = (const VkWriteDescriptorSet *) pUpdateArray;
- else
- pCDS = (const VkCopyDescriptorSet *) pUpdateArray;
+ if (type == VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET) {
+ pWDS = (const VkWriteDescriptorSet *)pUpdateArray;
+ skipCall |= validateDescriptorSetImageView(device, updateCount, pWDS);
+ } else {
+ pCDS = (const VkCopyDescriptorSet *)pUpdateArray;
+ }
loader_platform_thread_lock_mutex(&globalLock);
LAYOUT_NODE* pLayout = NULL;
DRAWSTATE_CLEAR_CMD_BEFORE_DRAW, // Clear cmd issued before any Draw in CmdBuffer, should use RenderPass Ops instead
DRAWSTATE_BEGIN_CB_INVALID_STATE, // Primary/Secondary CB created with mismatched FB/RP information
DRAWSTATE_VIEWPORT_SCISSOR_MISMATCH, // Count for viewports and scissors mismatch and/or state doesn't match count
+ DRAWSTATE_INVALID_IMAGE_ASPECT, // Image aspect is invalid for the current operation
DRAWSTATE_INVALID_EXTENSION,
} DRAW_STATE_ERROR;
| Correct Clear Use | Warn user if CmdClear for Color or DepthStencil issued to Cmd Buffer prior to a Draw Cmd. RenderPass LOAD_OP_CLEAR is preferred in this case. | CLEAR_CMD_BEFORE_DRAW | vkCmdClearColorImage vkCmdClearDepthStencilImage | ClearCmdNoDraw | NA |
| Index Buffer Binding | Verify that an index buffer is bound at the point when an indexed draw is attempted. | INDEX_BUFFER_NOT_BOUND | vkCmdDrawIndexed vkCmdDrawIndexedIndirect | TODO | Implement validation test |
| Viewport and Scissors match | In PSO viewportCount and scissorCount must match. Also for each count that is non-zero, there corresponding data array ptr should be non-NULL. | VIEWPORT_SCISSOR_MISMATCH | vkCreateGraphicsPipelines vkCmdSetViewport vkCmdSetScissor | TODO | Implement validation test |
+| Valid Image Aspects for DS Updates | When updating Descriptor Sets, the Image Aspect must not have both the DEPTH and STENCIL aspects set | INVALID_IMAGE_ASPECT | vkUpdateDescriptorSets | TODO | Implement validation test |
| NA | Enum used for informational messages | NONE | | NA | None |
| NA | Enum used for errors in the layer itself. This does not indicate an app issue, but instead a bug in the layer. | INTERNAL_ERROR | | NA | None |
| NA | Enum used when Drawstate attempts to allocate memory for its own internal use and is unable to. | OUT_OF_MEMORY | | NA | None |