blob: b5ff040db0d518ecddf7c744dc43379bb7aba388 [file] [log] [blame]
Robert Phillipseb35f4d2017-03-21 07:56:47 -04001/*
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
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "src/gpu/GrOnFlushResourceProvider.h"
Robert Phillips69893702019-02-22 11:16:30 -05009
Robert Phillipsb7bfbc22020-07-01 12:55:01 -040010#include "include/gpu/GrDirectContext.h"
11#include "include/gpu/GrRecordingContext.h"
Adlai Hollera0693042020-10-14 11:23:11 -040012#include "src/gpu/GrDirectContextPriv.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050013#include "src/gpu/GrDrawingManager.h"
14#include "src/gpu/GrProxyProvider.h"
15#include "src/gpu/GrRecordingContextPriv.h"
Robert Phillips1a82a4e2021-07-01 10:27:44 -040016#include "src/gpu/GrResourceProvider.h"
Greg Danielf91aeb22019-06-18 09:58:02 -040017#include "src/gpu/GrSurfaceProxy.h"
Robert Phillips400f52e2021-07-26 13:23:10 -040018#include "src/gpu/GrSurfaceProxyPriv.h"
Chris Dalton4ece96d2019-08-30 11:26:39 -060019#include "src/gpu/GrTextureResolveRenderTask.h"
Robert Phillipseb35f4d2017-03-21 07:56:47 -040020
Robert Phillipscd5099c2018-02-09 09:56:56 -050021bool GrOnFlushResourceProvider::instatiateProxy(GrSurfaceProxy* proxy) {
Brian Salomonbeb7f522019-08-30 16:19:42 -040022 SkASSERT(proxy->canSkipResourceAllocator());
Robert Phillips7eeb74f2019-03-29 07:26:46 -040023
Robert Phillips6a6de562019-02-15 15:19:15 -050024 // TODO: this class should probably just get a GrDirectContext
Robert Phillipsf8f45d92020-07-01 11:11:18 -040025 auto direct = fDrawingMgr->getContext()->asDirectContext();
Robert Phillips6a6de562019-02-15 15:19:15 -050026 if (!direct) {
27 return false;
28 }
29
30 auto resourceProvider = direct->priv().resourceProvider();
Robert Phillipscd5099c2018-02-09 09:56:56 -050031
Brian Salomonbeb7f522019-08-30 16:19:42 -040032 if (proxy->isLazy()) {
Robert Phillips7d79e7b2018-02-14 11:09:57 -050033 return proxy->priv().doLazyInstantiation(resourceProvider);
34 }
35
Robert Phillipscd5099c2018-02-09 09:56:56 -050036 return proxy->instantiate(resourceProvider);
37}
38
Chris Dalton6081ebb2017-06-20 11:35:59 -070039const GrCaps* GrOnFlushResourceProvider::caps() const {
Robert Phillips9da87e02019-02-04 13:26:26 -050040 return fDrawingMgr->getContext()->priv().caps();
Chris Dalton6081ebb2017-06-20 11:35:59 -070041}