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

Side by Side 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, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrVkGpu.h" 8 #include "GrVkGpu.h"
9 9
10 #include "GrContextOptions.h" 10 #include "GrContextOptions.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 fHeaps[kCopyWriteBuffer_Heap].reset(new GrVkHeap(this, GrVkHeap::kSubAlloc_S trategy, 16*1024*1024)); 147 fHeaps[kCopyWriteBuffer_Heap].reset(new GrVkHeap(this, GrVkHeap::kSubAlloc_S trategy, 16*1024*1024));
148 } 148 }
149 149
150 GrVkGpu::~GrVkGpu() { 150 GrVkGpu::~GrVkGpu() {
151 fCurrentCmdBuffer->end(this); 151 fCurrentCmdBuffer->end(this);
152 fCurrentCmdBuffer->unref(this); 152 fCurrentCmdBuffer->unref(this);
153 153
154 // wait for all commands to finish 154 // wait for all commands to finish
155 fResourceProvider.checkCommandBuffers(); 155 fResourceProvider.checkCommandBuffers();
156 SkDEBUGCODE(VkResult res = ) VK_CALL(QueueWaitIdle(fQueue)); 156 SkDEBUGCODE(VkResult res = ) VK_CALL(QueueWaitIdle(fQueue));
157
158 // On windows, sometimes calls to QueueWaitIdle return before actually signa lling the fences
159 // on the command buffers even though they have completed. This causes an as sert to fire when
160 // destroying the command buffers. Currently this ony seems to happen on win dows, so we add a
161 // sleep to make sure the fence singals.
162 #ifdef SK_DEBUG
163 #if defined(SK_BUILD_FOR_WIN)
164 Sleep(10); // In milliseconds
165 #else
166 // Uncomment if above bug happens on non windows build.
167 // sleep(1); // In seconds
168 #endif
169 #endif
170
157 // VK_ERROR_DEVICE_LOST is acceptable when tearing down (see 4.2.4 in spec) 171 // VK_ERROR_DEVICE_LOST is acceptable when tearing down (see 4.2.4 in spec)
158 SkASSERT(VK_SUCCESS == res || VK_ERROR_DEVICE_LOST == res); 172 SkASSERT(VK_SUCCESS == res || VK_ERROR_DEVICE_LOST == res);
159 173
160 // must call this just before we destroy the VkDevice 174 // must call this just before we destroy the VkDevice
161 fResourceProvider.destroyResources(); 175 fResourceProvider.destroyResources();
162 176
163 VK_CALL(DestroyCommandPool(fDevice, fCmdPool, nullptr)); 177 VK_CALL(DestroyCommandPool(fDevice, fCmdPool, nullptr));
164 178
165 shaderc_compiler_release(fCompiler); 179 shaderc_compiler_release(fCompiler);
166 180
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 GrVkRenderTarget* target, 1443 GrVkRenderTarget* target,
1430 const SkIRect& bounds) { 1444 const SkIRect& bounds) {
1431 // Currently it is fine for us to always pass in 1 for the clear count even if no attachment 1445 // Currently it is fine for us to always pass in 1 for the clear count even if no attachment
1432 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the color attachment 1446 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the color attachment
1433 // which is always at the first attachment. 1447 // which is always at the first attachment.
1434 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target, bounds, true); 1448 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target, bounds, true);
1435 fCurrentCmdBuffer->executeCommands(this, buffer); 1449 fCurrentCmdBuffer->executeCommands(this, buffer);
1436 fCurrentCmdBuffer->endRenderPass(this); 1450 fCurrentCmdBuffer->endRenderPass(this);
1437 } 1451 }
1438 1452
OLDNEW
« 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