From: Tobin Ehlis Date: Tue, 20 Oct 2015 16:11:55 +0000 (-0600) Subject: layers: DrawState layout tracking improvements X-Git-Tag: upstream/1.1.92~4709 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a611c79f49e554f67d0821a6a903831323a19d7;p=platform%2Fupstream%2FVulkan-Tools.git layers: DrawState layout tracking improvements Descriptor type per layout tracked via vector to simplify allocation/cleanup. Added tracking for pipeline layout that can be used for further validation checks --- diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index 82377d5..63df706 100755 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -69,6 +69,7 @@ struct layer_data { unordered_map poolMap; unordered_map setMap; unordered_map layoutMap; + unordered_map pipelineLayoutMap; // Map for layout chains unordered_map cmdBufferMap; unordered_map renderPassMap; @@ -824,10 +825,10 @@ static VkBool32 validateUpdateType(const VkDevice device, const LAYOUT_NODE* pLa skipCall |= getUpdateEndIndex(device, pLayout, pUpdateStruct, &endIndex); if (VK_FALSE == skipCall) { for (i = startIndex; i <= endIndex; i++) { - if (pLayout->pTypes[i] != actualType) { + if (pLayout->descriptorTypes[i] != actualType) { skipCall |= log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType) 0, 0, 0, DRAWSTATE_DESCRIPTOR_TYPE_MISMATCH, "DS", "Descriptor update type of %s has descriptor type %s that does not match overlapping binding descriptor type of %s!", - string_VkStructureType(pUpdateStruct->sType), string_VkDescriptorType(actualType), string_VkDescriptorType(pLayout->pTypes[i])); + string_VkStructureType(pUpdateStruct->sType), string_VkDescriptorType(actualType), string_VkDescriptorType(pLayout->descriptorTypes[i])); } } } @@ -1063,9 +1064,6 @@ static void deleteLayouts(layer_data* my_data) } delete[] pLayout->createInfo.pBinding; } - if (pLayout->pTypes) { - delete[] pLayout->pTypes; - } delete pLayout; } my_data->layoutMap.clear(); @@ -1827,12 +1825,12 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(VkDevice device, cons } } if (totalCount > 0) { - pNewNode->pTypes = new VkDescriptorType[totalCount]; + pNewNode->descriptorTypes.reserve(totalCount); uint32_t offset = 0; uint32_t j = 0; for (uint32_t i=0; icount; i++) { for (j = 0; j < pCreateInfo->pBinding[i].arraySize; j++) { - pNewNode->pTypes[offset + j] = pCreateInfo->pBinding[i].descriptorType; + pNewNode->descriptorTypes[offset + j] = pCreateInfo->pBinding[i].descriptorType; } offset += j; } @@ -1854,7 +1852,16 @@ VkResult VKAPI vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCre layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); VkResult result = dev_data->device_dispatch_table->CreatePipelineLayout(device, pCreateInfo, pPipelineLayout); if (VK_SUCCESS == result) { - // TODO : Need to capture the pipeline layout + PIPELINE_LAYOUT_NODE plNode = dev_data->pipelineLayoutMap[pPipelineLayout->handle]; + plNode.descriptorSetLayouts.reserve(pCreateInfo->descriptorSetCount); + uint32_t i = 0; + for (i=0; idescriptorSetCount; ++i) { + plNode.descriptorSetLayouts[i] = pCreateInfo->pSetLayouts[i]; + } + plNode.pushConstantRanges.reserve(pCreateInfo->pushConstantRangeCount); + for (i=0; ipushConstantRangeCount; ++i) { + plNode.pushConstantRanges[i] = pCreateInfo->pPushConstantRanges[i]; + } } return result; } diff --git a/layers/draw_state.h b/layers/draw_state.h index 2328936..c4acd8d 100755 --- a/layers/draw_state.h +++ b/layers/draw_state.h @@ -144,11 +144,17 @@ typedef struct _BUFFER_NODE { // Layout Node has the core layout data typedef struct _LAYOUT_NODE { VkDescriptorSetLayout layout; - VkDescriptorType* pTypes; // Dynamic array that will be created to verify descriptor types VkDescriptorSetLayoutCreateInfo createInfo; uint32_t startIndex; // 1st index of this layout uint32_t endIndex; // last index of this layout + vector descriptorTypes; // Type per descriptor in this layout to verify correct updates } LAYOUT_NODE; +// Store layouts and pushconstants for PipelineLayout +struct PIPELINE_LAYOUT_NODE { + vector descriptorSetLayouts; + vector pushConstantRanges; +}; + typedef struct _SET_NODE { VkDescriptorSet set; VkDescriptorPool pool;