diff options
| author | Mark Lobodzinski <mark@lunarg.com> | 2017-04-13 11:10:11 -0600 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2017-04-22 20:04:39 -0600 |
| commit | 706a5017ea15b7e40dadc0adec47eae12de53988 (patch) | |
| tree | b7429b26b121de5e8b9110940ec15109cace120e /layers/core_validation.cpp | |
| parent | 0f91d1a89fb4ae9d97b3d9e5074f37adb16aebf4 (diff) | |
| download | usermoji-706a5017ea15b7e40dadc0adec47eae12de53988.tar.xz | |
layers: Switch CV over to layer object types
Convert internal uses of VkDebugReportObjectTypeEXT for the core-
validation layer to use the internal layer-povided object-type.
Also modified tests for changed error text.
Change-Id: If080f4bf452ead0c6fecc648309bfd95b27fc0ce
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 132 |
1 files changed, 64 insertions, 68 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 15656eec..6218d146 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -407,11 +407,11 @@ SURFACE_STATE *GetSurfaceState(instance_layer_data *instance_data, VkSurfaceKHR } // Return ptr to memory binding for given handle of specified type -static BINDABLE *GetObjectMemBinding(layer_data *dev_data, uint64_t handle, VkDebugReportObjectTypeEXT type) { +static BINDABLE *GetObjectMemBinding(layer_data *dev_data, uint64_t handle, VulkanObjectType type) { switch (type) { - case VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT: + case kVulkanObjectTypeImage: return GetImageState(dev_data, VkImage(handle)); - case VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT: + case kVulkanObjectTypeBuffer: return GetBufferState(dev_data, VkBuffer(handle)); default: break; @@ -480,8 +480,8 @@ static const char *object_type_to_string(VkDebugReportObjectTypeEXT type) { } // For given bound_object_handle, bound to given mem allocation, verify that the range for the bound object is valid -static bool ValidateMemoryIsValid(layer_data *dev_data, VkDeviceMemory mem, uint64_t bound_object_handle, - VkDebugReportObjectTypeEXT type, const char *functionName) { +static bool ValidateMemoryIsValid(layer_data *dev_data, VkDeviceMemory mem, uint64_t bound_object_handle, VulkanObjectType type, + const char *functionName) { DEVICE_MEM_INFO *mem_info = GetMemObjInfo(dev_data, mem); if (mem_info) { if (!mem_info->bound_ranges[bound_object_handle].valid) { @@ -489,7 +489,7 @@ static bool ValidateMemoryIsValid(layer_data *dev_data, VkDeviceMemory mem, uint reinterpret_cast<uint64_t &>(mem), __LINE__, MEMTRACK_INVALID_MEM_REGION, "MEM", "%s: Cannot read invalid region of memory allocation 0x%" PRIx64 " for bound %s object 0x%" PRIx64 ", please fill the memory before using.", - functionName, reinterpret_cast<uint64_t &>(mem), object_type_to_string(type), bound_object_handle); + functionName, reinterpret_cast<uint64_t &>(mem), object_string[type], bound_object_handle); } } return false; @@ -507,14 +507,14 @@ bool ValidateImageMemoryIsValid(layer_data *dev_data, IMAGE_STATE *image_state, } } else { return ValidateMemoryIsValid(dev_data, image_state->binding.mem, reinterpret_cast<uint64_t &>(image_state->image), - VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, functionName); + kVulkanObjectTypeImage, functionName); } return false; } // For given buffer_state, verify that the range it's bound to is valid bool ValidateBufferMemoryIsValid(layer_data *dev_data, BUFFER_STATE *buffer_state, const char *functionName) { return ValidateMemoryIsValid(dev_data, buffer_state->binding.mem, reinterpret_cast<uint64_t &>(buffer_state->buffer), - VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, functionName); + kVulkanObjectTypeBuffer, functionName); } // For the given memory allocation, set the range bound by the given handle object to the valid param value static void SetMemoryValid(layer_data *dev_data, VkDeviceMemory mem, uint64_t handle, bool valid) { @@ -564,7 +564,7 @@ static bool update_cmd_buf_and_mem_references(layer_data *dev_data, const VkComm 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}); + {reinterpret_cast<uint64_t &>(sampler_state->sampler), kVulkanObjectTypeSampler }); } // Create binding link between given image node and command buffer node @@ -581,7 +581,7 @@ void AddCommandBufferBindingImage(const layer_data *dev_data, GLOBAL_CB_NODE *cb } } // Now update cb binding for image - cb_node->object_bindings.insert({reinterpret_cast<uint64_t &>(image_state->image), VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT}); + cb_node->object_bindings.insert({reinterpret_cast<uint64_t &>(image_state->image), kVulkanObjectTypeImage }); image_state->cb_bindings.insert(cb_node); } } @@ -591,7 +591,7 @@ void AddCommandBufferBindingImageView(const layer_data *dev_data, GLOBAL_CB_NODE // First add bindings for imageView view_state->cb_bindings.insert(cb_node); cb_node->object_bindings.insert( - {reinterpret_cast<uint64_t &>(view_state->image_view), VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT}); + {reinterpret_cast<uint64_t &>(view_state->image_view), kVulkanObjectTypeImageView }); auto image_state = GetImageState(dev_data, view_state->create_info.image); // Add bindings for image within imageView if (image_state) { @@ -611,7 +611,7 @@ void AddCommandBufferBindingBuffer(const layer_data *dev_data, GLOBAL_CB_NODE *c } } // Now update cb binding for buffer - cb_node->object_bindings.insert({reinterpret_cast<uint64_t &>(buffer_state->buffer), VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT}); + cb_node->object_bindings.insert({reinterpret_cast<uint64_t &>(buffer_state->buffer), kVulkanObjectTypeBuffer }); buffer_state->cb_bindings.insert(cb_node); } @@ -620,7 +620,7 @@ void AddCommandBufferBindingBufferView(const layer_data *dev_data, GLOBAL_CB_NOD // First add bindings for bufferView view_state->cb_bindings.insert(cb_node); cb_node->object_bindings.insert( - {reinterpret_cast<uint64_t &>(view_state->buffer_view), VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT}); + {reinterpret_cast<uint64_t &>(view_state->buffer_view), kVulkanObjectTypeBufferView }); auto buffer_state = GetBufferState(dev_data, view_state->create_info.buffer); // Add bindings for buffer within bufferView if (buffer_state) { @@ -649,7 +649,7 @@ static void clear_cmd_buf_and_mem_references(layer_data *dev_data, const VkComma } // Clear a single object binding from given memory object, or report error if binding is missing -static bool ClearMemoryObjectBinding(layer_data *dev_data, uint64_t handle, VkDebugReportObjectTypeEXT type, VkDeviceMemory mem) { +static bool ClearMemoryObjectBinding(layer_data *dev_data, uint64_t handle, VulkanObjectType type, VkDeviceMemory mem) { DEVICE_MEM_INFO *mem_info = GetMemObjInfo(dev_data, mem); // This obj is bound to a memory object. Remove the reference to this object in that memory object's list if (mem_info) { @@ -661,7 +661,7 @@ static bool ClearMemoryObjectBinding(layer_data *dev_data, uint64_t handle, VkDe // ClearMemoryObjectBindings clears the binding of objects to memory // For the given object it pulls the memory bindings and makes sure that the bindings // no longer refer to the object being cleared. This occurs when objects are destroyed. -bool ClearMemoryObjectBindings(layer_data *dev_data, uint64_t handle, VkDebugReportObjectTypeEXT type) { +bool ClearMemoryObjectBindings(layer_data *dev_data, uint64_t handle, VulkanObjectType type) { bool skip = false; BINDABLE *mem_binding = GetObjectMemBinding(dev_data, handle, type); if (mem_binding) { @@ -720,8 +720,7 @@ bool ValidateMemoryIsBoundToBuffer(const layer_data *dev_data, const BUFFER_STAT // SetMemBinding is used to establish immutable, non-sparse binding between a single image/buffer object and memory object. // Corresponding valid usage checks are in ValidateSetMemBinding(). -static void SetMemBinding(layer_data *dev_data, VkDeviceMemory mem, uint64_t handle, VkDebugReportObjectTypeEXT type, - const char *apiName) { +static void SetMemBinding(layer_data *dev_data, VkDeviceMemory mem, uint64_t handle, VulkanObjectType type, const char *apiName) { if (mem != VK_NULL_HANDLE) { BINDABLE *mem_binding = GetObjectMemBinding(dev_data, handle, type); assert(mem_binding); @@ -730,7 +729,7 @@ static void SetMemBinding(layer_data *dev_data, VkDeviceMemory mem, uint64_t han mem_info->obj_bindings.insert({handle, type}); // For image objects, make sure default memory state is correctly set // TODO : What's the best/correct way to handle this? - if (VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT == type) { + if (kVulkanObjectTypeImage == type) { auto const image_state = GetImageState(dev_data, VkImage(handle)); if (image_state) { VkImageCreateInfo ici = image_state->createInfo; @@ -751,7 +750,7 @@ static void SetMemBinding(layer_data *dev_data, VkDeviceMemory mem, uint64_t han // Otherwise, add reference from objectInfo to memoryInfo // Add reference off of objInfo // TODO: We may need to refactor or pass in multiple valid usage statements to handle multiple valid usage conditions. -static bool ValidateSetMemBinding(layer_data *dev_data, VkDeviceMemory mem, uint64_t handle, VkDebugReportObjectTypeEXT type, +static bool ValidateSetMemBinding(layer_data *dev_data, VkDeviceMemory mem, uint64_t handle, VulkanObjectType type, const char *apiName) { bool skip_call = false; // It's an error to bind an object to NULL memory @@ -811,7 +810,7 @@ static bool ValidateSetMemBinding(layer_data *dev_data, VkDeviceMemory mem, uint // Add reference from objectInfo to memoryInfo // Add reference off of object's binding info // Return VK_TRUE if addition is successful, VK_FALSE otherwise -static bool SetSparseMemBinding(layer_data *dev_data, MEM_BINDING binding, uint64_t handle, VkDebugReportObjectTypeEXT type, +static bool SetSparseMemBinding(layer_data *dev_data, MEM_BINDING binding, uint64_t handle, VulkanObjectType type, const char *apiName) { bool skip_call = VK_FALSE; // Handle NULL case separately, just clear previous binding & decrement reference @@ -3497,9 +3496,9 @@ bool ValidateCmdQueueFlags(layer_data *dev_data, GLOBAL_CB_NODE *cb_node, const static bool ReportInvalidCommandBuffer(layer_data *dev_data, GLOBAL_CB_NODE *cb_state, const char *call_source) { bool skip = false; for (auto obj : cb_state->broken_bindings) { - const char *type_str = object_type_to_string(obj.type); + const char *type_str = object_string[obj.type]; // Descriptor sets are a special case that can be either destroyed or updated to invalidate a CB - const char *cause_str = (obj.type == VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT) ? "destroyed or updated" : "destroyed"; + const char *cause_str = (obj.type == kVulkanObjectTypeDescriptorSet) ? "destroyed or updated" : "destroyed"; skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t &>(cb_state->commandBuffer), __LINE__, DRAWSTATE_INVALID_COMMAND_BUFFER, "DS", "You are adding %s to command buffer 0x%p that is invalid because bound %s 0x%" PRIxLEAST64 " was %s.", @@ -4347,12 +4346,11 @@ bool ValidImageBufferQueue(layer_data *dev_data, GLOBAL_CB_NODE *cb_node, const } if (!found) { - auto type_string = (object->type == VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT ? "image" : "buffer"); - skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object->type, object->handle, __LINE__, - DRAWSTATE_INVALID_QUEUE_FAMILY, "DS", + skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, GetDebugReportEnum[object->type], object->handle, + __LINE__, DRAWSTATE_INVALID_QUEUE_FAMILY, "DS", "vkQueueSubmit: Command buffer 0x%" PRIxLEAST64 " contains %s 0x%" PRIxLEAST64 " which was not created allowing concurrent access to this queue family %d.", - reinterpret_cast<uint64_t>(cb_node->commandBuffer), type_string, object->handle, + reinterpret_cast<uint64_t>(cb_node->commandBuffer), object_string[object->type], object->handle, queue_state->queueFamilyIndex); } } @@ -4379,13 +4377,13 @@ static bool validateQueueFamilyIndices(layer_data *dev_data, GLOBAL_CB_NODE *pCB // Ensure that any bound images or buffers created with SHARING_MODE_CONCURRENT have access to the current queue family for (auto object : pCB->object_bindings) { - if (object.type == VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT) { + if (object.type == kVulkanObjectTypeImage) { auto image_state = GetImageState(dev_data, reinterpret_cast<VkImage &>(object.handle)); if (image_state && image_state->createInfo.sharingMode == VK_SHARING_MODE_CONCURRENT) { skip_call |= ValidImageBufferQueue(dev_data, pCB, &object, queue, image_state->createInfo.queueFamilyIndexCount, image_state->createInfo.pQueueFamilyIndices); } - } else if (object.type == VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT) { + } else if (object.type == kVulkanObjectTypeBuffer) { auto buffer_state = GetBufferState(dev_data, reinterpret_cast<VkBuffer &>(object.handle)); if (buffer_state && buffer_state->createInfo.sharingMode == VK_SHARING_MODE_CONCURRENT) { skip_call |= @@ -4663,16 +4661,17 @@ bool ValidateObjectNotInUse(const layer_data *dev_data, BASE_NODE *obj_node, VK_ if (dev_data->instance_data->disabled.object_in_use) return false; bool skip = false; if (obj_node->in_use.load()) { - skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, obj_struct.type, obj_struct.handle, __LINE__, - error_code, "DS", "Cannot delete %s 0x%" PRIx64 " that is currently in use by a command buffer. %s", - object_type_to_string(obj_struct.type), obj_struct.handle, validation_error_map[error_code]); + skip |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, GetDebugReportEnum[obj_struct.type], obj_struct.handle, + __LINE__, error_code, "DS", "Cannot delete %s 0x%" PRIx64 " that is currently in use by a command buffer. %s", + object_string[obj_struct.type], obj_struct.handle, validation_error_map[error_code]); } return skip; } static bool PreCallValidateFreeMemory(layer_data *dev_data, VkDeviceMemory mem, DEVICE_MEM_INFO **mem_info, VK_OBJECT *obj_struct) { *mem_info = GetMemObjInfo(dev_data, mem); - *obj_struct = {reinterpret_cast<uint64_t &>(mem), VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT}; + *obj_struct = {reinterpret_cast<uint64_t &>(mem), kVulkanObjectTypeDeviceMemory}; if (dev_data->instance_data->disabled.free_memory) return false; bool skip = false; if (*mem_info) { @@ -4684,17 +4683,17 @@ static bool PreCallValidateFreeMemory(layer_data *dev_data, VkDeviceMemory mem, static void PostCallRecordFreeMemory(layer_data *dev_data, VkDeviceMemory mem, DEVICE_MEM_INFO *mem_info, VK_OBJECT obj_struct) { // Clear mem binding for any bound objects for (auto obj : mem_info->obj_bindings) { - log_msg(dev_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, obj.type, obj.handle, __LINE__, MEMTRACK_FREED_MEM_REF, - "MEM", "VK Object 0x%" PRIxLEAST64 " still has a reference to mem obj 0x%" PRIxLEAST64, obj.handle, - (uint64_t)mem_info->mem); + log_msg(dev_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, GetDebugReportEnum[obj.type], obj.handle, __LINE__, + MEMTRACK_FREED_MEM_REF, "MEM", "VK Object 0x%" PRIxLEAST64 " still has a reference to mem obj 0x%" PRIxLEAST64, + obj.handle, (uint64_t)mem_info->mem); switch (obj.type) { - case VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT: { + case kVulkanObjectTypeImage: { auto image_state = GetImageState(dev_data, reinterpret_cast<VkImage &>(obj.handle)); assert(image_state); // Any destroyed images should already be removed from bindings image_state->binding.mem = MEMORY_UNBOUND; break; } - case VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT: { + case kVulkanObjectTypeBuffer: { auto buffer_state = GetBufferState(dev_data, reinterpret_cast<VkBuffer &>(obj.handle)); assert(buffer_state); // Any destroyed buffers should already be removed from bindings buffer_state->binding.mem = MEMORY_UNBOUND; @@ -5014,7 +5013,7 @@ VKAPI_ATTR VkResult VKAPI_CALL DeviceWaitIdle(VkDevice device) { static bool PreCallValidateDestroyFence(layer_data *dev_data, VkFence fence, FENCE_NODE **fence_node, VK_OBJECT *obj_struct) { *fence_node = GetFenceNode(dev_data, fence); - *obj_struct = {reinterpret_cast<uint64_t &>(fence), VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT}; + *obj_struct = {reinterpret_cast<uint64_t &>(fence), kVulkanObjectTypeFence}; if (dev_data->instance_data->disabled.destroy_fence) return false; bool skip = false; if (*fence_node) { @@ -5048,7 +5047,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyFence(VkDevice device, VkFence fence, const Vk static bool PreCallValidateDestroySemaphore(layer_data *dev_data, VkSemaphore semaphore, SEMAPHORE_NODE **sema_node, VK_OBJECT *obj_struct) { *sema_node = GetSemaphoreNode(dev_data, semaphore); - *obj_struct = {reinterpret_cast<uint64_t &>(semaphore), VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT}; + *obj_struct = {reinterpret_cast<uint64_t &>(semaphore), kVulkanObjectTypeSemaphore}; if (dev_data->instance_data->disabled.destroy_semaphore) return false; bool skip = false; if (*sema_node) { @@ -5075,7 +5074,7 @@ VKAPI_ATTR void VKAPI_CALL DestroySemaphore(VkDevice device, VkSemaphore semapho static bool PreCallValidateDestroyEvent(layer_data *dev_data, VkEvent event, EVENT_STATE **event_state, VK_OBJECT *obj_struct) { *event_state = GetEventNode(dev_data, event); - *obj_struct = {reinterpret_cast<uint64_t &>(event), VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT}; + *obj_struct = {reinterpret_cast<uint64_t &>(event), kVulkanObjectTypeEvent}; if (dev_data->instance_data->disabled.destroy_event) return false; bool skip = false; if (*event_state) { @@ -5108,7 +5107,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyEvent(VkDevice device, VkEvent event, const Vk static bool PreCallValidateDestroyQueryPool(layer_data *dev_data, VkQueryPool query_pool, QUERY_POOL_NODE **qp_state, VK_OBJECT *obj_struct) { *qp_state = GetQueryPoolNode(dev_data, query_pool); - *obj_struct = {reinterpret_cast<uint64_t &>(query_pool), VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT}; + *obj_struct = {reinterpret_cast<uint64_t &>(query_pool), kVulkanObjectTypeQueryPool}; if (dev_data->instance_data->disabled.destroy_query_pool) return false; bool skip = false; if (*qp_state) { @@ -5504,7 +5503,7 @@ static bool PreCallValidateBindBufferMemory(layer_data *dev_data, VkBuffer buffe std::unique_lock<std::mutex> lock(global_lock); // Track objects tied to memory uint64_t buffer_handle = reinterpret_cast<uint64_t &>(buffer); - skip = ValidateSetMemBinding(dev_data, mem, buffer_handle, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, "vkBindBufferMemory()"); + skip = ValidateSetMemBinding(dev_data, mem, buffer_handle, kVulkanObjectTypeBuffer, "vkBindBufferMemory()"); if (!buffer_state->memory_requirements_checked) { // There's not an explicit requirement in the spec to call vkGetBufferMemoryRequirements() prior to calling // BindBufferMemory, but it's implied in that memory being bound must conform with VkMemoryRequirements from @@ -5601,7 +5600,7 @@ static void PostCallRecordBindBufferMemory(layer_data *dev_data, VkBuffer buffer // Track objects tied to memory uint64_t buffer_handle = reinterpret_cast<uint64_t &>(buffer); - SetMemBinding(dev_data, mem, buffer_handle, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, "vkBindBufferMemory()"); + SetMemBinding(dev_data, mem, buffer_handle, kVulkanObjectTypeBuffer, "vkBindBufferMemory()"); buffer_state->binding.mem = mem; buffer_state->binding.offset = memoryOffset; @@ -5675,7 +5674,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyShaderModule(VkDevice device, VkShaderModule s static bool PreCallValidateDestroyPipeline(layer_data *dev_data, VkPipeline pipeline, PIPELINE_STATE **pipeline_state, VK_OBJECT *obj_struct) { *pipeline_state = getPipelineState(dev_data, pipeline); - *obj_struct = {reinterpret_cast<uint64_t &>(pipeline), VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT}; + *obj_struct = {reinterpret_cast<uint64_t &>(pipeline), kVulkanObjectTypePipeline}; if (dev_data->instance_data->disabled.destroy_pipeline) return false; bool skip = false; if (*pipeline_state) { @@ -5720,7 +5719,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyPipelineLayout(VkDevice device, VkPipelineLayo static bool PreCallValidateDestroySampler(layer_data *dev_data, VkSampler sampler, SAMPLER_STATE **sampler_state, VK_OBJECT *obj_struct) { *sampler_state = GetSamplerState(dev_data, sampler); - *obj_struct = {reinterpret_cast<uint64_t &>(sampler), VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT}; + *obj_struct = {reinterpret_cast<uint64_t &>(sampler), kVulkanObjectTypeSampler}; if (dev_data->instance_data->disabled.destroy_sampler) return false; bool skip = false; if (*sampler_state) { @@ -5767,7 +5766,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyDescriptorSetLayout(VkDevice device, VkDescrip static bool PreCallValidateDestroyDescriptorPool(layer_data *dev_data, VkDescriptorPool pool, DESCRIPTOR_POOL_STATE **desc_pool_state, VK_OBJECT *obj_struct) { *desc_pool_state = GetDescriptorPoolState(dev_data, pool); - *obj_struct = {reinterpret_cast<uint64_t &>(pool), VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT}; + *obj_struct = {reinterpret_cast<uint64_t &>(pool), kVulkanObjectTypeDescriptorPool}; if (dev_data->instance_data->disabled.destroy_descriptor_pool) return false; bool skip = false; if (*desc_pool_state) { @@ -6040,7 +6039,7 @@ void invalidateCommandBuffers(const layer_data *dev_data, std::unordered_set<GLO static bool PreCallValidateDestroyFramebuffer(layer_data *dev_data, VkFramebuffer framebuffer, FRAMEBUFFER_STATE **framebuffer_state, VK_OBJECT *obj_struct) { *framebuffer_state = GetFramebufferState(dev_data, framebuffer); - *obj_struct = {reinterpret_cast<uint64_t &>(framebuffer), VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT}; + *obj_struct = {reinterpret_cast<uint64_t &>(framebuffer), kVulkanObjectTypeFramebuffer}; if (dev_data->instance_data->disabled.destroy_framebuffer) return false; bool skip = false; if (*framebuffer_state) { @@ -6074,7 +6073,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyFramebuffer(VkDevice device, VkFramebuffer fra static bool PreCallValidateDestroyRenderPass(layer_data *dev_data, VkRenderPass render_pass, RENDER_PASS_STATE **rp_state, VK_OBJECT *obj_struct) { *rp_state = GetRenderPassState(dev_data, render_pass); - *obj_struct = {reinterpret_cast<uint64_t &>(render_pass), VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT}; + *obj_struct = {reinterpret_cast<uint64_t &>(render_pass), kVulkanObjectTypeRenderPass}; if (dev_data->instance_data->disabled.destroy_renderpass) return false; bool skip = false; if (*rp_state) { @@ -6854,7 +6853,7 @@ VKAPI_ATTR VkResult VKAPI_CALL AllocateCommandBuffers(VkDevice device, const VkC // Add bindings between the given cmd buffer & framebuffer and the framebuffer's children static void AddFramebufferBinding(layer_data *dev_data, GLOBAL_CB_NODE *cb_state, FRAMEBUFFER_STATE *fb_state) { addCommandBufferBinding(&fb_state->cb_bindings, - {reinterpret_cast<uint64_t &>(fb_state->framebuffer), VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT}, + {reinterpret_cast<uint64_t &>(fb_state->framebuffer), kVulkanObjectTypeFramebuffer}, cb_state); for (auto attachment : fb_state->attachments) { auto view_state = attachment.view_state; @@ -6865,7 +6864,7 @@ static void AddFramebufferBinding(layer_data *dev_data, GLOBAL_CB_NODE *cb_state if (rp_state) { addCommandBufferBinding( &rp_state->cb_bindings, - {reinterpret_cast<uint64_t &>(rp_state->renderPass), VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT}, cb_state); + {reinterpret_cast<uint64_t &>(rp_state->renderPass), kVulkanObjectTypeRenderPass}, cb_state); } } } @@ -7096,14 +7095,14 @@ VKAPI_ATTR void VKAPI_CALL CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipe validation_error_map[VALIDATION_ERROR_00600]); } addCommandBufferBinding(&pipe_state->cb_bindings, - {reinterpret_cast<uint64_t &>(pipeline), VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT}, cb_state); + {reinterpret_cast<uint64_t &>(pipeline), kVulkanObjectTypePipeline}, cb_state); if (VK_PIPELINE_BIND_POINT_GRAPHICS == pipelineBindPoint) { // Add binding for child renderpass auto rp_state = GetRenderPassState(dev_data, pipe_state->graphicsPipelineCI.renderPass); if (rp_state) { addCommandBufferBinding( &rp_state->cb_bindings, - {reinterpret_cast<uint64_t &>(rp_state->renderPass), VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT}, cb_state); + {reinterpret_cast<uint64_t &>(rp_state->renderPass), kVulkanObjectTypeRenderPass}, cb_state); } } } @@ -8052,7 +8051,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetEvent(VkCommandBuffer commandBuffer, VkEvent ev auto event_state = GetEventNode(dev_data, event); if (event_state) { addCommandBufferBinding(&event_state->cb_bindings, - {reinterpret_cast<uint64_t &>(event), VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT}, pCB); + {reinterpret_cast<uint64_t &>(event), kVulkanObjectTypeEvent}, pCB); event_state->cb_bindings.insert(pCB); } pCB->events.push_back(event); @@ -8083,7 +8082,7 @@ VKAPI_ATTR void VKAPI_CALL CmdResetEvent(VkCommandBuffer commandBuffer, VkEvent auto event_state = GetEventNode(dev_data, event); if (event_state) { addCommandBufferBinding(&event_state->cb_bindings, - {reinterpret_cast<uint64_t &>(event), VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT}, pCB); + {reinterpret_cast<uint64_t &>(event), kVulkanObjectTypeEvent}, pCB); event_state->cb_bindings.insert(pCB); } pCB->events.push_back(event); @@ -8416,7 +8415,7 @@ VKAPI_ATTR void VKAPI_CALL CmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t auto event_state = GetEventNode(dev_data, pEvents[i]); if (event_state) { addCommandBufferBinding(&event_state->cb_bindings, - {reinterpret_cast<const uint64_t &>(pEvents[i]), VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT}, + {reinterpret_cast<const uint64_t &>(pEvents[i]), kVulkanObjectTypeEvent}, cb_state); event_state->cb_bindings.insert(cb_state); } @@ -8530,7 +8529,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryP skip_call |= ValidateCmd(dev_data, pCB, CMD_BEGINQUERY, "vkCmdBeginQuery()"); UpdateCmdBufferLastCmd(pCB, CMD_BEGINQUERY); addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings, - {reinterpret_cast<uint64_t &>(queryPool), VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT}, pCB); + {reinterpret_cast<uint64_t &>(queryPool), kVulkanObjectTypeQueryPool}, pCB); } lock.unlock(); if (!skip_call) dev_data->dispatch_table.CmdBeginQuery(commandBuffer, queryPool, slot, flags); @@ -8558,7 +8557,7 @@ VKAPI_ATTR void VKAPI_CALL CmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPoo skip |= ValidateCmd(dev_data, cb_state, CMD_ENDQUERY, "VkCmdEndQuery()"); UpdateCmdBufferLastCmd(cb_state, CMD_ENDQUERY); addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings, - {reinterpret_cast<uint64_t &>(queryPool), VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT}, cb_state); + {reinterpret_cast<uint64_t &>(queryPool), kVulkanObjectTypeQueryPool}, cb_state); } lock.unlock(); if (!skip) dev_data->dispatch_table.CmdEndQuery(commandBuffer, queryPool, slot); @@ -8584,7 +8583,7 @@ VKAPI_ATTR void VKAPI_CALL CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQu UpdateCmdBufferLastCmd(cb_state, CMD_RESETQUERYPOOL); skip |= insideRenderPass(dev_data, cb_state, "vkCmdResetQueryPool()", VALIDATION_ERROR_01025); addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings, - {reinterpret_cast<uint64_t &>(queryPool), VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT}, cb_state); + {reinterpret_cast<uint64_t &>(queryPool), kVulkanObjectTypeQueryPool}, cb_state); } lock.unlock(); if (!skip) dev_data->dispatch_table.CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount); @@ -8654,7 +8653,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer UpdateCmdBufferLastCmd(cb_node, CMD_COPYQUERYPOOLRESULTS); skip |= insideRenderPass(dev_data, cb_node, "vkCmdCopyQueryPoolResults()", VALIDATION_ERROR_01074); addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings, - {reinterpret_cast<uint64_t &>(queryPool), VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT}, cb_node); + {reinterpret_cast<uint64_t &>(queryPool), kVulkanObjectTypeQueryPool}, cb_node); } else { assert(0); } @@ -10199,7 +10198,7 @@ static bool PreCallValidateBindImageMemory(layer_data *dev_data, VkImage image, std::unique_lock<std::mutex> lock(global_lock); // Track objects tied to memory uint64_t image_handle = reinterpret_cast<uint64_t &>(image); - skip = ValidateSetMemBinding(dev_data, mem, image_handle, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, "vkBindImageMemory()"); + skip = ValidateSetMemBinding(dev_data, mem, image_handle, kVulkanObjectTypeImage, "vkBindImageMemory()"); if (!image_state->memory_requirements_checked) { // There's not an explicit requirement in the spec to call vkGetImageMemoryRequirements() prior to calling // BindImageMemory but it's implied in that memory being bound must conform with VkMemoryRequirements from @@ -10263,7 +10262,7 @@ static void PostCallRecordBindImageMemory(layer_data *dev_data, VkImage image, I // Track objects tied to memory uint64_t image_handle = reinterpret_cast<uint64_t &>(image); - SetMemBinding(dev_data, mem, image_handle, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, "vkBindImageMemory()"); + SetMemBinding(dev_data, mem, image_handle, kVulkanObjectTypeImage, "vkBindImageMemory()"); image_state->binding.mem = mem; image_state->binding.offset = memoryOffset; @@ -10338,8 +10337,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(VkQueue queue, uint32_t bindInfoC for (uint32_t k = 0; k < bindInfo.pBufferBinds[j].bindCount; k++) { auto sparse_binding = bindInfo.pBufferBinds[j].pBinds[k]; if (SetSparseMemBinding(dev_data, {sparse_binding.memory, sparse_binding.memoryOffset, sparse_binding.size}, - (uint64_t)bindInfo.pBufferBinds[j].buffer, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, - "vkQueueBindSparse")) + (uint64_t)bindInfo.pBufferBinds[j].buffer, kVulkanObjectTypeBuffer, "vkQueueBindSparse")) skip_call = true; } } @@ -10347,8 +10345,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(VkQueue queue, uint32_t bindInfoC for (uint32_t k = 0; k < bindInfo.pImageOpaqueBinds[j].bindCount; k++) { auto sparse_binding = bindInfo.pImageOpaqueBinds[j].pBinds[k]; if (SetSparseMemBinding(dev_data, {sparse_binding.memory, sparse_binding.memoryOffset, sparse_binding.size}, - (uint64_t)bindInfo.pImageOpaqueBinds[j].image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - "vkQueueBindSparse")) + (uint64_t)bindInfo.pImageOpaqueBinds[j].image, kVulkanObjectTypeImage, "vkQueueBindSparse")) skip_call = true; } } @@ -10358,8 +10355,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(VkQueue queue, uint32_t bindInfoC // TODO: This size is broken for non-opaque bindings, need to update to comprehend full sparse binding data VkDeviceSize size = sparse_binding.extent.depth * sparse_binding.extent.height * sparse_binding.extent.width * 4; if (SetSparseMemBinding(dev_data, {sparse_binding.memory, sparse_binding.memoryOffset, size}, - (uint64_t)bindInfo.pImageBinds[j].image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, - "vkQueueBindSparse")) + (uint64_t)bindInfo.pImageBinds[j].image, kVulkanObjectTypeImage, "vkQueueBindSparse")) skip_call = true; } } @@ -10724,7 +10720,7 @@ VKAPI_ATTR void VKAPI_CALL DestroySwapchainKHR(VkDevice device, VkSwapchainKHR s dev_data->imageSubresourceMap.erase(image_sub); } skip_call = - ClearMemoryObjectBindings(dev_data, (uint64_t)swapchain_image, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT); + ClearMemoryObjectBindings(dev_data, (uint64_t)swapchain_image, kVulkanObjectTypeSwapchainKHR); dev_data->imageMap.erase(swapchain_image); } } |
