Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: src/gpu/vk/GrVkGpu.cpp

Issue 2099813002: Add Sleep on windows GrVkGpu dtor to avoid fence bug (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698