From 01423238d40332394ef968bc4073548e4037865f Mon Sep 17 00:00:00 2001 From: John Zulauf Date: Thu, 26 Apr 2018 16:30:39 -0600 Subject: layers: PreRecord Free/Destroy calls To avoid Destroy/Create and Free/Alloc race conditions (when a driver returns a destroyed(freed) handle between the PreCall and PostCall phases of a validation intercept routine, PostCallRecord functionality has been moved to PreCall. This affects the following calls FreeMemory DestroyFence DestroySemaphore DestroyEvent DestroyQueryPool DestroyBuffer DestroyBufferView DestroyImage DestroyImageView DestroyPipeline DestroySampler DestroyDescriptorSetLayout DestroyFramebuffer DestroyRenderPass FreeDescriptorSets Did not alter the destroy functions for Instance, Device, or the Debug or layer extensions. Change-Id: I5133982eaa1a0c94283fa922d9c3bcc90b5a6223 --- layers/buffer_validation.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'layers/buffer_validation.cpp') diff --git a/layers/buffer_validation.cpp b/layers/buffer_validation.cpp index d6f87865..101a9b48 100644 --- a/layers/buffer_validation.cpp +++ b/layers/buffer_validation.cpp @@ -887,7 +887,7 @@ bool PreCallValidateDestroyImage(layer_data *device_data, VkImage image, IMAGE_S return skip; } -void PostCallRecordDestroyImage(layer_data *device_data, VkImage image, IMAGE_STATE *image_state, VK_OBJECT obj_struct) { +void PreCallRecordDestroyImage(layer_data *device_data, VkImage image, IMAGE_STATE *image_state, VK_OBJECT obj_struct) { core_validation::invalidateCommandBuffers(device_data, image_state->cb_bindings, obj_struct); // Clean up memory mapping, bindings and range references for image for (auto mem_binding : image_state->GetBoundMemory()) { @@ -3647,8 +3647,8 @@ bool PreCallValidateDestroyImageView(layer_data *device_data, VkImageView image_ return skip; } -void PostCallRecordDestroyImageView(layer_data *device_data, VkImageView image_view, IMAGE_VIEW_STATE *image_view_state, - VK_OBJECT obj_struct) { +void PreCallRecordDestroyImageView(layer_data *device_data, VkImageView image_view, IMAGE_VIEW_STATE *image_view_state, + VK_OBJECT obj_struct) { // Any bound cmd buffers are now invalid invalidateCommandBuffers(device_data, image_view_state->cb_bindings, obj_struct); (*GetImageViewMap(device_data)).erase(image_view); @@ -3665,7 +3665,7 @@ bool PreCallValidateDestroyBuffer(layer_data *device_data, VkBuffer buffer, BUFF return skip; } -void PostCallRecordDestroyBuffer(layer_data *device_data, VkBuffer buffer, BUFFER_STATE *buffer_state, VK_OBJECT obj_struct) { +void PreCallRecordDestroyBuffer(layer_data *device_data, VkBuffer buffer, BUFFER_STATE *buffer_state, VK_OBJECT obj_struct) { invalidateCommandBuffers(device_data, buffer_state->cb_bindings, obj_struct); for (auto mem_binding : buffer_state->GetBoundMemory()) { auto mem_info = GetMemObjInfo(device_data, mem_binding); @@ -3690,8 +3690,8 @@ bool PreCallValidateDestroyBufferView(layer_data *device_data, VkBufferView buff return skip; } -void PostCallRecordDestroyBufferView(layer_data *device_data, VkBufferView buffer_view, BUFFER_VIEW_STATE *buffer_view_state, - VK_OBJECT obj_struct) { +void PreCallRecordDestroyBufferView(layer_data *device_data, VkBufferView buffer_view, BUFFER_VIEW_STATE *buffer_view_state, + VK_OBJECT obj_struct) { // Any bound cmd buffers are now invalid invalidateCommandBuffers(device_data, buffer_view_state->cb_bindings, obj_struct); GetBufferViewMap(device_data)->erase(buffer_view); -- cgit v1.2.3