From f6a1232fbcbfe7af4974f70b0014c8b72a362633 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Thu, 2 Jun 2016 09:43:11 -0600 Subject: layers: Add getBufferViewInfo() helper Add helper function to core_validation for bufferViewMap look-ups and use the helper in DescriptorSet class. --- layers/core_validation.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 571cb009..844503dc 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -126,7 +126,7 @@ struct layer_data { unordered_map> samplerMap; unordered_map imageViewMap; unordered_map imageMap; - unordered_map bufferViewMap; + unordered_map> bufferViewMap; unordered_map> bufferMap; unordered_map pipelineMap; unordered_map commandPoolMap; @@ -269,6 +269,14 @@ BUFFER_NODE *getBufferNode(const layer_data *my_data, const VkBuffer buffer) { } return buff_it->second.get(); } +// Return buffer node ptr for specified buffer or else NULL +VkBufferViewCreateInfo *getBufferViewInfo(const layer_data *my_data, const VkBufferView buffer_view) { + auto bv_it = my_data->bufferViewMap.find(buffer_view); + if (bv_it == my_data->bufferViewMap.end()) { + return nullptr; + } + return bv_it->second.get(); +} static VkDeviceMemory *get_object_mem_binding(layer_data *my_data, uint64_t handle, VkDebugReportObjectTypeEXT type) { switch (type) { @@ -5420,7 +5428,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateBufferView(VkDevice device, const VkBufferV VkResult result = dev_data->device_dispatch_table->CreateBufferView(device, pCreateInfo, pAllocator, pView); if (VK_SUCCESS == result) { std::lock_guard lock(global_lock); - dev_data->bufferViewMap[*pView] = VkBufferViewCreateInfo(*pCreateInfo); + dev_data->bufferViewMap[*pView] = unique_ptr(new VkBufferViewCreateInfo(*pCreateInfo)); // In order to create a valid buffer view, the buffer must have been created with at least one of the // following flags: UNIFORM_TEXEL_BUFFER_BIT or STORAGE_TEXEL_BUFFER_BIT validate_buffer_usage_flags(dev_data, pCreateInfo->buffer, @@ -5877,7 +5885,7 @@ static void PostCallRecordAllocateDescriptorSets(layer_data *dev_data, const VkD // All the updates are contained in a single cvdescriptorset function cvdescriptorset::PerformAllocateDescriptorSets( pAllocateInfo, pDescriptorSets, common_data, &dev_data->descriptorPoolMap, &dev_data->setMap, dev_data, - dev_data->descriptorSetLayoutMap, dev_data->bufferViewMap, dev_data->samplerMap, dev_data->imageViewMap, dev_data->imageMap, + dev_data->descriptorSetLayoutMap, dev_data->samplerMap, dev_data->imageViewMap, dev_data->imageMap, dev_data->device_extensions.imageToSwapchainMap, dev_data->device_extensions.swapchainMap); } -- cgit v1.2.3