return pool_it->second;
}
-// Return false if update struct is of valid type, otherwise flag error and return code from callback
-static bool validUpdateStruct(layer_data *dev_data, const VkDevice device, const GENERIC_HEADER *pUpdateStruct) {
- switch (pUpdateStruct->sType) {
- case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET:
- case VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET:
- return false;
- default:
- return log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_INVALID_UPDATE_STRUCT, "DS",
- "Unexpected UPDATE struct of type %s (value %u) in vkUpdateDescriptors() struct tree",
- string_VkStructureType(pUpdateStruct->sType), pUpdateStruct->sType);
- }
-}
-
-// Set count for given update struct in the last parameter
-static uint32_t getUpdateCount(layer_data *dev_data, const VkDevice device, const GENERIC_HEADER *pUpdateStruct) {
- switch (pUpdateStruct->sType) {
- case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET:
- return ((VkWriteDescriptorSet *)pUpdateStruct)->descriptorCount;
- case VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET:
- // TODO : Need to understand this case better and make sure code is correct
- return ((VkCopyDescriptorSet *)pUpdateStruct)->descriptorCount;
- default:
- return 0;
- }
-}
-
-// For given layout and update, return the first overall index of the layout that is updated
-static uint32_t getUpdateStartIndex(layer_data *dev_data, const VkDevice device, const uint32_t binding_start_index,
- const uint32_t arrayIndex, const GENERIC_HEADER *pUpdateStruct) {
- return binding_start_index + arrayIndex;
-}
-// For given layout and update, return the last overall index of the layout that is updated
-static uint32_t getUpdateEndIndex(layer_data *dev_data, const VkDevice device, const uint32_t binding_start_index,
- const uint32_t arrayIndex, const GENERIC_HEADER *pUpdateStruct) {
- uint32_t count = getUpdateCount(dev_data, device, pUpdateStruct);
- return binding_start_index + arrayIndex + count - 1;
-}
-// Verify that the descriptor type in the update struct matches what's expected by the layout
-static bool validateUpdateConsistency(layer_data *dev_data, const VkDevice device, const VkDescriptorType layout_type,
- const GENERIC_HEADER *pUpdateStruct, uint32_t startIndex, uint32_t endIndex) {
- // First get actual type of update
- bool skip_call = false;
- VkDescriptorType actualType = VK_DESCRIPTOR_TYPE_MAX_ENUM;
- switch (pUpdateStruct->sType) {
- case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET:
- actualType = ((VkWriteDescriptorSet *)pUpdateStruct)->descriptorType;
- break;
- case VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET:
- // No need to validate
- return false;
- break;
- default:
- skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_INVALID_UPDATE_STRUCT, "DS",
- "Unexpected UPDATE struct of type %s (value %u) in vkUpdateDescriptors() struct tree",
- string_VkStructureType(pUpdateStruct->sType), pUpdateStruct->sType);
- }
- if (!skip_call) {
- if (layout_type != actualType) {
- skip_call |= log_msg(
- dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
- DRAWSTATE_DESCRIPTOR_TYPE_MISMATCH, "DS",
- "Write descriptor update has descriptor type %s that does not match overlapping binding descriptor type of %s!",
- string_VkDescriptorType(actualType), string_VkDescriptorType(layout_type));
- }
- }
- return skip_call;
-}
-
// Validate that given set is valid and that it's not being used by an in-flight CmdBuffer
// func_str is the name of the calling function
// Return false if no errors occur