aboutsummaryrefslogtreecommitdiff
path: root/layers/buffer_validation.cpp
diff options
context:
space:
mode:
authorJohn Zulauf <jzulauf@lunarg.com>2018-04-26 16:30:39 -0600
committerJohn Zulauf <32470354+jzulauf-lunarg@users.noreply.github.com>2018-04-30 15:23:12 -0600
commit01423238d40332394ef968bc4073548e4037865f (patch)
tree7ab88ab0770a7cf8899a77d22079cb7409029c10 /layers/buffer_validation.cpp
parentccaed44dc376d964fb98d51d2136132fa9a2f158 (diff)
downloadusermoji-01423238d40332394ef968bc4073548e4037865f.tar.xz
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
Diffstat (limited to 'layers/buffer_validation.cpp')
-rw-r--r--layers/buffer_validation.cpp12
1 files changed, 6 insertions, 6 deletions
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);