Index: src/gpu/vk/GrVkGpu.cpp |
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp |
index 0bb99c0517ea3e707044a65ef5f157c488767890..ee5d324dc8930701607d7cc4f5b08a901822f9ba 100644 |
--- a/src/gpu/vk/GrVkGpu.cpp |
+++ b/src/gpu/vk/GrVkGpu.cpp |
@@ -154,6 +154,20 @@ GrVkGpu::~GrVkGpu() { |
// wait for all commands to finish |
fResourceProvider.checkCommandBuffers(); |
SkDEBUGCODE(VkResult res = ) VK_CALL(QueueWaitIdle(fQueue)); |
+ |
+ // On windows, sometimes calls to QueueWaitIdle return before actually signalling the fences |
+ // on the command buffers even though they have completed. This causes an assert to fire when |
+ // destroying the command buffers. Currently this ony seems to happen on windows, so we add a |
+ // sleep to make sure the fence singals. |
+#ifdef SK_DEBUG |
+#if defined(SK_BUILD_FOR_WIN) |
+ Sleep(10); // In milliseconds |
+#else |
+ // Uncomment if above bug happens on non windows build. |
+ // sleep(1); // In seconds |
+#endif |
+#endif |
+ |
// VK_ERROR_DEVICE_LOST is acceptable when tearing down (see 4.2.4 in spec) |
SkASSERT(VK_SUCCESS == res || VK_ERROR_DEVICE_LOST == res); |