From 9eb0b524dace8b18bdf73d0dbb6966425a324daa Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 21 Jun 2016 13:04:18 +1200 Subject: layers: Move CMD_POOL_INFO to header, rename, add helper Signed-off-by: Chris Forbes --- layers/core_validation.cpp | 17 +++++++++-------- layers/core_validation.h | 8 ++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index c3308900..eb3ccc03 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -93,13 +93,6 @@ using std::unordered_set; // Object value will be used to identify them internally. static const VkDeviceMemory MEMTRACKER_SWAP_CHAIN_IMAGE_KEY = (VkDeviceMemory)(-1); -// Track command pools and their command buffers -struct CMD_POOL_INFO { - VkCommandPoolCreateFlags createFlags; - uint32_t queueFamilyIndex; - list commandBuffers; // list container of cmd buffers allocated from this pool -}; - struct devExts { bool wsi_enabled; unordered_map> swapchainMap; @@ -129,7 +122,7 @@ struct layer_data { unordered_map> bufferViewMap; unordered_map> bufferMap; unordered_map pipelineMap; - unordered_map commandPoolMap; + unordered_map commandPoolMap; unordered_map descriptorPoolMap; unordered_map setMap; unordered_map descriptorSetLayoutMap; @@ -342,6 +335,14 @@ SEMAPHORE_NODE *getSemaphoreNode(layer_data *dev_data, VkSemaphore semaphore) { return &it->second; } +COMMAND_POOL_NODE *getCommandPoolNode(layer_data *dev_data, VkCommandPool pool) { + auto it = dev_data->commandPoolMap.find(pool); + if (it == dev_data->commandPoolMap.end()) { + return nullptr; + } + return &it->second; +} + static VkDeviceMemory *get_object_mem_binding(layer_data *my_data, uint64_t handle, VkDebugReportObjectTypeEXT type) { switch (type) { case VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT: { diff --git a/layers/core_validation.h b/layers/core_validation.h index fe5a3d57..93c7e6e7 100644 --- a/layers/core_validation.h +++ b/layers/core_validation.h @@ -268,3 +268,11 @@ typedef struct stencil_data { uint32_t writeMask; uint32_t reference; } CBStencilData; + +// Track command pools and their command buffers +struct COMMAND_POOL_NODE { + VkCommandPoolCreateFlags createFlags; + uint32_t queueFamilyIndex; + // TODO: why is this std::list? + std::list commandBuffers; // container of cmd buffers allocated from this pool +}; -- cgit v1.2.3