robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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 | |
bsalomon | 5eb41fd | 2016-09-06 13:49:32 -0700 | [diff] [blame] | 8 | #include "GrDrawingManager.h" |
Greg Daniel | 5131678 | 2017-08-02 15:10:09 +0000 | [diff] [blame] | 9 | #include "GrBackendSemaphore.h" |
bsalomon | b77a907 | 2016-09-07 10:02:04 -0700 | [diff] [blame] | 10 | #include "GrContext.h" |
Robert Phillips | 1afd4cd | 2018-01-08 13:40:32 -0500 | [diff] [blame] | 11 | #include "GrContextPriv.h" |
Robert Phillips | 646e429 | 2017-06-13 12:44:56 -0400 | [diff] [blame] | 12 | #include "GrGpu.h" |
Robert Phillips | c994a93 | 2018-06-19 13:09:54 -0400 | [diff] [blame] | 13 | #include "GrMemoryPool.h" |
Robert Phillips | fbcef6e | 2017-06-15 12:07:18 -0400 | [diff] [blame] | 14 | #include "GrOnFlushResourceProvider.h" |
Robert Phillips | 9d6c64f | 2017-09-14 10:56:45 -0400 | [diff] [blame] | 15 | #include "GrOpList.h" |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 16 | #include "GrRenderTargetContext.h" |
Robert Phillips | c7635fa | 2016-10-28 13:25:24 -0400 | [diff] [blame] | 17 | #include "GrRenderTargetProxy.h" |
Robert Phillips | d375dbf | 2017-09-14 12:45:25 -0400 | [diff] [blame] | 18 | #include "GrResourceAllocator.h" |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 19 | #include "GrResourceProvider.h" |
robertphillips | 6873782 | 2015-10-29 12:12:21 -0700 | [diff] [blame] | 20 | #include "GrSoftwarePathRenderer.h" |
Robert Phillips | 7ee385e | 2017-03-30 08:02:11 -0400 | [diff] [blame] | 21 | #include "GrSurfaceProxyPriv.h" |
Brian Salomon | 930f939 | 2018-06-20 16:25:26 -0400 | [diff] [blame] | 22 | #include "GrTexture.h" |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 23 | #include "GrTextureContext.h" |
| 24 | #include "GrTextureOpList.h" |
Brian Salomon | 930f939 | 2018-06-20 16:25:26 -0400 | [diff] [blame] | 25 | #include "GrTexturePriv.h" |
Chris Dalton | 706a6ff | 2017-11-29 22:01:06 -0700 | [diff] [blame] | 26 | #include "GrTextureProxy.h" |
| 27 | #include "GrTextureProxyPriv.h" |
Brian Salomon | 930f939 | 2018-06-20 16:25:26 -0400 | [diff] [blame] | 28 | #include "GrTracing.h" |
Robert Phillips | 6200036 | 2018-02-01 09:10:04 -0500 | [diff] [blame] | 29 | #include "SkDeferredDisplayList.h" |
brianosman | 0e22eb8 | 2016-08-30 07:07:59 -0700 | [diff] [blame] | 30 | #include "SkSurface_Gpu.h" |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 31 | #include "SkTTopoSort.h" |
Robert Phillips | 774168e | 2018-05-31 12:43:27 -0400 | [diff] [blame] | 32 | #include "ccpr/GrCoverageCountingPathRenderer.h" |
Herb Derby | 26cbe51 | 2018-05-24 14:39:01 -0400 | [diff] [blame] | 33 | #include "text/GrTextContext.h" |
robertphillips | 498d7ac | 2015-10-30 10:11:30 -0700 | [diff] [blame] | 34 | |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 35 | GrDrawingManager::OpListDAG::OpListDAG(bool explicitlyAllocating, |
| 36 | GrContextOptions::Enable sortOpLists) { |
| 37 | if (GrContextOptions::Enable::kNo == sortOpLists) { |
| 38 | fSortOpLists = false; |
| 39 | } else if (GrContextOptions::Enable::kYes == sortOpLists) { |
| 40 | fSortOpLists = true; |
Robert Phillips | a3f7026 | 2018-02-08 10:59:38 -0500 | [diff] [blame] | 41 | } else { |
Robert Phillips | 64ecdce | 2018-04-02 10:26:39 -0400 | [diff] [blame] | 42 | // By default we always enable sorting when we're explicitly allocating GPU resources |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 43 | fSortOpLists = explicitlyAllocating; |
Robert Phillips | a3f7026 | 2018-02-08 10:59:38 -0500 | [diff] [blame] | 44 | } |
| 45 | } |
| 46 | |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 47 | GrDrawingManager::OpListDAG::~OpListDAG() {} |
| 48 | |
| 49 | void GrDrawingManager::OpListDAG::gatherIDs(SkSTArray<8, uint32_t, true>* idArray) const { |
| 50 | idArray->reset(fOpLists.count()); |
Robert Phillips | f2361d2 | 2016-10-25 14:20:06 -0400 | [diff] [blame] | 51 | for (int i = 0; i < fOpLists.count(); ++i) { |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 52 | if (fOpLists[i]) { |
| 53 | (*idArray)[i] = fOpLists[i]->uniqueID(); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | void GrDrawingManager::OpListDAG::reset() { |
| 59 | fOpLists.reset(); |
| 60 | } |
| 61 | |
| 62 | void GrDrawingManager::OpListDAG::removeOpList(int index) { |
| 63 | if (!fOpLists[index]->unique()) { |
| 64 | // TODO: Eventually this should be guaranteed unique: http://skbug.com/7111 |
| 65 | fOpLists[index]->endFlush(); |
| 66 | } |
| 67 | |
| 68 | fOpLists[index] = nullptr; |
| 69 | } |
| 70 | |
| 71 | void GrDrawingManager::OpListDAG::removeOpLists(int startIndex, int stopIndex) { |
| 72 | for (int i = startIndex; i < stopIndex; ++i) { |
| 73 | if (!fOpLists[i]) { |
| 74 | continue; |
| 75 | } |
| 76 | this->removeOpList(i); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | void GrDrawingManager::OpListDAG::add(sk_sp<GrOpList> opList) { |
| 81 | fOpLists.emplace_back(std::move(opList)); |
| 82 | } |
| 83 | |
| 84 | void GrDrawingManager::OpListDAG::add(const SkTArray<sk_sp<GrOpList>>& opLists) { |
| 85 | fOpLists.push_back_n(opLists.count(), opLists.begin()); |
| 86 | } |
| 87 | |
| 88 | void GrDrawingManager::OpListDAG::swap(SkTArray<sk_sp<GrOpList>>* opLists) { |
| 89 | SkASSERT(opLists->empty()); |
| 90 | opLists->swap(fOpLists); |
| 91 | } |
| 92 | |
| 93 | void GrDrawingManager::OpListDAG::prepForFlush() { |
| 94 | if (fSortOpLists) { |
| 95 | SkDEBUGCODE(bool result =) SkTTopoSort<GrOpList, GrOpList::TopoSortTraits>(&fOpLists); |
| 96 | SkASSERT(result); |
| 97 | } |
| 98 | |
| 99 | #ifdef SK_DEBUG |
| 100 | // This block checks for any unnecessary splits in the opLists. If two sequential opLists |
| 101 | // share the same backing GrSurfaceProxy it means the opList was artificially split. |
| 102 | if (fOpLists.count()) { |
| 103 | GrRenderTargetOpList* prevOpList = fOpLists[0]->asRenderTargetOpList(); |
| 104 | for (int i = 1; i < fOpLists.count(); ++i) { |
| 105 | GrRenderTargetOpList* curOpList = fOpLists[i]->asRenderTargetOpList(); |
| 106 | |
| 107 | if (prevOpList && curOpList) { |
| 108 | SkASSERT(prevOpList->fTarget.get() != curOpList->fTarget.get()); |
| 109 | } |
| 110 | |
| 111 | prevOpList = curOpList; |
| 112 | } |
| 113 | } |
| 114 | #endif |
| 115 | } |
| 116 | |
| 117 | void GrDrawingManager::OpListDAG::closeAll(const GrCaps* caps) { |
| 118 | for (int i = 0; i < fOpLists.count(); ++i) { |
| 119 | if (fOpLists[i]) { |
| 120 | fOpLists[i]->makeClosed(*caps); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | void GrDrawingManager::OpListDAG::cleanup(const GrCaps* caps) { |
| 126 | for (int i = 0; i < fOpLists.count(); ++i) { |
| 127 | if (!fOpLists[i]) { |
| 128 | continue; |
| 129 | } |
| 130 | |
Robert Phillips | ee68365 | 2017-04-26 11:53:10 -0400 | [diff] [blame] | 131 | // no opList should receive a new command after this |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 132 | fOpLists[i]->makeClosed(*caps); |
robertphillips | 0dfa62c | 2015-11-16 06:23:31 -0800 | [diff] [blame] | 133 | |
Robert Phillips | f2361d2 | 2016-10-25 14:20:06 -0400 | [diff] [blame] | 134 | // We shouldn't need to do this, but it turns out some clients still hold onto opLists |
Robert Phillips | 6cdc22c | 2017-05-11 16:29:14 -0400 | [diff] [blame] | 135 | // after a cleanup. |
| 136 | // MDB TODO: is this still true? |
Chris Dalton | a84cacf | 2017-10-04 10:30:29 -0600 | [diff] [blame] | 137 | if (!fOpLists[i]->unique()) { |
| 138 | // TODO: Eventually this should be guaranteed unique. |
| 139 | // https://bugs.chromium.org/p/skia/issues/detail?id=7111 |
| 140 | fOpLists[i]->endFlush(); |
| 141 | } |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 142 | } |
| 143 | |
Robert Phillips | f2361d2 | 2016-10-25 14:20:06 -0400 | [diff] [blame] | 144 | fOpLists.reset(); |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | /////////////////////////////////////////////////////////////////////////////////////////////////// |
| 148 | GrDrawingManager::GrDrawingManager(GrContext* context, |
| 149 | const GrPathRendererChain::Options& optionsForPathRendererChain, |
| 150 | const GrTextContext::Options& optionsForTextContext, |
| 151 | GrSingleOwner* singleOwner, |
| 152 | bool explicitlyAllocating, |
Robert Phillips | 46acf9d | 2018-10-09 09:31:40 -0400 | [diff] [blame] | 153 | GrContextOptions::Enable sortOpLists, |
| 154 | GrContextOptions::Enable reduceOpListSplitting) |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 155 | : fContext(context) |
| 156 | , fOptionsForPathRendererChain(optionsForPathRendererChain) |
| 157 | , fOptionsForTextContext(optionsForTextContext) |
| 158 | , fSingleOwner(singleOwner) |
| 159 | , fAbandoned(false) |
| 160 | , fDAG(explicitlyAllocating, sortOpLists) |
| 161 | , fTextContext(nullptr) |
| 162 | , fPathRendererChain(nullptr) |
| 163 | , fSoftwarePathRenderer(nullptr) |
| 164 | , fFlushing(false) { |
Robert Phillips | 46acf9d | 2018-10-09 09:31:40 -0400 | [diff] [blame] | 165 | if (GrContextOptions::Enable::kNo == reduceOpListSplitting) { |
| 166 | fReduceOpListSplitting = false; |
| 167 | } else if (GrContextOptions::Enable::kYes == reduceOpListSplitting) { |
| 168 | fReduceOpListSplitting = true; |
| 169 | } else { |
| 170 | // For now, this is only turned on when explicitly enabled. Once mini-flushes are |
| 171 | // implemented it should be enabled whenever sorting is enabled. |
| 172 | fReduceOpListSplitting = false; // sortOpLists |
| 173 | } |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | void GrDrawingManager::cleanup() { |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 177 | fDAG.cleanup(fContext->priv().caps()); |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 178 | |
robertphillips | 13391dd | 2015-10-30 05:15:11 -0700 | [diff] [blame] | 179 | fPathRendererChain = nullptr; |
Ben Wagner | 9ec70c6 | 2018-07-12 13:30:47 -0400 | [diff] [blame] | 180 | fSoftwarePathRenderer = nullptr; |
Jim Van Verth | 106b5c4 | 2017-09-26 12:45:29 -0400 | [diff] [blame] | 181 | |
| 182 | fOnFlushCBObjects.reset(); |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 183 | } |
| 184 | |
| 185 | GrDrawingManager::~GrDrawingManager() { |
| 186 | this->cleanup(); |
| 187 | } |
| 188 | |
| 189 | void GrDrawingManager::abandon() { |
| 190 | fAbandoned = true; |
| 191 | this->cleanup(); |
| 192 | } |
| 193 | |
robertphillips | 6873782 | 2015-10-29 12:12:21 -0700 | [diff] [blame] | 194 | void GrDrawingManager::freeGpuResources() { |
Jim Van Verth | 106b5c4 | 2017-09-26 12:45:29 -0400 | [diff] [blame] | 195 | for (int i = fOnFlushCBObjects.count() - 1; i >= 0; --i) { |
| 196 | if (!fOnFlushCBObjects[i]->retainOnFreeGpuResources()) { |
| 197 | // it's safe to just do this because we're iterating in reverse |
| 198 | fOnFlushCBObjects.removeShuffle(i); |
| 199 | } |
| 200 | } |
| 201 | |
robertphillips | 6873782 | 2015-10-29 12:12:21 -0700 | [diff] [blame] | 202 | // a path renderer may be holding onto resources |
robertphillips | 13391dd | 2015-10-30 05:15:11 -0700 | [diff] [blame] | 203 | fPathRendererChain = nullptr; |
Ben Wagner | 9ec70c6 | 2018-07-12 13:30:47 -0400 | [diff] [blame] | 204 | fSoftwarePathRenderer = nullptr; |
Robert Phillips | e3302df | 2017-04-24 07:31:02 -0400 | [diff] [blame] | 205 | } |
| 206 | |
Robert Phillips | 7ee385e | 2017-03-30 08:02:11 -0400 | [diff] [blame] | 207 | // MDB TODO: make use of the 'proxy' parameter. |
Brian Salomon | 57d2bea | 2018-09-10 09:35:41 -0400 | [diff] [blame] | 208 | GrSemaphoresSubmitted GrDrawingManager::flush(GrSurfaceProxy*, |
| 209 | int numSemaphores, |
| 210 | GrBackendSemaphore backendSemaphores[]) { |
| 211 | GR_CREATE_TRACE_MARKER_CONTEXT("GrDrawingManager", "flush", fContext); |
Brian Salomon | dcbb9d9 | 2017-07-19 10:53:20 -0400 | [diff] [blame] | 212 | |
robertphillips | 7761d61 | 2016-05-16 09:14:53 -0700 | [diff] [blame] | 213 | if (fFlushing || this->wasAbandoned()) { |
Greg Daniel | 5131678 | 2017-08-02 15:10:09 +0000 | [diff] [blame] | 214 | return GrSemaphoresSubmitted::kNo; |
joshualitt | b8918c4 | 2015-12-18 09:59:46 -0800 | [diff] [blame] | 215 | } |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 216 | SkDEBUGCODE(this->validate()); |
| 217 | |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 218 | GrGpu* gpu = fContext->priv().getGpu(); |
Robert Phillips | 874b535 | 2018-03-16 08:48:24 -0400 | [diff] [blame] | 219 | if (!gpu) { |
| 220 | return GrSemaphoresSubmitted::kNo; // Can't flush while DDL recording |
| 221 | } |
joshualitt | b8918c4 | 2015-12-18 09:59:46 -0800 | [diff] [blame] | 222 | fFlushing = true; |
Robert Phillips | eb35f4d | 2017-03-21 07:56:47 -0400 | [diff] [blame] | 223 | |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 224 | // Semi-usually the GrOpLists are already closed at this point, but sometimes Ganesh |
| 225 | // needs to flush mid-draw. In that case, the SkGpuDevice's GrOpLists won't be closed |
| 226 | // but need to be flushed anyway. Closing such GrOpLists here will mean new |
| 227 | // GrOpLists will be created to replace them if the SkGpuDevice(s) write to them again. |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 228 | fDAG.closeAll(fContext->priv().caps()); |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 229 | fActiveOpList = nullptr; |
Robert Phillips | eb35f4d | 2017-03-21 07:56:47 -0400 | [diff] [blame] | 230 | |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 231 | fDAG.prepForFlush(); |
Brian Salomon | 601ac80 | 2019-02-07 13:37:16 -0500 | [diff] [blame] | 232 | if (!fCpuBufferCache) { |
| 233 | // We cache more buffers when the backend is using client side arrays. Otherwise, we |
| 234 | // expect each pool will use a CPU buffer as a staging buffer before uploading to a GPU |
| 235 | // buffer object. Each pool only requires one staging buffer at a time. |
| 236 | int maxCachedBuffers = fContext->priv().caps()->preferClientSideDynamicBuffers() ? 2 : 6; |
| 237 | fCpuBufferCache = GrBufferAllocPool::CpuBufferCache::Make(maxCachedBuffers); |
Brian Salomon | 58f153c | 2018-10-18 21:51:15 -0400 | [diff] [blame] | 238 | } |
Robert Phillips | a4c93ac | 2017-05-18 11:40:04 -0400 | [diff] [blame] | 239 | |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 240 | GrOpFlushState flushState(gpu, fContext->priv().resourceProvider(), &fTokenTracker, |
Brian Salomon | 601ac80 | 2019-02-07 13:37:16 -0500 | [diff] [blame] | 241 | fCpuBufferCache); |
Robert Phillips | 40a29d7 | 2018-01-18 12:59:22 -0500 | [diff] [blame] | 242 | |
Chris Dalton | fe199b7 | 2017-05-05 11:26:15 -0400 | [diff] [blame] | 243 | GrOnFlushResourceProvider onFlushProvider(this); |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 244 | // TODO: AFAICT the only reason fFlushState is on GrDrawingManager rather than on the |
| 245 | // stack here is to preserve the flush tokens. |
Robert Phillips | eb35f4d | 2017-03-21 07:56:47 -0400 | [diff] [blame] | 246 | |
Chris Dalton | 1265894 | 2017-10-05 19:45:25 -0600 | [diff] [blame] | 247 | // Prepare any onFlush op lists (e.g. atlases). |
Chris Dalton | fe199b7 | 2017-05-05 11:26:15 -0400 | [diff] [blame] | 248 | if (!fOnFlushCBObjects.empty()) { |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 249 | fDAG.gatherIDs(&fFlushingOpListIDs); |
| 250 | |
Chris Dalton | 1265894 | 2017-10-05 19:45:25 -0600 | [diff] [blame] | 251 | SkSTArray<4, sk_sp<GrRenderTargetContext>> renderTargetContexts; |
Chris Dalton | fe199b7 | 2017-05-05 11:26:15 -0400 | [diff] [blame] | 252 | for (GrOnFlushCallbackObject* onFlushCBObject : fOnFlushCBObjects) { |
| 253 | onFlushCBObject->preFlush(&onFlushProvider, |
Chris Dalton | 3968ff9 | 2017-11-27 12:26:31 -0700 | [diff] [blame] | 254 | fFlushingOpListIDs.begin(), fFlushingOpListIDs.count(), |
Chris Dalton | fe199b7 | 2017-05-05 11:26:15 -0400 | [diff] [blame] | 255 | &renderTargetContexts); |
Chris Dalton | 1265894 | 2017-10-05 19:45:25 -0600 | [diff] [blame] | 256 | for (const sk_sp<GrRenderTargetContext>& rtc : renderTargetContexts) { |
Chris Dalton | 706a6ff | 2017-11-29 22:01:06 -0700 | [diff] [blame] | 257 | sk_sp<GrRenderTargetOpList> onFlushOpList = sk_ref_sp(rtc->getRTOpList()); |
Chris Dalton | 1265894 | 2017-10-05 19:45:25 -0600 | [diff] [blame] | 258 | if (!onFlushOpList) { |
Robert Phillips | eb35f4d | 2017-03-21 07:56:47 -0400 | [diff] [blame] | 259 | continue; // Odd - but not a big deal |
| 260 | } |
Chris Dalton | 706a6ff | 2017-11-29 22:01:06 -0700 | [diff] [blame] | 261 | #ifdef SK_DEBUG |
| 262 | // OnFlush callbacks are already invoked during flush, and are therefore expected to |
| 263 | // handle resource allocation & usage on their own. (No deferred or lazy proxies!) |
| 264 | onFlushOpList->visitProxies_debugOnly([](GrSurfaceProxy* p) { |
| 265 | SkASSERT(!p->asTextureProxy() || !p->asTextureProxy()->texPriv().isDeferred()); |
Greg Daniel | 65fa8ca | 2018-01-10 17:06:31 -0500 | [diff] [blame] | 266 | SkASSERT(GrSurfaceProxy::LazyState::kNot == p->lazyInstantiationState()); |
Chris Dalton | 706a6ff | 2017-11-29 22:01:06 -0700 | [diff] [blame] | 267 | }); |
| 268 | #endif |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 269 | onFlushOpList->makeClosed(*fContext->priv().caps()); |
Robert Phillips | 40a29d7 | 2018-01-18 12:59:22 -0500 | [diff] [blame] | 270 | onFlushOpList->prepare(&flushState); |
Chris Dalton | 3968ff9 | 2017-11-27 12:26:31 -0700 | [diff] [blame] | 271 | fOnFlushCBOpLists.push_back(std::move(onFlushOpList)); |
Robert Phillips | eb35f4d | 2017-03-21 07:56:47 -0400 | [diff] [blame] | 272 | } |
| 273 | renderTargetContexts.reset(); |
| 274 | } |
| 275 | } |
| 276 | |
robertphillips | a13e202 | 2015-11-11 12:01:09 -0800 | [diff] [blame] | 277 | #if 0 |
Brian Salomon | 09d994e | 2016-12-21 11:14:46 -0500 | [diff] [blame] | 278 | // Enable this to print out verbose GrOp information |
Robert Phillips | f2361d2 | 2016-10-25 14:20:06 -0400 | [diff] [blame] | 279 | for (int i = 0; i < fOpLists.count(); ++i) { |
| 280 | SkDEBUGCODE(fOpLists[i]->dump();) |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 281 | } |
robertphillips | a13e202 | 2015-11-11 12:01:09 -0800 | [diff] [blame] | 282 | #endif |
| 283 | |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 284 | int startIndex, stopIndex; |
| 285 | bool flushed = false; |
| 286 | |
Robert Phillips | f8e2502 | 2017-11-08 15:24:31 -0500 | [diff] [blame] | 287 | { |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 288 | GrResourceAllocator alloc(fContext->priv().resourceProvider(), |
Brian Salomon | 967df20 | 2018-12-07 11:15:53 -0500 | [diff] [blame] | 289 | flushState.deinstantiateProxyTracker()); |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 290 | for (int i = 0; i < fDAG.numOpLists(); ++i) { |
| 291 | if (fDAG.opList(i)) { |
| 292 | fDAG.opList(i)->gatherProxyIntervals(&alloc); |
| 293 | } |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 294 | alloc.markEndOfOpList(i); |
Robert Phillips | f8e2502 | 2017-11-08 15:24:31 -0500 | [diff] [blame] | 295 | } |
Robert Phillips | d375dbf | 2017-09-14 12:45:25 -0400 | [diff] [blame] | 296 | |
Greg Daniel | aa3dfbe | 2018-01-29 10:34:25 -0500 | [diff] [blame] | 297 | GrResourceAllocator::AssignError error = GrResourceAllocator::AssignError::kNoError; |
Greg Daniel | d207345 | 2018-12-07 11:20:33 -0500 | [diff] [blame] | 298 | int numOpListsExecuted = 0; |
Brian Salomon | 577aa0f | 2018-11-30 13:32:23 -0500 | [diff] [blame] | 299 | while (alloc.assign(&startIndex, &stopIndex, &error)) { |
Greg Daniel | aa3dfbe | 2018-01-29 10:34:25 -0500 | [diff] [blame] | 300 | if (GrResourceAllocator::AssignError::kFailedProxyInstantiation == error) { |
| 301 | for (int i = startIndex; i < stopIndex; ++i) { |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 302 | if (fDAG.opList(i) && !fDAG.opList(i)->isFullyInstantiated()) { |
Robert Phillips | 01a9128 | 2018-07-26 08:03:04 -0400 | [diff] [blame] | 303 | // If the backing surface wasn't allocated drop the entire opList. |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 304 | fDAG.removeOpList(i); |
Robert Phillips | 01a9128 | 2018-07-26 08:03:04 -0400 | [diff] [blame] | 305 | } |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 306 | if (fDAG.opList(i)) { |
| 307 | fDAG.opList(i)->purgeOpsWithUninstantiatedProxies(); |
Robert Phillips | bbcb7f7 | 2018-05-31 11:16:19 -0400 | [diff] [blame] | 308 | } |
Greg Daniel | aa3dfbe | 2018-01-29 10:34:25 -0500 | [diff] [blame] | 309 | } |
| 310 | } |
Robert Phillips | 4150eea | 2018-02-07 17:08:21 -0500 | [diff] [blame] | 311 | |
Greg Daniel | d207345 | 2018-12-07 11:20:33 -0500 | [diff] [blame] | 312 | if (this->executeOpLists(startIndex, stopIndex, &flushState, &numOpListsExecuted)) { |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 313 | flushed = true; |
| 314 | } |
bsalomon | dc43898 | 2016-08-31 11:53:49 -0700 | [diff] [blame] | 315 | } |
Greg Daniel | c42b20b | 2017-10-04 10:34:49 -0400 | [diff] [blame] | 316 | } |
| 317 | |
Chris Dalton | 91ab155 | 2018-04-18 13:24:25 -0600 | [diff] [blame] | 318 | #ifdef SK_DEBUG |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 319 | for (int i = 0; i < fDAG.numOpLists(); ++i) { |
Chris Dalton | 91ab155 | 2018-04-18 13:24:25 -0600 | [diff] [blame] | 320 | // If there are any remaining opLists at this point, make sure they will not survive the |
| 321 | // flush. Otherwise we need to call endFlush() on them. |
| 322 | // http://skbug.com/7111 |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 323 | SkASSERT(!fDAG.opList(i) || fDAG.opList(i)->unique()); |
Chris Dalton | 91ab155 | 2018-04-18 13:24:25 -0600 | [diff] [blame] | 324 | } |
| 325 | #endif |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 326 | fDAG.reset(); |
robertphillips | a13e202 | 2015-11-11 12:01:09 -0800 | [diff] [blame] | 327 | |
Robert Phillips | c994a93 | 2018-06-19 13:09:54 -0400 | [diff] [blame] | 328 | #ifdef SK_DEBUG |
| 329 | // In non-DDL mode this checks that all the flushed ops have been freed from the memory pool. |
| 330 | // When we move to partial flushes this assert will no longer be valid. |
| 331 | // In DDL mode this check is somewhat superfluous since the memory for most of the ops/opLists |
| 332 | // will be stored in the DDL's GrOpMemoryPools. |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 333 | GrOpMemoryPool* opMemoryPool = fContext->priv().opMemoryPool(); |
Robert Phillips | c994a93 | 2018-06-19 13:09:54 -0400 | [diff] [blame] | 334 | opMemoryPool->isEmpty(); |
| 335 | #endif |
| 336 | |
Robert Phillips | f35fd8d | 2018-01-22 10:48:15 -0500 | [diff] [blame] | 337 | GrSemaphoresSubmitted result = gpu->finishFlush(numSemaphores, backendSemaphores); |
robertphillips | a13e202 | 2015-11-11 12:01:09 -0800 | [diff] [blame] | 338 | |
Brian Salomon | 967df20 | 2018-12-07 11:15:53 -0500 | [diff] [blame] | 339 | flushState.deinstantiateProxyTracker()->deinstantiateAllProxies(); |
Greg Daniel | 4684f82 | 2018-03-08 15:27:36 -0500 | [diff] [blame] | 340 | |
Brian Salomon | 57d2bea | 2018-09-10 09:35:41 -0400 | [diff] [blame] | 341 | // Give the cache a chance to purge resources that become purgeable due to flushing. |
| 342 | if (flushed) { |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 343 | fContext->priv().getResourceCache()->purgeAsNeeded(); |
bsalomon | b77a907 | 2016-09-07 10:02:04 -0700 | [diff] [blame] | 344 | } |
Chris Dalton | fe199b7 | 2017-05-05 11:26:15 -0400 | [diff] [blame] | 345 | for (GrOnFlushCallbackObject* onFlushCBObject : fOnFlushCBObjects) { |
Robert Phillips | 40a29d7 | 2018-01-18 12:59:22 -0500 | [diff] [blame] | 346 | onFlushCBObject->postFlush(fTokenTracker.nextTokenToFlush(), fFlushingOpListIDs.begin(), |
Chris Dalton | 3968ff9 | 2017-11-27 12:26:31 -0700 | [diff] [blame] | 347 | fFlushingOpListIDs.count()); |
Chris Dalton | fe199b7 | 2017-05-05 11:26:15 -0400 | [diff] [blame] | 348 | } |
Chris Dalton | 3968ff9 | 2017-11-27 12:26:31 -0700 | [diff] [blame] | 349 | fFlushingOpListIDs.reset(); |
joshualitt | b8918c4 | 2015-12-18 09:59:46 -0800 | [diff] [blame] | 350 | fFlushing = false; |
Greg Daniel | 5131678 | 2017-08-02 15:10:09 +0000 | [diff] [blame] | 351 | |
| 352 | return result; |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 353 | } |
| 354 | |
Greg Daniel | d207345 | 2018-12-07 11:20:33 -0500 | [diff] [blame] | 355 | bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushState* flushState, |
| 356 | int* numOpListsExecuted) { |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 357 | SkASSERT(startIndex <= stopIndex && stopIndex <= fDAG.numOpLists()); |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 358 | |
Robert Phillips | 2748391 | 2018-04-20 12:43:18 -0400 | [diff] [blame] | 359 | #if GR_FLUSH_TIME_OP_SPEW |
| 360 | SkDebugf("Flushing opLists: %d to %d out of [%d, %d]\n", |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 361 | startIndex, stopIndex, 0, fDAG.numOpLists()); |
Robert Phillips | 2748391 | 2018-04-20 12:43:18 -0400 | [diff] [blame] | 362 | for (int i = startIndex; i < stopIndex; ++i) { |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 363 | if (fDAG.opList(i)) { |
| 364 | fDAG.opList(i)->dump(true); |
Robert Phillips | 1734dd3 | 2018-08-21 13:52:09 -0400 | [diff] [blame] | 365 | } |
Robert Phillips | 2748391 | 2018-04-20 12:43:18 -0400 | [diff] [blame] | 366 | } |
| 367 | #endif |
| 368 | |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 369 | GrResourceProvider* resourceProvider = fContext->priv().resourceProvider(); |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 370 | bool anyOpListsExecuted = false; |
| 371 | |
| 372 | for (int i = startIndex; i < stopIndex; ++i) { |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 373 | if (!fDAG.opList(i)) { |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 374 | continue; |
| 375 | } |
| 376 | |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 377 | GrOpList* opList = fDAG.opList(i); |
| 378 | |
Robert Phillips | 4150eea | 2018-02-07 17:08:21 -0500 | [diff] [blame] | 379 | if (resourceProvider->explicitlyAllocateGPUResources()) { |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 380 | if (!opList->isFullyInstantiated()) { |
Robert Phillips | 4150eea | 2018-02-07 17:08:21 -0500 | [diff] [blame] | 381 | // If the backing surface wasn't allocated drop the draw of the entire opList. |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 382 | fDAG.removeOpList(i); |
Robert Phillips | 4150eea | 2018-02-07 17:08:21 -0500 | [diff] [blame] | 383 | continue; |
| 384 | } |
| 385 | } else { |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 386 | if (!opList->instantiate(resourceProvider)) { |
| 387 | fDAG.removeOpList(i); |
Robert Phillips | 4150eea | 2018-02-07 17:08:21 -0500 | [diff] [blame] | 388 | continue; |
| 389 | } |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 390 | } |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 391 | |
| 392 | // TODO: handle this instantiation via lazy surface proxies? |
| 393 | // Instantiate all deferred proxies (being built on worker threads) so we can upload them |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 394 | opList->instantiateDeferredProxies(fContext->priv().resourceProvider()); |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 395 | opList->prepare(flushState); |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 396 | } |
| 397 | |
| 398 | // Upload all data to the GPU |
| 399 | flushState->preExecuteDraws(); |
| 400 | |
Greg Daniel | d207345 | 2018-12-07 11:20:33 -0500 | [diff] [blame] | 401 | // For Vulkan, if we have too many oplists to be flushed we end up allocating a lot of resources |
| 402 | // for each command buffer associated with the oplists. If this gets too large we can cause the |
| 403 | // devices to go OOM. In practice we usually only hit this case in our tests, but to be safe we |
| 404 | // put a cap on the number of oplists we will execute before flushing to the GPU to relieve some |
| 405 | // memory pressure. |
| 406 | static constexpr int kMaxOpListsBeforeFlush = 100; |
| 407 | |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 408 | // Execute the onFlush op lists first, if any. |
Chris Dalton | 3968ff9 | 2017-11-27 12:26:31 -0700 | [diff] [blame] | 409 | for (sk_sp<GrOpList>& onFlushOpList : fOnFlushCBOpLists) { |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 410 | if (!onFlushOpList->execute(flushState)) { |
| 411 | SkDebugf("WARNING: onFlushOpList failed to execute.\n"); |
| 412 | } |
| 413 | SkASSERT(onFlushOpList->unique()); |
| 414 | onFlushOpList = nullptr; |
Greg Daniel | d207345 | 2018-12-07 11:20:33 -0500 | [diff] [blame] | 415 | (*numOpListsExecuted)++; |
| 416 | if (*numOpListsExecuted >= kMaxOpListsBeforeFlush) { |
| 417 | flushState->gpu()->finishFlush(0, nullptr); |
| 418 | *numOpListsExecuted = 0; |
| 419 | } |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 420 | } |
Chris Dalton | 3968ff9 | 2017-11-27 12:26:31 -0700 | [diff] [blame] | 421 | fOnFlushCBOpLists.reset(); |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 422 | |
| 423 | // Execute the normal op lists. |
| 424 | for (int i = startIndex; i < stopIndex; ++i) { |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 425 | if (!fDAG.opList(i)) { |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 426 | continue; |
| 427 | } |
| 428 | |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 429 | if (fDAG.opList(i)->execute(flushState)) { |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 430 | anyOpListsExecuted = true; |
| 431 | } |
Greg Daniel | d207345 | 2018-12-07 11:20:33 -0500 | [diff] [blame] | 432 | (*numOpListsExecuted)++; |
| 433 | if (*numOpListsExecuted >= kMaxOpListsBeforeFlush) { |
| 434 | flushState->gpu()->finishFlush(0, nullptr); |
| 435 | *numOpListsExecuted = 0; |
| 436 | } |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 437 | } |
| 438 | |
| 439 | SkASSERT(!flushState->commandBuffer()); |
Robert Phillips | 40a29d7 | 2018-01-18 12:59:22 -0500 | [diff] [blame] | 440 | SkASSERT(fTokenTracker.nextDrawToken() == fTokenTracker.nextTokenToFlush()); |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 441 | |
| 442 | // We reset the flush state before the OpLists so that the last resources to be freed are those |
| 443 | // that are written to in the OpLists. This helps to make sure the most recently used resources |
| 444 | // are the last to be purged by the resource cache. |
| 445 | flushState->reset(); |
| 446 | |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 447 | fDAG.removeOpLists(startIndex, stopIndex); |
Robert Phillips | eafd48a | 2017-11-16 07:52:08 -0500 | [diff] [blame] | 448 | |
| 449 | return anyOpListsExecuted; |
| 450 | } |
| 451 | |
Greg Daniel | 5131678 | 2017-08-02 15:10:09 +0000 | [diff] [blame] | 452 | GrSemaphoresSubmitted GrDrawingManager::prepareSurfaceForExternalIO( |
| 453 | GrSurfaceProxy* proxy, int numSemaphores, GrBackendSemaphore backendSemaphores[]) { |
bsalomon | 6a2b194 | 2016-09-08 11:28:59 -0700 | [diff] [blame] | 454 | if (this->wasAbandoned()) { |
Greg Daniel | 5131678 | 2017-08-02 15:10:09 +0000 | [diff] [blame] | 455 | return GrSemaphoresSubmitted::kNo; |
bsalomon | 6a2b194 | 2016-09-08 11:28:59 -0700 | [diff] [blame] | 456 | } |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 457 | SkDEBUGCODE(this->validate()); |
Robert Phillips | 7ee385e | 2017-03-30 08:02:11 -0400 | [diff] [blame] | 458 | SkASSERT(proxy); |
bsalomon | 6a2b194 | 2016-09-08 11:28:59 -0700 | [diff] [blame] | 459 | |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 460 | GrGpu* gpu = fContext->priv().getGpu(); |
Robert Phillips | 874b535 | 2018-03-16 08:48:24 -0400 | [diff] [blame] | 461 | if (!gpu) { |
| 462 | return GrSemaphoresSubmitted::kNo; // Can't flush while DDL recording |
| 463 | } |
| 464 | |
Kevin Lubick | 4284613 | 2018-01-05 10:11:11 -0500 | [diff] [blame] | 465 | GrSemaphoresSubmitted result = GrSemaphoresSubmitted::kNo; |
Greg Daniel | 5131678 | 2017-08-02 15:10:09 +0000 | [diff] [blame] | 466 | if (proxy->priv().hasPendingIO() || numSemaphores) { |
| 467 | result = this->flush(proxy, numSemaphores, backendSemaphores); |
bsalomon | 6a2b194 | 2016-09-08 11:28:59 -0700 | [diff] [blame] | 468 | } |
| 469 | |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 470 | if (!proxy->instantiate(fContext->priv().resourceProvider())) { |
Greg Daniel | 5131678 | 2017-08-02 15:10:09 +0000 | [diff] [blame] | 471 | return result; |
Robert Phillips | 7ee385e | 2017-03-30 08:02:11 -0400 | [diff] [blame] | 472 | } |
| 473 | |
Brian Salomon | fd98c2c | 2018-07-31 17:25:29 -0400 | [diff] [blame] | 474 | GrSurface* surface = proxy->peekSurface(); |
Brian Salomon | 930f939 | 2018-06-20 16:25:26 -0400 | [diff] [blame] | 475 | if (auto* rt = surface->asRenderTarget()) { |
| 476 | gpu->resolveRenderTarget(rt); |
| 477 | } |
| 478 | if (auto* tex = surface->asTexture()) { |
| 479 | if (tex->texturePriv().mipMapped() == GrMipMapped::kYes && |
| 480 | tex->texturePriv().mipMapsAreDirty()) { |
| 481 | gpu->regenerateMipMapLevels(tex); |
| 482 | } |
bsalomon | 6a2b194 | 2016-09-08 11:28:59 -0700 | [diff] [blame] | 483 | } |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 484 | |
| 485 | SkDEBUGCODE(this->validate()); |
Greg Daniel | 5131678 | 2017-08-02 15:10:09 +0000 | [diff] [blame] | 486 | return result; |
bsalomon | 6a2b194 | 2016-09-08 11:28:59 -0700 | [diff] [blame] | 487 | } |
| 488 | |
Chris Dalton | fe199b7 | 2017-05-05 11:26:15 -0400 | [diff] [blame] | 489 | void GrDrawingManager::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlushCBObject) { |
| 490 | fOnFlushCBObjects.push_back(onFlushCBObject); |
Robert Phillips | eb35f4d | 2017-03-21 07:56:47 -0400 | [diff] [blame] | 491 | } |
| 492 | |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 493 | #if GR_TEST_UTILS |
| 494 | void GrDrawingManager::testingOnly_removeOnFlushCallbackObject(GrOnFlushCallbackObject* cb) { |
| 495 | int n = std::find(fOnFlushCBObjects.begin(), fOnFlushCBObjects.end(), cb) - |
| 496 | fOnFlushCBObjects.begin(); |
| 497 | SkASSERT(n < fOnFlushCBObjects.count()); |
| 498 | fOnFlushCBObjects.removeShuffle(n); |
| 499 | } |
| 500 | #endif |
| 501 | |
Robert Phillips | 6200036 | 2018-02-01 09:10:04 -0500 | [diff] [blame] | 502 | void GrDrawingManager::moveOpListsToDDL(SkDeferredDisplayList* ddl) { |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 503 | SkDEBUGCODE(this->validate()); |
| 504 | |
| 505 | // no opList should receive a new command after this |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 506 | fDAG.closeAll(fContext->priv().caps()); |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 507 | fActiveOpList = nullptr; |
Robert Phillips | 7a13705 | 2018-02-01 11:23:12 -0500 | [diff] [blame] | 508 | |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 509 | fDAG.swap(&ddl->fOpLists); |
Robert Phillips | 867ce8f | 2018-06-21 10:28:36 -0400 | [diff] [blame] | 510 | |
Robert Phillips | 774168e | 2018-05-31 12:43:27 -0400 | [diff] [blame] | 511 | if (fPathRendererChain) { |
| 512 | if (auto ccpr = fPathRendererChain->getCoverageCountingPathRenderer()) { |
| 513 | ddl->fPendingPaths = ccpr->detachPendingPaths(); |
| 514 | } |
| 515 | } |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 516 | |
| 517 | SkDEBUGCODE(this->validate()); |
Robert Phillips | 6200036 | 2018-02-01 09:10:04 -0500 | [diff] [blame] | 518 | } |
| 519 | |
| 520 | void GrDrawingManager::copyOpListsFromDDL(const SkDeferredDisplayList* ddl, |
| 521 | GrRenderTargetProxy* newDest) { |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 522 | SkDEBUGCODE(this->validate()); |
| 523 | |
| 524 | if (fActiveOpList) { |
| 525 | // This is a temporary fix for the partial-MDB world. In that world we're not |
| 526 | // reordering so ops that (in the single opList world) would've just glommed onto the |
| 527 | // end of the single opList but referred to a far earlier RT need to appear in their |
| 528 | // own opList. |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 529 | fActiveOpList->makeClosed(*fContext->priv().caps()); |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 530 | fActiveOpList = nullptr; |
| 531 | } |
| 532 | |
Robert Phillips | 6200036 | 2018-02-01 09:10:04 -0500 | [diff] [blame] | 533 | // Here we jam the proxy that backs the current replay SkSurface into the LazyProxyData. |
| 534 | // The lazy proxy that references it (in the copied opLists) will steal its GrTexture. |
| 535 | ddl->fLazyProxyData->fReplayDest = newDest; |
Robert Phillips | 774168e | 2018-05-31 12:43:27 -0400 | [diff] [blame] | 536 | |
| 537 | if (ddl->fPendingPaths.size()) { |
| 538 | GrCoverageCountingPathRenderer* ccpr = this->getCoverageCountingPathRenderer(); |
| 539 | |
| 540 | ccpr->mergePendingPaths(ddl->fPendingPaths); |
| 541 | } |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 542 | |
| 543 | fDAG.add(ddl->fOpLists); |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 544 | |
| 545 | SkDEBUGCODE(this->validate()); |
Robert Phillips | 6200036 | 2018-02-01 09:10:04 -0500 | [diff] [blame] | 546 | } |
| 547 | |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 548 | #ifdef SK_DEBUG |
| 549 | void GrDrawingManager::validate() const { |
Robert Phillips | b7a98ef | 2018-10-10 09:26:00 -0400 | [diff] [blame] | 550 | if (fDAG.sortingOpLists() && fReduceOpListSplitting) { |
| 551 | SkASSERT(!fActiveOpList); |
| 552 | } else { |
| 553 | if (fActiveOpList) { |
| 554 | SkASSERT(!fDAG.empty()); |
| 555 | SkASSERT(!fActiveOpList->isClosed()); |
| 556 | SkASSERT(fActiveOpList == fDAG.back()); |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 557 | } |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 558 | |
Robert Phillips | b7a98ef | 2018-10-10 09:26:00 -0400 | [diff] [blame] | 559 | for (int i = 0; i < fDAG.numOpLists(); ++i) { |
| 560 | if (fActiveOpList != fDAG.opList(i)) { |
| 561 | SkASSERT(fDAG.opList(i)->isClosed()); |
| 562 | } |
| 563 | } |
| 564 | |
| 565 | if (!fDAG.empty() && !fDAG.back()->isClosed()) { |
| 566 | SkASSERT(fActiveOpList == fDAG.back()); |
| 567 | } |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 568 | } |
| 569 | } |
| 570 | #endif |
| 571 | |
Robert Phillips | 941d144 | 2017-06-14 16:37:02 -0400 | [diff] [blame] | 572 | sk_sp<GrRenderTargetOpList> GrDrawingManager::newRTOpList(GrRenderTargetProxy* rtp, |
| 573 | bool managedOpList) { |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 574 | SkDEBUGCODE(this->validate()); |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 575 | SkASSERT(fContext); |
| 576 | |
Robert Phillips | b7a98ef | 2018-10-10 09:26:00 -0400 | [diff] [blame] | 577 | if (fDAG.sortingOpLists() && fReduceOpListSplitting) { |
| 578 | // In this case we need to close all the opLists that rely on the current contents of |
| 579 | // 'rtp'. That is bc we're going to update the content of the proxy so they need to be |
| 580 | // split in case they use both the old and new content. (This is a bit of an overkill: |
| 581 | // they really only need to be split if they ever reference proxy's contents again but |
| 582 | // that is hard to predict/handle). |
| 583 | if (GrOpList* lastOpList = rtp->getLastOpList()) { |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 584 | lastOpList->closeThoseWhoDependOnMe(*fContext->priv().caps()); |
Robert Phillips | 46acf9d | 2018-10-09 09:31:40 -0400 | [diff] [blame] | 585 | } |
Robert Phillips | b7a98ef | 2018-10-10 09:26:00 -0400 | [diff] [blame] | 586 | } else if (fActiveOpList) { |
| 587 | // This is a temporary fix for the partial-MDB world. In that world we're not |
| 588 | // reordering so ops that (in the single opList world) would've just glommed onto the |
| 589 | // end of the single opList but referred to a far earlier RT need to appear in their |
| 590 | // own opList. |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 591 | fActiveOpList->makeClosed(*fContext->priv().caps()); |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 592 | fActiveOpList = nullptr; |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 593 | } |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 594 | |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 595 | auto resourceProvider = fContext->priv().resourceProvider(); |
Robert Phillips | f35fd8d | 2018-01-22 10:48:15 -0500 | [diff] [blame] | 596 | |
Robert Phillips | 0c4b7b1 | 2018-03-06 08:20:37 -0500 | [diff] [blame] | 597 | sk_sp<GrRenderTargetOpList> opList(new GrRenderTargetOpList( |
Robert Phillips | 0c4b7b1 | 2018-03-06 08:20:37 -0500 | [diff] [blame] | 598 | resourceProvider, |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 599 | fContext->priv().refOpMemoryPool(), |
Robert Phillips | 3a9710b | 2018-03-27 17:51:55 -0400 | [diff] [blame] | 600 | rtp, |
Robert Phillips | d684148 | 2019-02-08 10:29:20 -0500 | [diff] [blame^] | 601 | fContext->priv().auditTrail())); |
Robert Phillips | f5442bb | 2017-04-17 14:18:34 -0400 | [diff] [blame] | 602 | SkASSERT(rtp->getLastOpList() == opList.get()); |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 603 | |
Robert Phillips | 941d144 | 2017-06-14 16:37:02 -0400 | [diff] [blame] | 604 | if (managedOpList) { |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 605 | fDAG.add(opList); |
Robert Phillips | b7a98ef | 2018-10-10 09:26:00 -0400 | [diff] [blame] | 606 | |
| 607 | if (!fDAG.sortingOpLists() || !fReduceOpListSplitting) { |
| 608 | fActiveOpList = opList.get(); |
| 609 | } |
Robert Phillips | 941d144 | 2017-06-14 16:37:02 -0400 | [diff] [blame] | 610 | } |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 611 | |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 612 | SkDEBUGCODE(this->validate()); |
Robert Phillips | f5442bb | 2017-04-17 14:18:34 -0400 | [diff] [blame] | 613 | return opList; |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 614 | } |
| 615 | |
Robert Phillips | b6deea8 | 2017-05-11 14:14:30 -0400 | [diff] [blame] | 616 | sk_sp<GrTextureOpList> GrDrawingManager::newTextureOpList(GrTextureProxy* textureProxy) { |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 617 | SkDEBUGCODE(this->validate()); |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 618 | SkASSERT(fContext); |
| 619 | |
Robert Phillips | b7a98ef | 2018-10-10 09:26:00 -0400 | [diff] [blame] | 620 | if (fDAG.sortingOpLists() && fReduceOpListSplitting) { |
| 621 | // In this case we need to close all the opLists that rely on the current contents of |
| 622 | // 'texture'. That is bc we're going to update the content of the proxy so they need to |
| 623 | // be split in case they use both the old and new content. (This is a bit of an |
| 624 | // overkill: they really only need to be split if they ever reference proxy's contents |
| 625 | // again but that is hard to predict/handle). |
| 626 | if (GrOpList* lastOpList = textureProxy->getLastOpList()) { |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 627 | lastOpList->closeThoseWhoDependOnMe(*fContext->priv().caps()); |
Robert Phillips | 46acf9d | 2018-10-09 09:31:40 -0400 | [diff] [blame] | 628 | } |
Robert Phillips | b7a98ef | 2018-10-10 09:26:00 -0400 | [diff] [blame] | 629 | } else if (fActiveOpList) { |
| 630 | // This is a temporary fix for the partial-MDB world. In that world we're not |
| 631 | // reordering so ops that (in the single opList world) would've just glommed onto the |
| 632 | // end of the single opList but referred to a far earlier RT need to appear in their |
| 633 | // own opList. |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 634 | fActiveOpList->makeClosed(*fContext->priv().caps()); |
Robert Phillips | b7a98ef | 2018-10-10 09:26:00 -0400 | [diff] [blame] | 635 | fActiveOpList = nullptr; |
Robert Phillips | 6cdc22c | 2017-05-11 16:29:14 -0400 | [diff] [blame] | 636 | } |
| 637 | |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 638 | sk_sp<GrTextureOpList> opList(new GrTextureOpList(fContext->priv().resourceProvider(), |
| 639 | fContext->priv().refOpMemoryPool(), |
Robert Phillips | 5efd5ea | 2017-05-30 13:47:32 -0400 | [diff] [blame] | 640 | textureProxy, |
Robert Phillips | d684148 | 2019-02-08 10:29:20 -0500 | [diff] [blame^] | 641 | fContext->priv().auditTrail())); |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 642 | |
Robert Phillips | 6cdc22c | 2017-05-11 16:29:14 -0400 | [diff] [blame] | 643 | SkASSERT(textureProxy->getLastOpList() == opList.get()); |
Robert Phillips | 4a39504 | 2017-04-24 16:27:17 +0000 | [diff] [blame] | 644 | |
Robert Phillips | 22310d6 | 2018-09-05 11:07:21 -0400 | [diff] [blame] | 645 | fDAG.add(opList); |
Robert Phillips | b7a98ef | 2018-10-10 09:26:00 -0400 | [diff] [blame] | 646 | if (!fDAG.sortingOpLists() || !fReduceOpListSplitting) { |
| 647 | fActiveOpList = opList.get(); |
| 648 | } |
Robert Phillips | 6cdc22c | 2017-05-11 16:29:14 -0400 | [diff] [blame] | 649 | |
Robert Phillips | 38d64b0 | 2018-09-04 13:23:26 -0400 | [diff] [blame] | 650 | SkDEBUGCODE(this->validate()); |
Robert Phillips | 4a39504 | 2017-04-24 16:27:17 +0000 | [diff] [blame] | 651 | return opList; |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 652 | } |
| 653 | |
Herb Derby | 26cbe51 | 2018-05-24 14:39:01 -0400 | [diff] [blame] | 654 | GrTextContext* GrDrawingManager::getTextContext() { |
| 655 | if (!fTextContext) { |
| 656 | fTextContext = GrTextContext::Make(fOptionsForTextContext); |
brianosman | 86e7626 | 2016-08-11 12:17:31 -0700 | [diff] [blame] | 657 | } |
| 658 | |
Herb Derby | 26cbe51 | 2018-05-24 14:39:01 -0400 | [diff] [blame] | 659 | return fTextContext.get(); |
brianosman | 86e7626 | 2016-08-11 12:17:31 -0700 | [diff] [blame] | 660 | } |
| 661 | |
robertphillips | 6873782 | 2015-10-29 12:12:21 -0700 | [diff] [blame] | 662 | /* |
| 663 | * This method finds a path renderer that can draw the specified path on |
| 664 | * the provided target. |
| 665 | * Due to its expense, the software path renderer has split out so it can |
| 666 | * can be individually allowed/disallowed via the "allowSW" boolean. |
| 667 | */ |
| 668 | GrPathRenderer* GrDrawingManager::getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, |
| 669 | bool allowSW, |
| 670 | GrPathRendererChain::DrawType drawType, |
| 671 | GrPathRenderer::StencilSupport* stencilSupport) { |
| 672 | |
| 673 | if (!fPathRendererChain) { |
Ben Wagner | 9ec70c6 | 2018-07-12 13:30:47 -0400 | [diff] [blame] | 674 | fPathRendererChain.reset(new GrPathRendererChain(fContext, fOptionsForPathRendererChain)); |
robertphillips | 6873782 | 2015-10-29 12:12:21 -0700 | [diff] [blame] | 675 | } |
| 676 | |
| 677 | GrPathRenderer* pr = fPathRendererChain->getPathRenderer(args, drawType, stencilSupport); |
| 678 | if (!pr && allowSW) { |
Brian Salomon | e7df0bb | 2018-05-07 14:44:57 -0400 | [diff] [blame] | 679 | auto swPR = this->getSoftwarePathRenderer(); |
| 680 | if (GrPathRenderer::CanDrawPath::kNo != swPR->canDrawPath(args)) { |
| 681 | pr = swPR; |
Brian Salomon | 0e8fc8b | 2016-12-09 15:10:07 -0500 | [diff] [blame] | 682 | } |
robertphillips | 6873782 | 2015-10-29 12:12:21 -0700 | [diff] [blame] | 683 | } |
| 684 | |
| 685 | return pr; |
| 686 | } |
| 687 | |
Brian Salomon | e7df0bb | 2018-05-07 14:44:57 -0400 | [diff] [blame] | 688 | GrPathRenderer* GrDrawingManager::getSoftwarePathRenderer() { |
| 689 | if (!fSoftwarePathRenderer) { |
Ben Wagner | 9ec70c6 | 2018-07-12 13:30:47 -0400 | [diff] [blame] | 690 | fSoftwarePathRenderer.reset( |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 691 | new GrSoftwarePathRenderer(fContext->priv().proxyProvider(), |
Ben Wagner | 9ec70c6 | 2018-07-12 13:30:47 -0400 | [diff] [blame] | 692 | fOptionsForPathRendererChain.fAllowPathMaskCaching)); |
Brian Salomon | e7df0bb | 2018-05-07 14:44:57 -0400 | [diff] [blame] | 693 | } |
Ben Wagner | 9ec70c6 | 2018-07-12 13:30:47 -0400 | [diff] [blame] | 694 | return fSoftwarePathRenderer.get(); |
Brian Salomon | e7df0bb | 2018-05-07 14:44:57 -0400 | [diff] [blame] | 695 | } |
| 696 | |
Chris Dalton | fddb6c0 | 2017-11-04 15:22:22 -0600 | [diff] [blame] | 697 | GrCoverageCountingPathRenderer* GrDrawingManager::getCoverageCountingPathRenderer() { |
| 698 | if (!fPathRendererChain) { |
Ben Wagner | 9ec70c6 | 2018-07-12 13:30:47 -0400 | [diff] [blame] | 699 | fPathRendererChain.reset(new GrPathRendererChain(fContext, fOptionsForPathRendererChain)); |
Chris Dalton | fddb6c0 | 2017-11-04 15:22:22 -0600 | [diff] [blame] | 700 | } |
| 701 | return fPathRendererChain->getCoverageCountingPathRenderer(); |
| 702 | } |
| 703 | |
Brian Salomon | 653f42f | 2018-07-10 10:07:31 -0400 | [diff] [blame] | 704 | void GrDrawingManager::flushIfNecessary() { |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 705 | GrResourceCache* resourceCache = fContext->priv().getResourceCache(); |
Brian Salomon | 653f42f | 2018-07-10 10:07:31 -0400 | [diff] [blame] | 706 | if (resourceCache && resourceCache->requestsFlush()) { |
Brian Salomon | 57d2bea | 2018-09-10 09:35:41 -0400 | [diff] [blame] | 707 | this->flush(nullptr, 0, nullptr); |
| 708 | resourceCache->purgeAsNeeded(); |
Brian Salomon | 653f42f | 2018-07-10 10:07:31 -0400 | [diff] [blame] | 709 | } |
| 710 | } |
| 711 | |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 712 | sk_sp<GrRenderTargetContext> GrDrawingManager::makeRenderTargetContext( |
Robert Phillips | 3743013 | 2016-11-09 06:50:43 -0500 | [diff] [blame] | 713 | sk_sp<GrSurfaceProxy> sProxy, |
Robert Phillips | c7635fa | 2016-10-28 13:25:24 -0400 | [diff] [blame] | 714 | sk_sp<SkColorSpace> colorSpace, |
Robert Phillips | 941d144 | 2017-06-14 16:37:02 -0400 | [diff] [blame] | 715 | const SkSurfaceProps* surfaceProps, |
| 716 | bool managedOpList) { |
Robert Phillips | 3743013 | 2016-11-09 06:50:43 -0500 | [diff] [blame] | 717 | if (this->wasAbandoned() || !sProxy->asRenderTargetProxy()) { |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 718 | return nullptr; |
| 719 | } |
| 720 | |
brianosman | 0e22eb8 | 2016-08-30 07:07:59 -0700 | [diff] [blame] | 721 | // SkSurface catches bad color space usage at creation. This check handles anything that slips |
Brian Salomon | 366093f | 2018-02-13 09:25:22 -0500 | [diff] [blame] | 722 | // by, including internal usage. |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 723 | if (!SkSurface_Gpu::Valid(fContext->priv().caps(), sProxy->config(), colorSpace.get())) { |
brianosman | a9c3c6a | 2016-09-29 10:08:36 -0700 | [diff] [blame] | 724 | SkDEBUGFAIL("Invalid config and colorspace combination"); |
brianosman | 0e22eb8 | 2016-08-30 07:07:59 -0700 | [diff] [blame] | 725 | return nullptr; |
| 726 | } |
joshualitt | 96880d9 | 2016-02-16 10:36:53 -0800 | [diff] [blame] | 727 | |
Robert Phillips | 2c86249 | 2017-01-18 10:08:39 -0500 | [diff] [blame] | 728 | sk_sp<GrRenderTargetProxy> rtp(sk_ref_sp(sProxy->asRenderTargetProxy())); |
| 729 | |
Robert Phillips | 0c4b7b1 | 2018-03-06 08:20:37 -0500 | [diff] [blame] | 730 | return sk_sp<GrRenderTargetContext>(new GrRenderTargetContext( |
| 731 | fContext, this, std::move(rtp), |
| 732 | std::move(colorSpace), |
| 733 | surfaceProps, |
Robert Phillips | d684148 | 2019-02-08 10:29:20 -0500 | [diff] [blame^] | 734 | fContext->priv().auditTrail(), |
Robert Phillips | 0c4b7b1 | 2018-03-06 08:20:37 -0500 | [diff] [blame] | 735 | fSingleOwner, managedOpList)); |
robertphillips | 3dc6ae5 | 2015-10-20 09:54:32 -0700 | [diff] [blame] | 736 | } |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 737 | |
Robert Phillips | 2c86249 | 2017-01-18 10:08:39 -0500 | [diff] [blame] | 738 | sk_sp<GrTextureContext> GrDrawingManager::makeTextureContext(sk_sp<GrSurfaceProxy> sProxy, |
| 739 | sk_sp<SkColorSpace> colorSpace) { |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 740 | if (this->wasAbandoned() || !sProxy->asTextureProxy()) { |
| 741 | return nullptr; |
| 742 | } |
| 743 | |
Robert Phillips | 2c86249 | 2017-01-18 10:08:39 -0500 | [diff] [blame] | 744 | // SkSurface catches bad color space usage at creation. This check handles anything that slips |
Brian Salomon | 366093f | 2018-02-13 09:25:22 -0500 | [diff] [blame] | 745 | // by, including internal usage. |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 746 | if (!SkSurface_Gpu::Valid(fContext->priv().caps(), sProxy->config(), colorSpace.get())) { |
Robert Phillips | 2c86249 | 2017-01-18 10:08:39 -0500 | [diff] [blame] | 747 | SkDEBUGFAIL("Invalid config and colorspace combination"); |
| 748 | return nullptr; |
| 749 | } |
| 750 | |
Robert Phillips | 383c418 | 2018-02-07 12:47:44 -0500 | [diff] [blame] | 751 | // GrTextureRenderTargets should always be using a GrRenderTargetContext |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 752 | SkASSERT(!sProxy->asRenderTargetProxy()); |
| 753 | |
| 754 | sk_sp<GrTextureProxy> textureProxy(sk_ref_sp(sProxy->asTextureProxy())); |
| 755 | |
| 756 | return sk_sp<GrTextureContext>(new GrTextureContext(fContext, this, std::move(textureProxy), |
Robert Phillips | 2c86249 | 2017-01-18 10:08:39 -0500 | [diff] [blame] | 757 | std::move(colorSpace), |
Robert Phillips | d684148 | 2019-02-08 10:29:20 -0500 | [diff] [blame^] | 758 | fContext->priv().auditTrail(), |
Robert Phillips | 2c86249 | 2017-01-18 10:08:39 -0500 | [diff] [blame] | 759 | fSingleOwner)); |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 760 | } |