Make sure the vulkan gpu is done work before we deleting objects in VkHardwareBufferTest.

Bug: skia:
Change-Id: I43a0136d67471030056da2af19894c28bc96d22b
Reviewed-on: https://skia-review.googlesource.com/c/189495
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2019-02-05 15:54:24 -05:00 committed by Skia Commit-Bot
parent d742b6be45
commit 822d223972

View File

@ -400,9 +400,12 @@ public:
}
}
void cleanup() override {
this->releaseImage();
fGrContext.reset();
this->releaseImage();
if (fSignalSemaphore != VK_NULL_HANDLE) {
fVkDestroySemaphore(fDevice, fSignalSemaphore, nullptr);
fSignalSemaphore = VK_NULL_HANDLE;
}
fBackendContext.fMemoryAllocator.reset();
if (fDevice != VK_NULL_HANDLE) {
fVkDeviceWaitIdle(fDevice);
@ -489,6 +492,9 @@ private:
VkDebugReportCallbackEXT fDebugCallback = VK_NULL_HANDLE;
PFN_vkDestroyDebugReportCallbackEXT fDestroyDebugCallback = nullptr;
// We hold on to the semaphore so we can delete once the GPU is done.
VkSemaphore fSignalSemaphore = VK_NULL_HANDLE;
VkDevice fDevice = VK_NULL_HANDLE;
GrVkBackendContext fBackendContext;
@ -899,7 +905,7 @@ bool VulkanTestHelper::exportSemaphore(skiatest::Reporter* reporter,
ERRORF(reporter, "Failed to export signal semaphore, err: %d", err);
return false;
}
fVkDestroySemaphore(fDevice, semaphore, nullptr);
fSignalSemaphore = semaphore;
return true;
}