Robert Phillips | eb35f4d | 2017-03-21 07:56:47 -0400 | [diff] [blame] | 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "src/gpu/GrOnFlushResourceProvider.h" |
Robert Phillips | 6989370 | 2019-02-22 11:16:30 -0500 | [diff] [blame] | 9 | |
Robert Phillips | b7bfbc2 | 2020-07-01 12:55:01 -0400 | [diff] [blame] | 10 | #include "include/gpu/GrDirectContext.h" |
| 11 | #include "include/gpu/GrRecordingContext.h" |
Adlai Holler | a069304 | 2020-10-14 11:23:11 -0400 | [diff] [blame] | 12 | #include "src/gpu/GrDirectContextPriv.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 13 | #include "src/gpu/GrDrawingManager.h" |
| 14 | #include "src/gpu/GrProxyProvider.h" |
| 15 | #include "src/gpu/GrRecordingContextPriv.h" |
Robert Phillips | 1a82a4e | 2021-07-01 10:27:44 -0400 | [diff] [blame] | 16 | #include "src/gpu/GrResourceProvider.h" |
Greg Daniel | f91aeb2 | 2019-06-18 09:58:02 -0400 | [diff] [blame] | 17 | #include "src/gpu/GrSurfaceProxy.h" |
Robert Phillips | 400f52e | 2021-07-26 13:23:10 -0400 | [diff] [blame] | 18 | #include "src/gpu/GrSurfaceProxyPriv.h" |
Chris Dalton | 4ece96d | 2019-08-30 11:26:39 -0600 | [diff] [blame] | 19 | #include "src/gpu/GrTextureResolveRenderTask.h" |
Robert Phillips | eb35f4d | 2017-03-21 07:56:47 -0400 | [diff] [blame] | 20 | |
Robert Phillips | cd5099c | 2018-02-09 09:56:56 -0500 | [diff] [blame] | 21 | bool GrOnFlushResourceProvider::instatiateProxy(GrSurfaceProxy* proxy) { |
Brian Salomon | beb7f52 | 2019-08-30 16:19:42 -0400 | [diff] [blame] | 22 | SkASSERT(proxy->canSkipResourceAllocator()); |
Robert Phillips | 7eeb74f | 2019-03-29 07:26:46 -0400 | [diff] [blame] | 23 | |
Robert Phillips | 6a6de56 | 2019-02-15 15:19:15 -0500 | [diff] [blame] | 24 | // TODO: this class should probably just get a GrDirectContext |
Robert Phillips | f8f45d9 | 2020-07-01 11:11:18 -0400 | [diff] [blame] | 25 | auto direct = fDrawingMgr->getContext()->asDirectContext(); |
Robert Phillips | 6a6de56 | 2019-02-15 15:19:15 -0500 | [diff] [blame] | 26 | if (!direct) { |
| 27 | return false; |
| 28 | } |
| 29 | |
| 30 | auto resourceProvider = direct->priv().resourceProvider(); |
Robert Phillips | cd5099c | 2018-02-09 09:56:56 -0500 | [diff] [blame] | 31 | |
Brian Salomon | beb7f52 | 2019-08-30 16:19:42 -0400 | [diff] [blame] | 32 | if (proxy->isLazy()) { |
Robert Phillips | 7d79e7b | 2018-02-14 11:09:57 -0500 | [diff] [blame] | 33 | return proxy->priv().doLazyInstantiation(resourceProvider); |
| 34 | } |
| 35 | |
Robert Phillips | cd5099c | 2018-02-09 09:56:56 -0500 | [diff] [blame] | 36 | return proxy->instantiate(resourceProvider); |
| 37 | } |
| 38 | |
Chris Dalton | 6081ebb | 2017-06-20 11:35:59 -0700 | [diff] [blame] | 39 | const GrCaps* GrOnFlushResourceProvider::caps() const { |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 40 | return fDrawingMgr->getContext()->priv().caps(); |
Chris Dalton | 6081ebb | 2017-06-20 11:35:59 -0700 | [diff] [blame] | 41 | } |