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