Index: bench/nanobench.cpp |
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp |
index c7cc3f0239ba96256eb82edaa87605ba959a795a..3d24c678f296a4e0d6ae993ad28f0426eae0bfb8 100644 |
--- a/bench/nanobench.cpp |
+++ b/bench/nanobench.cpp |
@@ -1020,7 +1020,11 @@ int nanobench_main(); |
int nanobench_main() { |
SetupCrashHandler(); |
SkAutoGraphics ag; |
+#if SK_SUPPORT_GPU |
+ SkTaskGroup::Enabler enabled(FLAGS_threads, GrContextFactory::ReleaseGpuAPIsInThread); |
+#else |
SkTaskGroup::Enabler enabled(FLAGS_threads); |
+#endif |
#if SK_SUPPORT_GPU |
GrContextOptions grContextOpts; |
@@ -1272,7 +1276,10 @@ int nanobench_main() { |
// SkEventTracer destructor |
gGrFactory.reset(nullptr); |
#endif |
- |
+#if SK_SUPPORT_GPU |
+ // The main thread maybe ran GPU code. |
+ GrContextFactory::ReleaseGpuAPIsInThread(); |
+#endif |
return 0; |
} |