diff options
| -rw-r--r-- | layers/core_validation.cpp | 17 | ||||
| -rw-r--r-- | layers/core_validation.h | 12 |
2 files changed, 9 insertions, 20 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 28548ca5..cfc9ae7e 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -2852,10 +2852,10 @@ static VkBool32 validate_dynamic_offsets(layer_data *my_data, const GLOBAL_CB_NO uint32_t startIdx = getBindingStartIndex(layout_node, binding); uint32_t endIdx = getBindingEndIndex(layout_node, binding); for (uint32_t i = startIdx; i <= endIdx; ++i) { - // TODO : Flag error here if set_node->ppDescriptors[i] is NULL - switch (set_node->ppDescriptors[i]->sType) { + // TODO : Flag error here if set_node->pDescriptorUpdates[i] is NULL + switch (set_node->pDescriptorUpdates[i]->sType) { case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET: - pWDS = (VkWriteDescriptorSet *)set_node->ppDescriptors[i]; + pWDS = (VkWriteDescriptorSet *)set_node->pDescriptorUpdates[i]; if ((pWDS->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) || (pWDS->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { for (uint32_t j = 0; j < pWDS->descriptorCount; ++j) { @@ -4021,7 +4021,7 @@ static VkBool32 dsUpdate(layer_data *my_data, VkDevice device, uint32_t descript // Now update appropriate descriptor(s) to point to new Update node for (uint32_t j = startIndex; j <= endIndex; j++) { assert(j < pSet->descriptorCount); - pSet->ppDescriptors[j] = pNewNode; + pSet->pDescriptorUpdates[j] = pNewNode; } } } @@ -4098,7 +4098,7 @@ static VkBool32 dsUpdate(layer_data *my_data, VkDevice device, uint32_t descript // point dst descriptor at corresponding src descriptor // TODO : This may be a hole. I believe copy should be its own copy, // otherwise a subsequent write update to src will incorrectly affect the copy - pDstSet->ppDescriptors[j + dstStartIndex] = pSrcSet->ppDescriptors[j + srcStartIndex]; + pDstSet->pDescriptorUpdates[j + dstStartIndex] = pSrcSet->pDescriptorUpdates[j + srcStartIndex]; pDstSet->pUpdateStructs = pSrcSet->pUpdateStructs; } } @@ -4164,7 +4164,7 @@ static void freeShadowUpdateTree(SET_NODE *pSet) { pSet->pUpdateStructs = NULL; GENERIC_HEADER *pFreeUpdate = pShadowUpdate; // Clear the descriptor mappings as they will now be invalid - memset(pSet->ppDescriptors, 0, pSet->descriptorCount * sizeof(GENERIC_HEADER *)); + pSet->pDescriptorUpdates.clear(); while (pShadowUpdate) { pFreeUpdate = pShadowUpdate; pShadowUpdate = (GENERIC_HEADER *)pShadowUpdate->pNext; @@ -4217,7 +4217,6 @@ static void deletePools(layer_data *my_data) { // Freeing layouts handled in deleteLayouts() function // Free Update shadow struct tree freeShadowUpdateTree(pFreeSet); - delete[] pFreeSet->ppDescriptors; delete pFreeSet; } delete (*ii).second; @@ -6790,9 +6789,7 @@ vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAl pNewNode->set = pDescriptorSets[i]; pNewNode->descriptorCount = (pLayout->createInfo.bindingCount != 0) ? pLayout->endIndex + 1 : 0; if (pNewNode->descriptorCount) { - size_t descriptorArraySize = sizeof(GENERIC_HEADER *) * pNewNode->descriptorCount; - pNewNode->ppDescriptors = new GENERIC_HEADER *[descriptorArraySize]; - memset(pNewNode->ppDescriptors, 0, descriptorArraySize); + pNewNode->pDescriptorUpdates.reserve(pNewNode->descriptorCount); } dev_data->setMap[pDescriptorSets[i]] = pNewNode; } diff --git a/layers/core_validation.h b/layers/core_validation.h index c4a516d4..a157b43b 100644 --- a/layers/core_validation.h +++ b/layers/core_validation.h @@ -41,10 +41,6 @@ using std::vector; -//#ifdef __cplusplus -//extern "C" { -//#endif - #if MTMERGE // Mem Tracker ERROR codes typedef enum _MEM_TRACK_ERROR { @@ -618,11 +614,11 @@ class SET_NODE : public BASE_NODE { GENERIC_HEADER *pUpdateStructs; // Total num of descriptors in this set (count of its layout plus all prior layouts) uint32_t descriptorCount; - GENERIC_HEADER **ppDescriptors; // Array where each index points to update node for its slot + vector<GENERIC_HEADER*> pDescriptorUpdates; // Vector where each index points to update node for its slot LAYOUT_NODE *pLayout; // Layout for this set SET_NODE *pNext; unordered_set<VkCommandBuffer> boundCmdBuffers; // Cmd buffers that this set has been bound to - SET_NODE() : pUpdateStructs(NULL), ppDescriptors(NULL), pLayout(NULL), pNext(NULL){}; + SET_NODE() : set(VK_NULL_HANDLE), pool(VK_NULL_HANDLE), pUpdateStructs(nullptr), pLayout(nullptr), pNext(nullptr){}; }; typedef struct _DESCRIPTOR_POOL_NODE { @@ -896,7 +892,3 @@ class SWAPCHAIN_NODE { } ~SWAPCHAIN_NODE() { delete[] pQueueFamilyIndices; } }; - -//#ifdef __cplusplus -//} -//#endif |
