diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-06-01 11:33:50 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-06-02 09:54:34 -0600 |
| commit | 2f68b290d22d933fda156e0101bb2ebf2f493c04 (patch) | |
| tree | 118492f55a3bc5bf4c7cec77b862233d76ec5205 /layers/core_validation.cpp | |
| parent | 2fc91e01eeb0cec1b03332570c5eebe0d380a305 (diff) | |
| download | usermoji-2f68b290d22d933fda156e0101bb2ebf2f493c04.tar.xz | |
layers: Pass common data between pre/post AllocDescriptorSets
With the break between PreValidate* and PostRecord* calls in the layers
we can suffer having to do some repeat work in the Post step. In order
to prevent this, this CL slightly modifies the interface to pass common
data between the pre/post calls in a custom AllocateDescriptorSetsData
struct.
I initially attempted to fill this data in a separate function that
would preceed the PreValidate* call, but such a function would need to
include some validation as it includes map checks which may fail.
The simplest solution, then, seems to be passing a ptr to the common
data to the PreValidate* function who then fills the data. If the
validation and call down the chain succeed, the PostRecord* function
then takes a ptr to the common data to prevent having to redo the
work that was done at validation time.
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index e7201a7d..21d3b077 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -5869,26 +5869,30 @@ ResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescript // Ensure the pool contains enough descriptors and descriptor sets to satisfy // an allocation request. Fills requiredDescriptorsByType with the total number // of descriptors of each type required, for later update. -static bool PreCallValidateAllocateDescriptorSets(layer_data *dev_data, const VkDescriptorSetAllocateInfo *pAllocateInfo) { +static bool PreCallValidateAllocateDescriptorSets(layer_data *dev_data, const VkDescriptorSetAllocateInfo *pAllocateInfo, + cvdescriptorset::AllocateDescriptorSetsData *common_data) { // All state checks for AllocateDescriptorSets is done in single function return cvdescriptorset::ValidateAllocateDescriptorSets(dev_data->report_data, pAllocateInfo, dev_data->descriptorSetLayoutMap, - dev_data->descriptorPoolMap); + dev_data->descriptorPoolMap, common_data); } // Allocation state was good and call down chain was made so update state based on allocating descriptor sets static void PostCallRecordAllocateDescriptorSets(layer_data *dev_data, const VkDescriptorSetAllocateInfo *pAllocateInfo, - VkDescriptorSet *pDescriptorSets) { + VkDescriptorSet *pDescriptorSets, + const cvdescriptorset::AllocateDescriptorSetsData *common_data) { // All the updates are contained in a single cvdescriptorset function cvdescriptorset::PerformAllocateDescriptorSets( - pAllocateInfo, pDescriptorSets, &dev_data->descriptorPoolMap, &dev_data->setMap, dev_data->descriptorSetLayoutMap, - dev_data->bufferMap, dev_data->memObjMap, dev_data->bufferViewMap, dev_data->samplerMap, dev_data->imageViewMap, - dev_data->imageMap, dev_data->device_extensions.imageToSwapchainMap, dev_data->device_extensions.swapchainMap); + pAllocateInfo, pDescriptorSets, common_data, &dev_data->descriptorPoolMap, &dev_data->setMap, + dev_data->descriptorSetLayoutMap, dev_data->bufferMap, dev_data->memObjMap, dev_data->bufferViewMap, dev_data->samplerMap, + dev_data->imageViewMap, dev_data->imageMap, dev_data->device_extensions.imageToSwapchainMap, + dev_data->device_extensions.swapchainMap); } VKAPI_ATTR VkResult VKAPI_CALL AllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, VkDescriptorSet *pDescriptorSets) { layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); std::unique_lock<std::mutex> lock(global_lock); - bool skip_call = PreCallValidateAllocateDescriptorSets(dev_data, pAllocateInfo); + cvdescriptorset::AllocateDescriptorSetsData common_data(pAllocateInfo->descriptorSetCount); + bool skip_call = PreCallValidateAllocateDescriptorSets(dev_data, pAllocateInfo, &common_data); lock.unlock(); if (skip_call) @@ -5898,7 +5902,7 @@ AllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllo if (VK_SUCCESS == result) { lock.lock(); - PostCallRecordAllocateDescriptorSets(dev_data, pAllocateInfo, pDescriptorSets); + PostCallRecordAllocateDescriptorSets(dev_data, pAllocateInfo, pDescriptorSets, &common_data); lock.unlock(); } return result; |
