diff options
| author | Tobin Ehlis <tobine@google.com> | 2016-07-20 13:27:33 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-07-21 06:45:08 -0600 |
| commit | efff6e216a25b8d63deb2f00c92dfb733277bca7 (patch) | |
| tree | c2151290b625589fdd07080b906063f60ff6a3f3 /layers | |
| parent | 10ae364a610b38546917985c248e952a8b97c6b4 (diff) | |
| download | usermoji-efff6e216a25b8d63deb2f00c92dfb733277bca7.tar.xz | |
layers: Refactor buffer/image validation functions
Add some consts and put fwd decls in core_validation_types.h so that these
can be used by descriptor_set class.
Diffstat (limited to 'layers')
| -rw-r--r-- | layers/core_validation.cpp | 16 | ||||
| -rw-r--r-- | layers/core_validation_types.h | 3 |
2 files changed, 10 insertions, 9 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 6dc24bfb..8ee80870 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -693,28 +693,28 @@ static bool clear_object_binding(layer_data *dev_data, uint64_t handle, VkDebugR } // Check to see if memory was ever bound to this image -static bool ValidateMemoryIsBoundToImage(layer_data *dev_data, IMAGE_NODE *image_node, const char *api_name) { +bool ValidateMemoryIsBoundToImage(const layer_data *dev_data, const IMAGE_NODE *image_node, const char *api_name) { bool result = false; if (0 == (static_cast<uint32_t>(image_node->createInfo.flags) & VK_IMAGE_CREATE_SPARSE_BINDING_BIT)) { if (0 == image_node->mem) { result = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - reinterpret_cast<uint64_t &>(image_node->image), __LINE__, MEMTRACK_OBJECT_NOT_BOUND, "MEM", - "%s: VkImage object 0x%" PRIxLEAST64 " used without first calling vkBindImageMemory.", api_name, - reinterpret_cast<uint64_t &>(image_node->image)); + reinterpret_cast<const uint64_t &>(image_node->image), __LINE__, MEMTRACK_OBJECT_NOT_BOUND, "MEM", + "%s: VkImage object 0x%" PRIxLEAST64 " used without first calling vkBindImageMemory.", api_name, + reinterpret_cast<const uint64_t &>(image_node->image)); } } return result; } // Check to see if memory was bound to this buffer -static bool ValidateMemoryIsBoundToBuffer(layer_data *dev_data, BUFFER_NODE *buffer_node, const char *api_name) { +bool ValidateMemoryIsBoundToBuffer(const layer_data *dev_data, const BUFFER_NODE *buffer_node, const char *api_name) { bool result = false; if (0 == (static_cast<uint32_t>(buffer_node->createInfo.flags) & VK_IMAGE_CREATE_SPARSE_BINDING_BIT)) { if (0 == buffer_node->mem) { result = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, - reinterpret_cast<uint64_t &>(buffer_node->buffer), __LINE__, MEMTRACK_OBJECT_NOT_BOUND, "MEM", - "%s: VkBuffer object 0x%" PRIxLEAST64 " used without first calling vkBindBufferMemory.", api_name, - reinterpret_cast<uint64_t &>(buffer_node->buffer)); + reinterpret_cast<const uint64_t &>(buffer_node->buffer), __LINE__, MEMTRACK_OBJECT_NOT_BOUND, "MEM", + "%s: VkBuffer object 0x%" PRIxLEAST64 " used without first calling vkBindBufferMemory.", api_name, + reinterpret_cast<const uint64_t &>(buffer_node->buffer)); } } return result; diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h index 69b3f2a4..e7ee5686 100644 --- a/layers/core_validation_types.h +++ b/layers/core_validation_types.h @@ -538,7 +538,7 @@ struct CB_SUBMISSION { std::vector<VkSemaphore> semaphores; }; -// Fwd declarations of layer_data and helpers to look-up state from layer_data maps +// Fwd declarations of layer_data and helpers to look-up/validate state from layer_data maps namespace core_validation { struct layer_data; cvdescriptorset::DescriptorSet *getSetNode(const layer_data *, VkDescriptorSet); @@ -553,6 +553,7 @@ VkImageViewCreateInfo *getImageViewData(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 *); } #endif // CORE_VALIDATION_TYPES_H_ |
