diff options
| author | Chris Forbes <chrisforbes@google.com> | 2017-06-26 17:57:39 -0700 |
|---|---|---|
| committer | Chris Forbes <chrisf@ijw.co.nz> | 2017-06-27 09:41:32 -0700 |
| commit | 21baabc6f066b9470b7c7a6c49576c4e33c7ad22 (patch) | |
| tree | 867e873cfca18d38c9080d194218f8c6476978ff | |
| parent | 4d0fce1bdc0e74b80899763d6c7eab5b2dd57dea (diff) | |
| download | usermoji-21baabc6f066b9470b7c7a6c49576c4e33c7ad22.tar.xz | |
layers: Don't copy all the image subresources every submit
The set of subresources touched by this submission is likely to be very
small compared to the complete set we're tracking. It doesn't make any
sense to copy this entire hashtable in each submit call.
Instead, maintain an overlay table with the submission's modifications
in it.
Saves approx 12s in an internal workload.
| -rw-r--r-- | layers/buffer_validation.cpp | 8 | ||||
| -rw-r--r-- | layers/buffer_validation.h | 3 | ||||
| -rw-r--r-- | layers/core_validation.cpp | 4 |
3 files changed, 9 insertions, 6 deletions
diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index 7739fe08..6f4440b4 100644 --- a/layers/buffer_validation.cpp +++ b/layers/buffer_validation.cpp @@ -2466,13 +2466,15 @@ void PreCallRecordCmdBlitImage(layer_data *device_data, GLOBAL_CB_NODE *cb_node, // the IMAGE is the same // as the global IMAGE layout bool ValidateCmdBufImageLayouts(layer_data *device_data, GLOBAL_CB_NODE *pCB, - std::unordered_map<ImageSubresourcePair, IMAGE_LAYOUT_NODE> &imageLayoutMap) { + std::unordered_map<ImageSubresourcePair, IMAGE_LAYOUT_NODE> const & globalImageLayoutMap, + std::unordered_map<ImageSubresourcePair, IMAGE_LAYOUT_NODE> & overlayLayoutMap) { bool skip = false; const debug_report_data *report_data = core_validation::GetReportData(device_data); for (auto cb_image_data : pCB->imageLayoutMap) { VkImageLayout imageLayout; - if (FindLayout(imageLayoutMap, cb_image_data.first, imageLayout)) { + if (FindLayout(overlayLayoutMap, cb_image_data.first, imageLayout) || + FindLayout(globalImageLayoutMap, cb_image_data.first, imageLayout)) { if (cb_image_data.second.initialLayout == VK_IMAGE_LAYOUT_UNDEFINED) { // TODO: Set memory invalid which is in mem_tracker currently } else if (imageLayout != cb_image_data.second.initialLayout) { @@ -2495,7 +2497,7 @@ bool ValidateCmdBufImageLayouts(layer_data *device_data, GLOBAL_CB_NODE *pCB, string_VkImageLayout(cb_image_data.second.initialLayout)); } } - SetLayout(imageLayoutMap, cb_image_data.first, cb_image_data.second.layout); + SetLayout(overlayLayoutMap, cb_image_data.first, cb_image_data.second.layout); } } return skip; diff --git a/layers/buffer_validation.h b/layers/buffer_validation.h index 48eacaea..a9b2b385 100644 --- a/layers/buffer_validation.h +++ b/layers/buffer_validation.h @@ -153,7 +153,8 @@ void PreCallRecordCmdBlitImage(layer_data *device_data, GLOBAL_CB_NODE *cb_node, IMAGE_STATE *dst_image_state); bool ValidateCmdBufImageLayouts(layer_data *device_data, GLOBAL_CB_NODE *pCB, - std::unordered_map<ImageSubresourcePair, IMAGE_LAYOUT_NODE> &imageLayoutMap); + std::unordered_map<ImageSubresourcePair, IMAGE_LAYOUT_NODE> const &globalImageLayoutMap, + std::unordered_map<ImageSubresourcePair, IMAGE_LAYOUT_NODE> &overlayLayoutMap); void UpdateCmdBufImageLayouts(layer_data *device_data, GLOBAL_CB_NODE *pCB); diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 046f9c9f..9450278c 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -2633,7 +2633,7 @@ static bool PreCallValidateQueueSubmit(layer_data *dev_data, VkQueue queue, uint unordered_set<VkSemaphore> signaled_semaphores; unordered_set<VkSemaphore> unsignaled_semaphores; vector<VkCommandBuffer> current_cmds; - unordered_map<ImageSubresourcePair, IMAGE_LAYOUT_NODE> localImageLayoutMap = dev_data->imageLayoutMap; + unordered_map<ImageSubresourcePair, IMAGE_LAYOUT_NODE> localImageLayoutMap; // Now verify each individual submit for (uint32_t submit_idx = 0; submit_idx < submitCount; submit_idx++) { const VkSubmitInfo *submit = &pSubmits[submit_idx]; @@ -2674,7 +2674,7 @@ static bool PreCallValidateQueueSubmit(layer_data *dev_data, VkQueue queue, uint for (uint32_t i = 0; i < submit->commandBufferCount; i++) { auto cb_node = GetCBNode(dev_data, submit->pCommandBuffers[i]); if (cb_node) { - skip |= ValidateCmdBufImageLayouts(dev_data, cb_node, localImageLayoutMap); + skip |= ValidateCmdBufImageLayouts(dev_data, cb_node, dev_data->imageLayoutMap, localImageLayoutMap); current_cmds.push_back(submit->pCommandBuffers[i]); skip |= validatePrimaryCommandBufferState( dev_data, cb_node, (int)std::count(current_cmds.begin(), current_cmds.end(), submit->pCommandBuffers[i])); |
