diff options
author | Tobin Ehlis <tobine@google.com> | 2016-10-20 06:50:37 -0600 |
---|---|---|
committer | Tobin Ehlis <tobine@google.com> | 2016-10-25 21:15:48 -0600 |
commit | d31a44af6da568692a73201825459689c9431867 (patch) | |
tree | fefb80ee84b52a55f38a34f6d8217d9d37c220a7 | |
parent | 806095ea973371ad4c82bd0c2c58d53cc5557f0b (diff) | |
download | vulkan-validation-layers-d31a44af6da568692a73201825459689c9431867.tar.gz |
layers:Rename SAMPLER_NODE->SAMPLER_STATE
-rw-r--r-- | layers/core_validation.cpp | 25 | ||||
-rw-r--r-- | layers/core_validation_types.h | 8 | ||||
-rw-r--r-- | layers/descriptor_sets.cpp | 14 |
3 files changed, 24 insertions, 23 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index eb95719b9..968ab2c8a 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -137,7 +137,7 @@ struct layer_data { // Global set of all cmdBuffers that are inFlight on this device unordered_set<VkCommandBuffer> globalInFlightCmdBuffers; // Layer specific data - unordered_map<VkSampler, unique_ptr<SAMPLER_NODE>> samplerMap; + unordered_map<VkSampler, unique_ptr<SAMPLER_STATE>> samplerMap; unordered_map<VkImageView, unique_ptr<IMAGE_VIEW_STATE>> imageViewMap; unordered_map<VkImage, unique_ptr<IMAGE_STATE>> imageMap; unordered_map<VkBufferView, unique_ptr<BUFFER_VIEW_STATE>> bufferViewMap; @@ -284,7 +284,7 @@ IMAGE_VIEW_STATE *getImageViewState(const layer_data *dev_data, VkImageView imag return iv_it->second.get(); } // Return sampler node ptr for specified sampler or else NULL -SAMPLER_NODE *getSamplerNode(const layer_data *dev_data, VkSampler sampler) { +SAMPLER_STATE *getSamplerState(const layer_data *dev_data, VkSampler sampler) { auto sampler_it = dev_data->samplerMap.find(sampler); if (sampler_it == dev_data->samplerMap.end()) { return nullptr; @@ -594,9 +594,10 @@ static bool update_cmd_buf_and_mem_references(layer_data *dev_data, const VkComm } // Create binding link between given sampler and command buffer node -void AddCommandBufferBindingSampler(GLOBAL_CB_NODE *cb_node, SAMPLER_NODE *sampler_node) { - sampler_node->cb_bindings.insert(cb_node); - cb_node->object_bindings.insert({reinterpret_cast<uint64_t &>(sampler_node->sampler), VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT}); +void AddCommandBufferBindingSampler(GLOBAL_CB_NODE *cb_node, SAMPLER_STATE *sampler_state) { + sampler_state->cb_bindings.insert(cb_node); + cb_node->object_bindings.insert( + {reinterpret_cast<uint64_t &>(sampler_state->sampler), VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT}); } // Create binding link between given image node and command buffer node @@ -4060,7 +4061,7 @@ BASE_NODE *GetStateStructPtrFromObject(layer_data *dev_data, VK_OBJECT object_st break; } case VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT: { - base_ptr = getSamplerNode(dev_data, reinterpret_cast<VkSampler &>(object_struct.handle)); + base_ptr = getSamplerState(dev_data, reinterpret_cast<VkSampler &>(object_struct.handle)); break; } case VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT: { @@ -4676,7 +4677,7 @@ static bool ValidateAndIncrementBoundObjects(layer_data *dev_data, GLOBAL_CB_NOD break; } case VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT: { - base_obj = getSamplerNode(dev_data, reinterpret_cast<VkSampler &>(obj.handle)); + base_obj = getSamplerState(dev_data, reinterpret_cast<VkSampler &>(obj.handle)); error_code = DRAWSTATE_INVALID_SAMPLER; break; } @@ -6061,12 +6062,12 @@ DestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const Vk dev_data->dispatch_table.DestroyPipelineLayout(device, pipelineLayout, pAllocator); } -static bool PreCallValidateDestroySampler(layer_data *dev_data, VkSampler sampler, SAMPLER_NODE **sampler_state, +static bool PreCallValidateDestroySampler(layer_data *dev_data, VkSampler sampler, SAMPLER_STATE **sampler_state, VK_OBJECT *obj_struct) { if (dev_data->instance_data->disabled.destroy_sampler) return false; bool skip = false; - *sampler_state = getSamplerNode(dev_data, sampler); + *sampler_state = getSamplerState(dev_data, sampler); if (*sampler_state) { *obj_struct = {reinterpret_cast<uint64_t &>(sampler), VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT}; skip |= ValidateObjectNotInUse(dev_data, *sampler_state, *obj_struct, VALIDATION_ERROR_00837); @@ -6074,7 +6075,7 @@ static bool PreCallValidateDestroySampler(layer_data *dev_data, VkSampler sample return skip; } -static void PostCallRecordDestroySampler(layer_data *dev_data, VkSampler sampler, SAMPLER_NODE *sampler_state, +static void PostCallRecordDestroySampler(layer_data *dev_data, VkSampler sampler, SAMPLER_STATE *sampler_state, VK_OBJECT obj_struct) { // Any bound cmd buffers are now invalid invalidateCommandBuffers(sampler_state->cb_bindings, obj_struct); @@ -6084,7 +6085,7 @@ static void PostCallRecordDestroySampler(layer_data *dev_data, VkSampler sampler VKAPI_ATTR void VKAPI_CALL DestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator) { layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); - SAMPLER_NODE *sampler_state = nullptr; + SAMPLER_STATE *sampler_state = nullptr; VK_OBJECT obj_struct; std::unique_lock<std::mutex> lock(global_lock); bool skip = PreCallValidateDestroySampler(dev_data, sampler, &sampler_state, &obj_struct); @@ -6726,7 +6727,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSampler(VkDevice device, const VkSamplerCre VkResult result = dev_data->dispatch_table.CreateSampler(device, pCreateInfo, pAllocator, pSampler); if (VK_SUCCESS == result) { std::lock_guard<std::mutex> lock(global_lock); - dev_data->samplerMap[*pSampler] = unique_ptr<SAMPLER_NODE>(new SAMPLER_NODE(pSampler, pCreateInfo)); + dev_data->samplerMap[*pSampler] = unique_ptr<SAMPLER_STATE>(new SAMPLER_STATE(pSampler, pCreateInfo)); } return result; } diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h index 592d4911b..851ebf8cc 100644 --- a/layers/core_validation_types.h +++ b/layers/core_validation_types.h @@ -198,11 +198,11 @@ class BUFFER_VIEW_STATE : public BASE_NODE { BUFFER_VIEW_STATE(const BUFFER_VIEW_STATE &rh_obj) = delete; }; -struct SAMPLER_NODE : public BASE_NODE { +struct SAMPLER_STATE : public BASE_NODE { VkSampler sampler; VkSamplerCreateInfo createInfo; - SAMPLER_NODE(const VkSampler *ps, const VkSamplerCreateInfo *pci) : sampler(*ps), createInfo(*pci){}; + SAMPLER_STATE(const VkSampler *ps, const VkSamplerCreateInfo *pci) : sampler(*ps), createInfo(*pci){}; }; class IMAGE_STATE : public BINDABLE { @@ -637,14 +637,14 @@ BUFFER_NODE *getBufferNode(const layer_data *, VkBuffer); IMAGE_STATE *getImageState(const layer_data *, VkImage); DEVICE_MEM_INFO *getMemObjInfo(const layer_data *, VkDeviceMemory); BUFFER_VIEW_STATE *getBufferViewState(const layer_data *, VkBufferView); -SAMPLER_NODE *getSamplerNode(const layer_data *, VkSampler); +SAMPLER_STATE *getSamplerState(const layer_data *, VkSampler); IMAGE_VIEW_STATE *getImageViewState(const layer_data *, VkImageView); VkSwapchainKHR getSwapchainFromImage(const layer_data *, VkImage); SWAPCHAIN_NODE *getSwapchainNode(const layer_data *, VkSwapchainKHR); void invalidateCommandBuffers(std::unordered_set<GLOBAL_CB_NODE *>, VK_OBJECT); bool ValidateMemoryIsBoundToBuffer(const layer_data *, const BUFFER_NODE *, const char *); bool ValidateMemoryIsBoundToImage(const layer_data *, const IMAGE_STATE *, const char *); -void AddCommandBufferBindingSampler(GLOBAL_CB_NODE *, SAMPLER_NODE *); +void AddCommandBufferBindingSampler(GLOBAL_CB_NODE *, SAMPLER_STATE *); void AddCommandBufferBindingImage(const layer_data *, GLOBAL_CB_NODE *, IMAGE_STATE *); void AddCommandBufferBindingImageView(const layer_data *, GLOBAL_CB_NODE *, IMAGE_VIEW_STATE *); void AddCommandBufferBindingBuffer(const layer_data *, GLOBAL_CB_NODE *, BUFFER_NODE *); diff --git a/layers/descriptor_sets.cpp b/layers/descriptor_sets.cpp index 500957c0d..6c8be9c7b 100644 --- a/layers/descriptor_sets.cpp +++ b/layers/descriptor_sets.cpp @@ -689,7 +689,7 @@ cvdescriptorset::SamplerDescriptor::SamplerDescriptor(const VkSampler *immut) : } // Validate given sampler. Currently this only checks to make sure it exists in the samplerMap bool cvdescriptorset::ValidateSampler(const VkSampler sampler, const core_validation::layer_data *dev_data) { - return (getSamplerNode(dev_data, sampler) != nullptr); + return (getSamplerState(dev_data, sampler) != nullptr); } bool cvdescriptorset::ValidateImageUpdate(VkImageView image_view, VkImageLayout image_layout, VkDescriptorType type, @@ -874,9 +874,9 @@ void cvdescriptorset::SamplerDescriptor::CopyUpdate(const Descriptor *src) { void cvdescriptorset::SamplerDescriptor::BindCommandBuffer(const core_validation::layer_data *dev_data, GLOBAL_CB_NODE *cb_node) { if (!immutable_) { - auto sampler_node = getSamplerNode(dev_data, sampler_); - if (sampler_node) - core_validation::AddCommandBufferBindingSampler(cb_node, sampler_node); + auto sampler_state = getSamplerState(dev_data, sampler_); + if (sampler_state) + core_validation::AddCommandBufferBindingSampler(cb_node, sampler_state); } } @@ -921,9 +921,9 @@ void cvdescriptorset::ImageSamplerDescriptor::BindCommandBuffer(const core_valid GLOBAL_CB_NODE *cb_node) { // First add binding for any non-immutable sampler if (!immutable_) { - auto sampler_node = getSamplerNode(dev_data, sampler_); - if (sampler_node) - core_validation::AddCommandBufferBindingSampler(cb_node, sampler_node); + auto sampler_state = getSamplerState(dev_data, sampler_); + if (sampler_state) + core_validation::AddCommandBufferBindingSampler(cb_node, sampler_state); } // Add binding for image auto iv_state = getImageViewState(dev_data, image_view_); |