1 /* 2 * Copyright 2017 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "src/gpu/ganesh/GrOnFlushResourceProvider.h" 9 10 #include "include/gpu/GrDirectContext.h" 11 #include "include/gpu/GrRecordingContext.h" 12 #include "src/gpu/ganesh/GrDirectContextPriv.h" 13 #include "src/gpu/ganesh/GrDrawingManager.h" 14 #include "src/gpu/ganesh/GrProxyProvider.h" 15 #include "src/gpu/ganesh/GrRecordingContextPriv.h" 16 #include "src/gpu/ganesh/GrResourceProvider.h" 17 #include "src/gpu/ganesh/GrSurfaceProxy.h" 18 #include "src/gpu/ganesh/GrSurfaceProxyPriv.h" 19 #include "src/gpu/ganesh/GrTextureResolveRenderTask.h" 20 instantiateProxy(GrSurfaceProxy * proxy)21bool GrOnFlushResourceProvider::instantiateProxy(GrSurfaceProxy* proxy) { 22 SkASSERT(proxy->canSkipResourceAllocator()); 23 24 // TODO: this class should probably just get a GrDirectContext 25 auto direct = fDrawingMgr->getContext()->asDirectContext(); 26 if (!direct) { 27 return false; 28 } 29 30 auto resourceProvider = direct->priv().resourceProvider(); 31 32 if (proxy->isLazy()) { 33 return proxy->priv().doLazyInstantiation(resourceProvider); 34 } 35 36 return proxy->instantiate(resourceProvider); 37 } 38 caps() const39const GrCaps* GrOnFlushResourceProvider::caps() const { 40 return fDrawingMgr->getContext()->priv().caps(); 41 } 42 43 #if GR_TEST_UTILS failFlushTimeCallbacks() const44bool GrOnFlushResourceProvider::failFlushTimeCallbacks() const { 45 return fDrawingMgr->getContext()->priv().options().fFailFlushTimeCallbacks; 46 } 47 #endif 48