Re-land "Perform Vulkan resets in a background thread"
Bug: skia:
Change-Id: I1c7ec365a370137ca64d9091cb60e6430c3f1c28
Reviewed-on: https://skia-review.googlesource.com/c/177069
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 84101a8..0be9854 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -297,6 +297,11 @@
sk_sp<GrSkSLFPFactoryCache> fFPFactoryCache;
private:
+ // fTaskGroup must appear before anything that uses it (e.g. fGpu), so that it is destroyed
+ // after all of its users. Clients of fTaskGroup will generally want to ensure that they call
+ // wait() on it as they are being destroyed, to avoid the possibility of pending tasks being
+ // invoked after objects they depend upon have already been destroyed.
+ std::unique_ptr<SkTaskGroup> fTaskGroup;
sk_sp<GrGpu> fGpu;
GrResourceCache* fResourceCache;
GrResourceProvider* fResourceProvider;
@@ -319,8 +324,6 @@
// GrRenderTargetContexts. It is also passed to the GrResourceProvider and SkGpuDevice.
mutable GrSingleOwner fSingleOwner;
- std::unique_ptr<SkTaskGroup> fTaskGroup;
-
const uint32_t fUniqueID;
std::unique_ptr<GrDrawingManager> fDrawingManager;