blob: 4b5f1bb56316979a791fc66fee9a88d4be5042af [file] [log] [blame]
bsalomon@google.com27847de2011-02-22 20:59:41 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * Copyright 2011 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.
bsalomon@google.com27847de2011-02-22 20:59:41 +00006 */
7
bsalomon@google.com1fadb202011-12-12 16:10:08 +00008#include "GrContext.h"
Brian Salomon5f33a8c2018-02-26 14:32:39 -05009#include "GrBackendSemaphore.h"
robertphillips77a2e522015-10-17 07:43:27 -070010#include "GrDrawingManager.h"
Robert Phillips646e4292017-06-13 12:44:56 -040011#include "GrGpu.h"
Robert Phillipsc994a932018-06-19 13:09:54 -040012#include "GrMemoryPool.h"
Robert Phillipsdbaf3172019-02-06 15:12:53 -050013#include "GrPathRendererChain.h"
Robert Phillips1afd4cd2018-01-08 13:40:32 -050014#include "GrProxyProvider.h"
Brian Salomonc65aec92017-03-09 09:03:58 -050015#include "GrRenderTargetProxy.h"
bsalomon0ea80f42015-02-11 10:49:59 -080016#include "GrResourceCache.h"
bsalomond309e7a2015-04-30 14:18:54 -070017#include "GrResourceProvider.h"
Greg Danield85f97d2017-03-07 13:37:21 -050018#include "GrSemaphore.h"
robertphillips@google.com72176b22012-05-23 13:19:12 +000019#include "GrSoftwarePathRenderer.h"
Brian Salomondcbb9d92017-07-19 10:53:20 -040020#include "GrTracing.h"
Robert Phillipsd5f9cdd2018-01-31 09:29:48 -050021#include "SkDeferredDisplayList.h"
Brian Osman3b655982017-03-07 16:58:08 -050022#include "SkGr.h"
Mike Reed7fcfb622018-02-09 13:26:46 -050023#include "SkImageInfoPriv.h"
Brian Osman51279982017-08-23 10:12:00 -040024#include "SkMakeUnique.h"
Robert Phillips6b6fcc72018-03-30 13:57:00 -040025#include "SkSurface_Gpu.h"
Brian Osman51279982017-08-23 10:12:00 -040026#include "SkTaskGroup.h"
Khushal71652e22018-10-29 13:05:36 -070027#include "SkTraceMemoryDump.h"
joshualitt5478d422014-11-14 16:00:38 -080028#include "effects/GrConfigConversionEffect.h"
Ethan Nicholas00543112018-07-31 09:44:36 -040029#include "effects/GrSkSLFP.h"
Chris Dalton6c3879d2018-11-01 11:13:19 -060030#include "ccpr/GrCoverageCountingPathRenderer.h"
Brian Salomon5f33a8c2018-02-26 14:32:39 -050031#include "text/GrTextBlobCache.h"
Robert Phillipsdbaf3172019-02-06 15:12:53 -050032#include "text/GrTextContext.h"
Mike Klein0ec1c572018-12-04 11:52:51 -050033#include <atomic>
34#include <unordered_map>
Greg Danielb76a72a2017-07-13 15:07:54 -040035
Robert Phillipse78b7252017-04-06 07:59:41 -040036#define ASSERT_OWNED_PROXY(P) \
Brian Salomonfd98c2c2018-07-31 17:25:29 -040037 SkASSERT(!(P) || !((P)->peekTexture()) || (P)->peekTexture()->getContext() == this)
Robert Phillips7ee385e2017-03-30 08:02:11 -040038
tfarina@chromium.orgf6de4752013-08-17 00:02:59 +000039#define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this)
joshualitt1de610a2016-01-06 08:26:09 -080040#define ASSERT_SINGLE_OWNER \
Robert Phillipsa41c6852019-02-07 10:44:10 -050041 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner());)
Robert Phillipsa9162df2019-02-11 14:12:03 -050042#define RETURN_IF_ABANDONED if (this->abandoned()) { return; }
43#define RETURN_FALSE_IF_ABANDONED if (this->abandoned()) { return false; }
44#define RETURN_NULL_IF_ABANDONED if (this->abandoned()) { return nullptr; }
bsalomon@google.combc4b6542011-11-19 13:56:11 +000045
robertphillipsea461502015-05-26 11:38:03 -070046////////////////////////////////////////////////////////////////////////////////
47
Robert Phillipsa41c6852019-02-07 10:44:10 -050048GrContext::GrContext(GrBackendApi backend, const GrContextOptions& options, int32_t contextID)
49 : INHERITED(backend, options, contextID) {
halcanary96fcdcc2015-08-27 07:41:13 -070050 fResourceCache = nullptr;
51 fResourceProvider = nullptr;
bsalomon@google.com6e4e6502013-02-25 20:12:45 +000052}
53
Robert Phillips292a6b22019-02-14 14:49:02 -050054GrContext::~GrContext() {
55 ASSERT_SINGLE_OWNER
56
Robert Phillips6a6de562019-02-15 15:19:15 -050057 if (this->drawingManager()) {
58 this->drawingManager()->cleanup();
Robert Phillips292a6b22019-02-14 14:49:02 -050059 }
60 delete fResourceProvider;
61 delete fResourceCache;
Robert Phillips292a6b22019-02-14 14:49:02 -050062}
63
Robert Phillipsbb606772019-02-04 17:50:57 -050064bool GrContext::init(sk_sp<const GrCaps> caps, sk_sp<GrSkSLFPFactoryCache> FPFactoryCache) {
Greg Danielb76a72a2017-07-13 15:07:54 -040065 ASSERT_SINGLE_OWNER
Robert Phillipsfde6fa02018-03-02 08:53:14 -050066 SkASSERT(fThreadSafeProxy); // needs to have been initialized by derived classes
Robert Phillipsa41c6852019-02-07 10:44:10 -050067 SkASSERT(this->proxyProvider());
Robert Phillips88260b52018-01-19 12:56:09 -050068
Robert Phillipsbb606772019-02-04 17:50:57 -050069 if (!INHERITED::init(std::move(caps), std::move(FPFactoryCache))) {
70 return false;
71 }
72
Robert Phillips69893702019-02-22 11:16:30 -050073 SkASSERT(this->drawingManager());
Robert Phillipsbb606772019-02-04 17:50:57 -050074 SkASSERT(this->caps());
Robert Phillips2184fb72019-02-21 16:11:41 -050075 SkASSERT(this->getGlyphCache());
76 SkASSERT(this->getTextBlobCache());
Robert Phillipsbb606772019-02-04 17:50:57 -050077
Robert Phillips88260b52018-01-19 12:56:09 -050078 if (fGpu) {
Robert Phillipsa41c6852019-02-07 10:44:10 -050079 fResourceCache = new GrResourceCache(this->caps(), this->singleOwner(), this->contextID());
80 fResourceProvider = new GrResourceProvider(fGpu.get(), fResourceCache, this->singleOwner(),
Robert Phillips292a6b22019-02-14 14:49:02 -050081 this->explicitlyAllocateGPUResources());
Robert Phillips88260b52018-01-19 12:56:09 -050082 }
83
Robert Phillips88260b52018-01-19 12:56:09 -050084 if (fResourceCache) {
Robert Phillipsa41c6852019-02-07 10:44:10 -050085 fResourceCache->setProxyProvider(this->proxyProvider());
Robert Phillips88260b52018-01-19 12:56:09 -050086 }
Robert Phillips1afd4cd2018-01-08 13:40:32 -050087
bsalomon@google.com6e4e6502013-02-25 20:12:45 +000088 fDidTestPMConversions = false;
89
Robert Phillipsfde6fa02018-03-02 08:53:14 -050090 // DDL TODO: we need to think through how the task group & persistent cache
91 // get passed on to/shared between all the DDLRecorders created with this context.
Robert Phillipsc1541ae2019-02-04 12:05:37 -050092 if (this->options().fExecutor) {
93 fTaskGroup = skstd::make_unique<SkTaskGroup>(*this->options().fExecutor);
Brian Osman51279982017-08-23 10:12:00 -040094 }
95
Robert Phillipsc1541ae2019-02-04 12:05:37 -050096 fPersistentCache = this->options().fPersistentCache;
Ethan Nicholasd1b2eec2017-11-01 15:45:43 -040097
Brian Salomon91a3e522017-06-23 10:58:19 -040098 return true;
bsalomon@google.comc0af3172012-06-15 14:10:09 +000099}
100
Robert Phillips4217ea72019-01-30 13:08:28 -0500101sk_sp<GrContextThreadSafeProxy> GrContext::threadSafeProxy() {
102 return fThreadSafeProxy;
103}
104
Brian Salomonc7fe0f72018-05-11 10:14:21 -0400105//////////////////////////////////////////////////////////////////////////////
106
bsalomon2354f842014-07-28 13:48:36 -0700107void GrContext::abandonContext() {
Robert Phillipsa9162df2019-02-11 14:12:03 -0500108 if (this->abandoned()) {
109 return;
110 }
joshualitt1de610a2016-01-06 08:26:09 -0800111
Robert Phillipsa9162df2019-02-11 14:12:03 -0500112 INHERITED::abandonContext();
113
bsalomond309e7a2015-04-30 14:18:54 -0700114 fResourceProvider->abandon();
robertphillips0dfa62c2015-11-16 06:23:31 -0800115
Robert Phillipsa9162df2019-02-11 14:12:03 -0500116 // Need to cleanup the drawing manager first so all the render targets
robertphillips0dfa62c2015-11-16 06:23:31 -0800117 // will be released/forgotten before they too are abandoned.
Robert Phillips6a6de562019-02-15 15:19:15 -0500118 this->drawingManager()->cleanup();
robertphillips0dfa62c2015-11-16 06:23:31 -0800119
bsalomon@google.com205d4602011-04-25 12:43:45 +0000120 // abandon first to so destructors
121 // don't try to free the resources in the API.
bsalomon0ea80f42015-02-11 10:49:59 -0800122 fResourceCache->abandonAll();
bsalomonc8dc1f72014-08-21 13:02:13 -0700123
bsalomon6e2aad42016-04-01 11:54:31 -0700124 fGpu->disconnect(GrGpu::DisconnectType::kAbandon);
Khushalc421ca12018-06-26 14:38:34 -0700125}
126
bsalomon6e2aad42016-04-01 11:54:31 -0700127void GrContext::releaseResourcesAndAbandonContext() {
Brian Salomon614c1a82018-12-19 15:42:06 -0500128 if (this->abandoned()) {
129 return;
130 }
Robert Phillipsa9162df2019-02-11 14:12:03 -0500131
132 INHERITED::abandonContext();
133
bsalomon6e2aad42016-04-01 11:54:31 -0700134 fResourceProvider->abandon();
135
Robert Phillipsa9162df2019-02-11 14:12:03 -0500136 // Need to cleanup the drawing manager first so all the render targets
bsalomon6e2aad42016-04-01 11:54:31 -0700137 // will be released/forgotten before they too are abandoned.
Robert Phillips6a6de562019-02-15 15:19:15 -0500138 this->drawingManager()->cleanup();
bsalomon6e2aad42016-04-01 11:54:31 -0700139
140 // Release all resources in the backend 3D API.
141 fResourceCache->releaseAll();
142
143 fGpu->disconnect(GrGpu::DisconnectType::kCleanup);
bsalomon@google.com8fe72472011-03-30 21:26:44 +0000144}
145
Brian Salomon1f05d452019-02-08 12:33:08 -0500146void GrContext::resetGLTextureBindings() {
147 if (this->abandoned() || this->backend() != GrBackendApi::kOpenGL) {
148 return;
149 }
150 fGpu->resetTextureBindings();
151}
152
bsalomon@google.com0a208a12013-06-28 18:57:35 +0000153void GrContext::resetContext(uint32_t state) {
joshualitt1de610a2016-01-06 08:26:09 -0800154 ASSERT_SINGLE_OWNER
bsalomon@google.com0a208a12013-06-28 18:57:35 +0000155 fGpu->markContextDirty(state);
bsalomon@google.com8fe72472011-03-30 21:26:44 +0000156}
157
158void GrContext::freeGpuResources() {
joshualitt1de610a2016-01-06 08:26:09 -0800159 ASSERT_SINGLE_OWNER
160
Robert Phillips2184fb72019-02-21 16:11:41 -0500161 // TODO: the glyph cache doesn't hold any GpuResources so this call should not be needed here.
162 // Some slack in the GrTextBlob's implementation requires it though. That could be fixed.
163 this->getGlyphCache()->freeAll();
robertphillips68737822015-10-29 12:12:21 -0700164
Robert Phillips6a6de562019-02-15 15:19:15 -0500165 this->drawingManager()->freeGpuResources();
bsalomon3033b9f2015-04-13 11:09:56 -0700166
167 fResourceCache->purgeAllUnlocked();
bsalomon@google.com27847de2011-02-22 20:59:41 +0000168}
169
Robert Phillips6eba0632018-03-28 12:25:42 -0400170void GrContext::purgeUnlockedResources(bool scratchResourcesOnly) {
171 ASSERT_SINGLE_OWNER
172 fResourceCache->purgeUnlockedResources(scratchResourcesOnly);
173 fResourceCache->purgeAsNeeded();
Robert Phillips2184fb72019-02-21 16:11:41 -0500174
175 // The textBlob Cache doesn't actually hold any GPU resource but this is a convenient
176 // place to purge stale blobs
177 this->getTextBlobCache()->purgeStaleBlobs();
Robert Phillips6eba0632018-03-28 12:25:42 -0400178}
179
Jim Van Verth76d917c2017-12-13 09:26:37 -0500180void GrContext::performDeferredCleanup(std::chrono::milliseconds msNotUsed) {
Brian Salomon5e150852017-03-22 14:53:13 -0400181 ASSERT_SINGLE_OWNER
Chris Dalton6c3879d2018-11-01 11:13:19 -0600182
183 auto purgeTime = GrStdSteadyClock::now() - msNotUsed;
184
Jim Van Verth76d917c2017-12-13 09:26:37 -0500185 fResourceCache->purgeAsNeeded();
Chris Dalton6c3879d2018-11-01 11:13:19 -0600186 fResourceCache->purgeResourcesNotUsedSince(purgeTime);
187
Robert Phillips6a6de562019-02-15 15:19:15 -0500188 if (auto ccpr = this->drawingManager()->getCoverageCountingPathRenderer()) {
Robert Phillipsa41c6852019-02-07 10:44:10 -0500189 ccpr->purgeCacheEntriesOlderThan(this->proxyProvider(), purgeTime);
Chris Dalton6c3879d2018-11-01 11:13:19 -0600190 }
Jim Van Verth76d917c2017-12-13 09:26:37 -0500191
Robert Phillips2184fb72019-02-21 16:11:41 -0500192 // The textBlob Cache doesn't actually hold any GPU resource but this is a convenient
193 // place to purge stale blobs
194 this->getTextBlobCache()->purgeStaleBlobs();
Brian Salomon5e150852017-03-22 14:53:13 -0400195}
196
Derek Sollenberger5480a182017-05-25 16:43:59 -0400197void GrContext::purgeUnlockedResources(size_t bytesToPurge, bool preferScratchResources) {
198 ASSERT_SINGLE_OWNER
199 fResourceCache->purgeUnlockedResources(bytesToPurge, preferScratchResources);
200}
201
commit-bot@chromium.org95c20032014-05-09 14:29:32 +0000202void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const {
joshualitt1de610a2016-01-06 08:26:09 -0800203 ASSERT_SINGLE_OWNER
204
bsalomon71cb0c22014-11-14 12:10:14 -0800205 if (resourceCount) {
bsalomon0ea80f42015-02-11 10:49:59 -0800206 *resourceCount = fResourceCache->getBudgetedResourceCount();
bsalomon71cb0c22014-11-14 12:10:14 -0800207 }
208 if (resourceBytes) {
bsalomon0ea80f42015-02-11 10:49:59 -0800209 *resourceBytes = fResourceCache->getBudgetedResourceBytes();
bsalomon71cb0c22014-11-14 12:10:14 -0800210 }
commit-bot@chromium.orgd8a57af2014-03-19 21:19:16 +0000211}
212
Derek Sollenbergeree479142017-05-24 11:41:33 -0400213size_t GrContext::getResourceCachePurgeableBytes() const {
214 ASSERT_SINGLE_OWNER
215 return fResourceCache->getPurgeableBytes();
216}
217
bsalomon@google.comfea37b52011-04-25 15:51:06 +0000218////////////////////////////////////////////////////////////////////////////////
219
Robert Phillipsbb606772019-02-04 17:50:57 -0500220int GrContext::maxTextureSize() const { return this->caps()->maxTextureSize(); }
Brian Salomonf932a632018-04-05 12:46:09 -0400221
Robert Phillipsbb606772019-02-04 17:50:57 -0500222int GrContext::maxRenderTargetSize() const { return this->caps()->maxRenderTargetSize(); }
Brian Salomonf932a632018-04-05 12:46:09 -0400223
Brian Salomonbdecacf2018-02-02 20:32:49 -0500224bool GrContext::colorTypeSupportedAsImage(SkColorType colorType) const {
Brian Osman2b23c4b2018-06-01 12:25:08 -0400225 GrPixelConfig config = SkColorType2GrPixelConfig(colorType);
Robert Phillipsbb606772019-02-04 17:50:57 -0500226 return this->caps()->isConfigTexturable(config);
Brian Salomonbdecacf2018-02-02 20:32:49 -0500227}
228
229int GrContext::maxSurfaceSampleCountForColorType(SkColorType colorType) const {
Brian Osman2b23c4b2018-06-01 12:25:08 -0400230 GrPixelConfig config = SkColorType2GrPixelConfig(colorType);
Robert Phillipsbb606772019-02-04 17:50:57 -0500231 return this->caps()->maxRenderTargetSampleCount(config);
Brian Salomonbdecacf2018-02-02 20:32:49 -0500232}
233
234////////////////////////////////////////////////////////////////////////////////
235
bsalomonb77a9072016-09-07 10:02:04 -0700236void GrContext::flush() {
joshualitt1de610a2016-01-06 08:26:09 -0800237 ASSERT_SINGLE_OWNER
robertphillipsea461502015-05-26 11:38:03 -0700238 RETURN_IF_ABANDONED
Robert Phillips7ee385e2017-03-30 08:02:11 -0400239
Greg Danielbae71212019-03-01 15:24:35 -0500240 this->drawingManager()->flush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
241 SkSurface::kNone_FlushFlags, 0, nullptr);
Robert Phillips7ee385e2017-03-30 08:02:11 -0400242}
243
Greg Daniel51316782017-08-02 15:10:09 +0000244GrSemaphoresSubmitted GrContext::flushAndSignalSemaphores(int numSemaphores,
245 GrBackendSemaphore signalSemaphores[]) {
246 ASSERT_SINGLE_OWNER
Robert Phillipsa9162df2019-02-11 14:12:03 -0500247 if (this->abandoned()) {
248 return GrSemaphoresSubmitted::kNo;
249 }
Greg Daniel51316782017-08-02 15:10:09 +0000250
Greg Danielbae71212019-03-01 15:24:35 -0500251 return this->drawingManager()->flush(nullptr, SkSurface::BackendSurfaceAccess::kNoAccess,
252 SkSurface::kNone_FlushFlags, numSemaphores,
253 signalSemaphores);
Greg Daniel51316782017-08-02 15:10:09 +0000254}
255
Greg Daniela870b462019-01-08 15:49:46 -0500256////////////////////////////////////////////////////////////////////////////////
257
258void GrContext::storeVkPipelineCacheData() {
259 if (fGpu) {
260 fGpu->storeVkPipelineCacheData();
261 }
262}
263
264////////////////////////////////////////////////////////////////////////////////
265
Brian Salomonaff329b2017-08-11 09:40:37 -0400266std::unique_ptr<GrFragmentProcessor> GrContext::createPMToUPMEffect(
Brian Osman5ea96bf2018-10-02 14:58:05 -0400267 std::unique_ptr<GrFragmentProcessor> fp) {
Robert Phillips757914d2017-01-25 15:48:30 -0500268 ASSERT_SINGLE_OWNER
Brian Osman5ea96bf2018-10-02 14:58:05 -0400269 // We should have already called this->validPMUPMConversionExists() in this case
270 SkASSERT(fDidTestPMConversions);
271 // ...and it should have succeeded
272 SkASSERT(this->validPMUPMConversionExists());
Brian Osman409e74f2017-04-17 11:48:28 -0400273
Brian Osman5ea96bf2018-10-02 14:58:05 -0400274 return GrConfigConversionEffect::Make(std::move(fp), PMConversion::kToUnpremul);
Robert Phillips757914d2017-01-25 15:48:30 -0500275}
276
Brian Salomonaff329b2017-08-11 09:40:37 -0400277std::unique_ptr<GrFragmentProcessor> GrContext::createUPMToPMEffect(
Brian Osman5ea96bf2018-10-02 14:58:05 -0400278 std::unique_ptr<GrFragmentProcessor> fp) {
joshualitt1de610a2016-01-06 08:26:09 -0800279 ASSERT_SINGLE_OWNER
Brian Osman5ea96bf2018-10-02 14:58:05 -0400280 // We should have already called this->validPMUPMConversionExists() in this case
281 SkASSERT(fDidTestPMConversions);
282 // ...and it should have succeeded
283 SkASSERT(this->validPMUPMConversionExists());
Brian Osman409e74f2017-04-17 11:48:28 -0400284
Brian Osman5ea96bf2018-10-02 14:58:05 -0400285 return GrConfigConversionEffect::Make(std::move(fp), PMConversion::kToPremul);
bsalomon@google.coma04e8e82012-08-27 12:53:13 +0000286}
287
Brian Osman409e74f2017-04-17 11:48:28 -0400288bool GrContext::validPMUPMConversionExists() {
joshualitt1de610a2016-01-06 08:26:09 -0800289 ASSERT_SINGLE_OWNER
Brian Osman409e74f2017-04-17 11:48:28 -0400290 if (!fDidTestPMConversions) {
Brian Osman28804f32017-04-20 10:24:36 -0400291 fPMUPMConversionsRoundTrip = GrConfigConversionEffect::TestForPreservingPMConversions(this);
Brian Osman409e74f2017-04-17 11:48:28 -0400292 fDidTestPMConversions = true;
293 }
294
bsalomon636e8022015-07-29 06:08:46 -0700295 // The PM<->UPM tests fail or succeed together so we only need to check one.
Brian Osman28804f32017-04-20 10:24:36 -0400296 return fPMUPMConversionsRoundTrip;
bsalomon636e8022015-07-29 06:08:46 -0700297}
298
Khushal3e7548c2018-05-23 15:45:01 -0700299bool GrContext::supportsDistanceFieldText() const {
Robert Phillipsbb606772019-02-04 17:50:57 -0500300 return this->caps()->shaderCaps()->supportsDistanceFieldText();
Khushal3e7548c2018-05-23 15:45:01 -0700301}
302
bsalomon37f9a262015-02-02 13:00:10 -0800303//////////////////////////////////////////////////////////////////////////////
304
Robert Phillipsfc711a22018-02-13 17:03:00 -0500305// DDL TODO: remove 'maxResources'
Robert Phillips8d1e67e2017-12-04 13:48:14 -0500306void GrContext::getResourceCacheLimits(int* maxResources, size_t* maxResourceBytes) const {
joshualitt1de610a2016-01-06 08:26:09 -0800307 ASSERT_SINGLE_OWNER
Robert Phillips8d1e67e2017-12-04 13:48:14 -0500308 if (maxResources) {
309 *maxResources = fResourceCache->getMaxResourceCount();
bsalomon37f9a262015-02-02 13:00:10 -0800310 }
Robert Phillips8d1e67e2017-12-04 13:48:14 -0500311 if (maxResourceBytes) {
312 *maxResourceBytes = fResourceCache->getMaxResourceBytes();
bsalomon37f9a262015-02-02 13:00:10 -0800313 }
314}
315
Robert Phillips8d1e67e2017-12-04 13:48:14 -0500316void GrContext::setResourceCacheLimits(int maxResources, size_t maxResourceBytes) {
joshualitt1de610a2016-01-06 08:26:09 -0800317 ASSERT_SINGLE_OWNER
Robert Phillips8d1e67e2017-12-04 13:48:14 -0500318 fResourceCache->setLimits(maxResources, maxResourceBytes);
bsalomon37f9a262015-02-02 13:00:10 -0800319}
320
ericrk0a5fa482015-09-15 14:16:10 -0700321//////////////////////////////////////////////////////////////////////////////
ericrk0a5fa482015-09-15 14:16:10 -0700322void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const {
joshualitt1de610a2016-01-06 08:26:09 -0800323 ASSERT_SINGLE_OWNER
ericrk0a5fa482015-09-15 14:16:10 -0700324 fResourceCache->dumpMemoryStatistics(traceMemoryDump);
Khushal71652e22018-10-29 13:05:36 -0700325 traceMemoryDump->dumpNumericValue("skia/gr_text_blob_cache", "size", "bytes",
Robert Phillips2184fb72019-02-21 16:11:41 -0500326 this->getTextBlobCache()->usedBytes());
ericrk0a5fa482015-09-15 14:16:10 -0700327}
Brian Osman71a18892017-08-10 10:23:25 -0400328