// wait for all commands to finish
fResourceProvider.checkCommandBuffers();
- SkDEBUGCODE(VkResult res = ) VK_CALL(QueueWaitIdle(fQueue));
+ 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.
+ // sleep to make sure the fence signals.
#ifdef SK_DEBUG
#if defined(SK_BUILD_FOR_WIN)
Sleep(10); // In milliseconds
fCopyManager.destroyResources(this);
- // must call this just before we destroy the VkDevice
- fResourceProvider.destroyResources();
+ // must call this just before we destroy the command pool and VkDevice
+ fResourceProvider.destroyResources(VK_ERROR_DEVICE_LOST == res);
VK_CALL(DestroyCommandPool(fDevice, fCmdPool, nullptr));
fAvailableUniformBufferResources.push_back(resource);
}
-void GrVkResourceProvider::destroyResources() {
+void GrVkResourceProvider::destroyResources(bool deviceLost) {
// release our active command buffers
for (int i = 0; i < fActiveCommandBuffers.count(); ++i) {
- SkASSERT(fActiveCommandBuffers[i]->finished(fGpu));
+ SkASSERT(deviceLost || fActiveCommandBuffers[i]->finished(fGpu));
SkASSERT(fActiveCommandBuffers[i]->unique());
fActiveCommandBuffers[i]->reset(fGpu);
fActiveCommandBuffers[i]->unref(fGpu);
fActiveCommandBuffers.reset();
// release our available command buffers
for (int i = 0; i < fAvailableCommandBuffers.count(); ++i) {
- SkASSERT(fAvailableCommandBuffers[i]->finished(fGpu));
+ SkASSERT(deviceLost || fAvailableCommandBuffers[i]->finished(fGpu));
SkASSERT(fAvailableCommandBuffers[i]->unique());
fAvailableCommandBuffers[i]->unref(fGpu);
}
// The assumption is that all queues are idle and all command buffers are finished.
// For resource tracing to work properly, this should be called after unrefing all other
// resource usages.
- void destroyResources();
+ // If deviceLost is true, then resources will not be checked to see if they've finished
+ // before deleting (see section 4.2.4 of the Vulkan spec).
+ void destroyResources(bool deviceLost);
// Abandon any cached resources. To be used when the context/VkDevice is lost.
// For resource tracing to work properly, this should be called after unrefing all other
GrContext* context = ctxInfo.grContext();
GrTextureProvider* provider = context->textureProvider();
- // Vulkan is unhappy with this test
- if (kVulkan_GrBackend == ctxInfo.backend()) {
- return;
- }
-
static const int kSize = 64;
sk_sp<GrTexture> tex;