aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-07-11 20:01:19 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-11 20:01:28 +0000
commit143cf8e5994c54aa8c1b721f7af1d3fc9fd83602 (patch)
tree3fd8ad986ffb3bf0739532b05d0df10f863e41a9 /src
parentf4c5bb9aba485aa47c27b15905d81992b7cf4707 (diff)
Revert "Make GPU cache invalidation SkMessageBus messages go to one GrContext."
This reverts commit f4c5bb9aba485aa47c27b15905d81992b7cf4707. Reason for revert: Accidentally submitted without CQ Original change's description: > Make GPU cache invalidation SkMessageBus messages go to one GrContext. > > Makes it so the template param to SkMessageBus must implement: > bool shouldSend(uint32_t inboxID) const > > Updates all GPU backend message types to only go to the GrContext that > is adding a cache entry. > > Bug: skia: > Change-Id: I3e8a4eb90654b7b8ac57cac9fb508c0ef1d51058 > Reviewed-on: https://skia-review.googlesource.com/140220 > Reviewed-by: Robert Phillips <robertphillips@google.com> > Reviewed-by: Jim Van Verth <jvanverth@google.com> TBR=jvanverth@google.com,bsalomon@google.com,robertphillips@google.com Change-Id: Iadb667d8027341703d254325320ddaa528fb33a1 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/140800 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkResourceCache.h4
-rw-r--r--src/gpu/GrBitmapTextureMaker.cpp10
-rw-r--r--src/gpu/GrBitmapTextureMaker.h2
-rw-r--r--src/gpu/GrClipStackClip.cpp9
-rw-r--r--src/gpu/GrContext.cpp6
-rw-r--r--src/gpu/GrImageTextureMaker.cpp2
-rw-r--r--src/gpu/GrImageTextureMaker.h2
-rw-r--r--src/gpu/GrOnFlushResourceProvider.cpp5
-rw-r--r--src/gpu/GrOnFlushResourceProvider.h5
-rw-r--r--src/gpu/GrProxyProvider.cpp21
-rw-r--r--src/gpu/GrProxyProvider.h4
-rw-r--r--src/gpu/GrRenderTargetContext.h1
-rw-r--r--src/gpu/GrResourceCache.cpp43
-rw-r--r--src/gpu/GrResourceCache.h7
-rw-r--r--src/gpu/GrResourceProvider.h1
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp7
-rw-r--r--src/gpu/GrTextureAdjuster.cpp4
-rw-r--r--src/gpu/GrTextureAdjuster.h2
-rw-r--r--src/gpu/GrTextureMaker.cpp2
-rw-r--r--src/gpu/GrTextureProducer.h3
-rw-r--r--src/gpu/SkGr.cpp12
-rw-r--r--src/gpu/SkGr.h3
-rw-r--r--src/gpu/ccpr/GrCCDrawPathsOp.cpp8
-rw-r--r--src/gpu/ccpr/GrCCPathCache.cpp12
-rw-r--r--src/gpu/ccpr/GrCCPathCache.h12
-rw-r--r--src/gpu/ops/GrMeshDrawOp.h1
-rw-r--r--src/gpu/ops/GrTessellatingPathRenderer.cpp6
-rw-r--r--src/gpu/text/GrTextBlobCache.cpp6
-rw-r--r--src/gpu/text/GrTextBlobCache.h7
29 files changed, 68 insertions, 139 deletions
diff --git a/src/core/SkResourceCache.h b/src/core/SkResourceCache.h
index 4794669492..6087be7824 100644
--- a/src/core/SkResourceCache.h
+++ b/src/core/SkResourceCache.h
@@ -112,9 +112,7 @@ public:
// Used with SkMessageBus
struct PurgeSharedIDMessage {
PurgeSharedIDMessage(uint64_t sharedID) : fSharedID(sharedID) {}
- // SkResourceCache is typically used as a singleton and we don't label Inboxes so all
- // messages go to all inboxes.
- bool shouldSend(uint32_t inboxID) const { return true; }
+
uint64_t fSharedID;
};
diff --git a/src/gpu/GrBitmapTextureMaker.cpp b/src/gpu/GrBitmapTextureMaker.cpp
index 7a70587619..d2a1fbe3e9 100644
--- a/src/gpu/GrBitmapTextureMaker.cpp
+++ b/src/gpu/GrBitmapTextureMaker.cpp
@@ -61,8 +61,7 @@ sk_sp<GrTextureProxy> GrBitmapTextureMaker::refOriginalTextureProxy(bool willBeM
if (!willBeMipped || GrMipMapped::kYes == proxy->mipMapped()) {
SkASSERT(proxy->origin() == kTopLeft_GrSurfaceOrigin);
if (fOriginalKey.isValid()) {
- GrInstallBitmapUniqueKeyInvalidator(
- fOriginalKey, proxyProvider->contextUniqueID(), fBitmap.pixelRef());
+ GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef());
}
return proxy;
}
@@ -86,8 +85,7 @@ sk_sp<GrTextureProxy> GrBitmapTextureMaker::refOriginalTextureProxy(bool willBeM
// time it too will be deleted or recycled.
proxyProvider->removeUniqueKeyFromProxy(fOriginalKey, proxy.get());
proxyProvider->assignUniqueKeyToProxy(fOriginalKey, mippedProxy.get());
- GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, proxyProvider->contextUniqueID(),
- fBitmap.pixelRef());
+ GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef());
}
return mippedProxy;
}
@@ -107,8 +105,8 @@ void GrBitmapTextureMaker::makeCopyKey(const CopyParams& copyParams, GrUniqueKey
}
}
-void GrBitmapTextureMaker::didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) {
- GrInstallBitmapUniqueKeyInvalidator(copyKey, contextUniqueID, fBitmap.pixelRef());
+void GrBitmapTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) {
+ GrInstallBitmapUniqueKeyInvalidator(copyKey, fBitmap.pixelRef());
}
SkAlphaType GrBitmapTextureMaker::alphaType() const {
diff --git a/src/gpu/GrBitmapTextureMaker.h b/src/gpu/GrBitmapTextureMaker.h
index 22d8ca37ed..f945cbc4c6 100644
--- a/src/gpu/GrBitmapTextureMaker.h
+++ b/src/gpu/GrBitmapTextureMaker.h
@@ -26,7 +26,7 @@ protected:
void makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey,
SkColorSpace* dstColorSpace) override;
- void didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) override;
+ void didCacheCopy(const GrUniqueKey& copyKey) override;
SkAlphaType alphaType() const override;
sk_sp<SkColorSpace> getColorSpace(SkColorSpace* dstColorSpace) override;
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 7704d929f9..8095286329 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -313,13 +313,12 @@ static void create_clip_mask_key(uint32_t clipGenID, const SkIRect& bounds, int
}
static void add_invalidate_on_pop_message(const SkClipStack& stack, uint32_t clipGenID,
- const GrUniqueKey& clipMaskKey,
- uint32_t contextUniqueID) {
+ const GrUniqueKey& clipMaskKey) {
SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart);
while (const Element* element = iter.prev()) {
if (element->getGenID() == clipGenID) {
std::unique_ptr<GrUniqueKeyInvalidatedMessage> msg(
- new GrUniqueKeyInvalidatedMessage(clipMaskKey, contextUniqueID));
+ new GrUniqueKeyInvalidatedMessage(clipMaskKey));
element->addResourceInvalidationMessage(std::move(msg));
return;
}
@@ -364,7 +363,7 @@ sk_sp<GrTextureProxy> GrClipStackClip::createAlphaClipMask(GrContext* context,
SkASSERT(result->origin() == kTopLeft_GrSurfaceOrigin);
proxyProvider->assignUniqueKeyToProxy(key, result.get());
- add_invalidate_on_pop_message(*fStack, reducedClip.maskGenID(), key, context->uniqueID());
+ add_invalidate_on_pop_message(*fStack, reducedClip.maskGenID(), key);
return result;
}
@@ -505,6 +504,6 @@ sk_sp<GrTextureProxy> GrClipStackClip::createSoftwareClipMask(
SkASSERT(proxy->origin() == kTopLeft_GrSurfaceOrigin);
proxyProvider->assignUniqueKeyToProxy(key, proxy.get());
- add_invalidate_on_pop_message(*fStack, reducedClip.maskGenID(), key, context->uniqueID());
+ add_invalidate_on_pop_message(*fStack, reducedClip.maskGenID(), key);
return proxy;
}
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index dd4f3218fa..6cf5d050a8 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -85,12 +85,10 @@ bool GrContext::initCommon(const GrContextOptions& options) {
fResourceCache = new GrResourceCache(fCaps.get(), fUniqueID);
fResourceProvider = new GrResourceProvider(fGpu.get(), fResourceCache, &fSingleOwner,
options.fExplicitlyAllocateGPUResources);
- fProxyProvider =
- new GrProxyProvider(fResourceProvider, fResourceCache, fCaps, &fSingleOwner);
- } else {
- fProxyProvider = new GrProxyProvider(this->uniqueID(), fCaps, &fSingleOwner);
}
+ fProxyProvider = new GrProxyProvider(fResourceProvider, fResourceCache, fCaps, &fSingleOwner);
+
if (fResourceCache) {
fResourceCache->setProxyProvider(fProxyProvider);
}
diff --git a/src/gpu/GrImageTextureMaker.cpp b/src/gpu/GrImageTextureMaker.cpp
index a8e62162a6..732811615f 100644
--- a/src/gpu/GrImageTextureMaker.cpp
+++ b/src/gpu/GrImageTextureMaker.cpp
@@ -42,7 +42,7 @@ void GrImageTextureMaker::makeCopyKey(const CopyParams& stretch, GrUniqueKey* pa
}
}
-void GrImageTextureMaker::didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) {
+void GrImageTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) {
as_IB(fClient)->notifyAddedToCache();
}
diff --git a/src/gpu/GrImageTextureMaker.h b/src/gpu/GrImageTextureMaker.h
index 1fe882a4f3..1a72f68e1b 100644
--- a/src/gpu/GrImageTextureMaker.h
+++ b/src/gpu/GrImageTextureMaker.h
@@ -29,7 +29,7 @@ protected:
void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey,
SkColorSpace* dstColorSpace) override;
- void didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) override;
+ void didCacheCopy(const GrUniqueKey& copyKey) override;
SkAlphaType alphaType() const override;
sk_sp<SkColorSpace> getColorSpace(SkColorSpace* dstColorSpace) override;
diff --git a/src/gpu/GrOnFlushResourceProvider.cpp b/src/gpu/GrOnFlushResourceProvider.cpp
index 26b59f93b9..ddf66020d2 100644
--- a/src/gpu/GrOnFlushResourceProvider.cpp
+++ b/src/gpu/GrOnFlushResourceProvider.cpp
@@ -6,7 +6,6 @@
*/
#include "GrOnFlushResourceProvider.h"
-#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrDrawingManager.h"
#include "GrProxyProvider.h"
@@ -131,10 +130,6 @@ sk_sp<const GrBuffer> GrOnFlushResourceProvider::findOrMakeStaticBuffer(GrBuffer
return buffer;
}
-uint32_t GrOnFlushResourceProvider::contextUniqueID() const {
- return fDrawingMgr->getContext()->uniqueID();
-}
-
const GrCaps* GrOnFlushResourceProvider::caps() const {
return fDrawingMgr->getContext()->contextPriv().caps();
}
diff --git a/src/gpu/GrOnFlushResourceProvider.h b/src/gpu/GrOnFlushResourceProvider.h
index c30ec61daa..d01f1342ea 100644
--- a/src/gpu/GrOnFlushResourceProvider.h
+++ b/src/gpu/GrOnFlushResourceProvider.h
@@ -8,6 +8,7 @@
#ifndef GrOnFlushResourceProvider_DEFINED
#define GrOnFlushResourceProvider_DEFINED
+#include "GrTypes.h"
#include "GrDeferredUpload.h"
#include "GrOpFlushState.h"
#include "GrResourceProvider.h"
@@ -20,6 +21,7 @@ class GrOnFlushResourceProvider;
class GrRenderTargetOpList;
class GrRenderTargetContext;
class GrSurfaceProxy;
+
class SkColorSpace;
class SkSurfaceProps;
@@ -29,7 +31,7 @@ class SkSurfaceProps;
*/
class GrOnFlushCallbackObject {
public:
- virtual ~GrOnFlushCallbackObject() {}
+ virtual ~GrOnFlushCallbackObject() { }
/*
* The onFlush callback allows subsystems (e.g., text, path renderers) to create atlases
@@ -89,7 +91,6 @@ public:
sk_sp<const GrBuffer> findOrMakeStaticBuffer(GrBufferType, size_t, const void* data,
const GrUniqueKey&);
- uint32_t contextUniqueID() const;
const GrCaps* caps() const;
private:
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index df7b61e700..e259e34e28 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -37,32 +37,11 @@ GrProxyProvider::GrProxyProvider(GrResourceProvider* resourceProvider,
, fResourceCache(resourceCache)
, fAbandoned(false)
, fCaps(caps)
- , fContextUniqueID(resourceCache->contextUniqueID())
#ifdef SK_DEBUG
, fSingleOwner(owner)
#endif
{
- SkASSERT(fResourceProvider);
- SkASSERT(fResourceCache);
- SkASSERT(fCaps);
- SkASSERT(fSingleOwner);
-}
-GrProxyProvider::GrProxyProvider(uint32_t contextUniqueID,
- sk_sp<const GrCaps> caps,
- GrSingleOwner* owner)
- : fResourceProvider(nullptr)
- , fResourceCache(nullptr)
- , fAbandoned(false)
- , fCaps(caps)
- , fContextUniqueID(contextUniqueID)
-#ifdef SK_DEBUG
- , fSingleOwner(owner)
-#endif
-{
- SkASSERT(fContextUniqueID != SK_InvalidUniqueID);
- SkASSERT(fCaps);
- SkASSERT(fSingleOwner);
}
GrProxyProvider::~GrProxyProvider() {
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index 89f9518e46..64b9ac4355 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -27,7 +27,6 @@ class SkImage;
class GrProxyProvider {
public:
GrProxyProvider(GrResourceProvider*, GrResourceCache*, sk_sp<const GrCaps>, GrSingleOwner*);
- GrProxyProvider(uint32_t contextUniqueID, sk_sp<const GrCaps>, GrSingleOwner*);
~GrProxyProvider();
@@ -212,7 +211,6 @@ public:
*/
void processInvalidProxyUniqueKey(const GrUniqueKey&, GrTextureProxy*, bool invalidateSurface);
- uint32_t contextUniqueID() const { return fContextUniqueID; }
const GrCaps* caps() const { return fCaps.get(); }
sk_sp<const GrCaps> refCaps() const { return fCaps; }
@@ -260,8 +258,6 @@ private:
GrResourceCache* fResourceCache;
bool fAbandoned;
sk_sp<const GrCaps> fCaps;
- // If this provider is owned by a DDLContext then this is the DirectContext's ID.
- uint32_t fContextUniqueID;
// In debug builds we guard against improper thread handling
SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;)
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index 376fe10735..ee0d183981 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -16,7 +16,6 @@
#include "GrSurfaceContext.h"
#include "GrTypesPriv.h"
#include "GrXferProcessor.h"
-#include "SkCanvas.h"
#include "SkRefCnt.h"
#include "SkSurfaceProps.h"
#include "text/GrTextUtils.h"
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 23c8e7c996..c4e940980e 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -63,29 +63,27 @@ private:
//////////////////////////////////////////////////////////////////////////////
+
GrResourceCache::GrResourceCache(const GrCaps* caps, uint32_t contextUniqueID)
- : fProxyProvider(nullptr)
- , fTimestamp(0)
- , fMaxCount(kDefaultMaxCount)
- , fMaxBytes(kDefaultMaxSize)
- , fMaxUnusedFlushes(kDefaultMaxUnusedFlushes)
+ : fProxyProvider(nullptr)
+ , fTimestamp(0)
+ , fMaxCount(kDefaultMaxCount)
+ , fMaxBytes(kDefaultMaxSize)
+ , fMaxUnusedFlushes(kDefaultMaxUnusedFlushes)
#if GR_CACHE_STATS
- , fHighWaterCount(0)
- , fHighWaterBytes(0)
- , fBudgetedHighWaterCount(0)
- , fBudgetedHighWaterBytes(0)
+ , fHighWaterCount(0)
+ , fHighWaterBytes(0)
+ , fBudgetedHighWaterCount(0)
+ , fBudgetedHighWaterBytes(0)
#endif
- , fBytes(0)
- , fBudgetedCount(0)
- , fBudgetedBytes(0)
- , fPurgeableBytes(0)
- , fRequestFlush(false)
- , fExternalFlushCnt(0)
- , fInvalidUniqueKeyInbox(contextUniqueID)
- , fFreedGpuResourceInbox(contextUniqueID)
- , fContextUniqueID(contextUniqueID)
- , fPreferVRAMUseOverFlushes(caps->preferVRAMUseOverFlushes()) {
- SkASSERT(contextUniqueID != SK_InvalidUniqueID);
+ , fBytes(0)
+ , fBudgetedCount(0)
+ , fBudgetedBytes(0)
+ , fPurgeableBytes(0)
+ , fRequestFlush(false)
+ , fExternalFlushCnt(0)
+ , fContextUniqueID(contextUniqueID)
+ , fPreferVRAMUseOverFlushes(caps->preferVRAMUseOverFlushes()) {
SkDEBUGCODE(fCount = 0;)
SkDEBUGCODE(fNewlyPurgeableResourceForValidation = nullptr;)
}
@@ -606,8 +604,9 @@ void GrResourceCache::processFreedGpuResources() {
SkTArray<GrGpuResourceFreedMessage> msgs;
fFreedGpuResourceInbox.poll(&msgs);
for (int i = 0; i < msgs.count(); ++i) {
- SkASSERT(msgs[i].fOwningUniqueID == fContextUniqueID);
- msgs[i].fResource->unref();
+ if (msgs[i].fOwningUniqueID == fContextUniqueID) {
+ msgs[i].fResource->unref();
+ }
}
}
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h
index 507c192f43..771b13fb26 100644
--- a/src/gpu/GrResourceCache.h
+++ b/src/gpu/GrResourceCache.h
@@ -27,10 +27,6 @@ class SkTraceMemoryDump;
struct GrGpuResourceFreedMessage {
GrGpuResource* fResource;
uint32_t fOwningUniqueID;
- bool shouldSend(uint32_t inboxID) const {
- // The inbox's ID is the unique ID of the owning GrContext.
- return inboxID == fOwningUniqueID;
- }
};
/**
@@ -71,9 +67,6 @@ public:
class ResourceAccess;
ResourceAccess resourceAccess();
- /** Unique ID of the owning GrContext. */
- uint32_t contextUniqueID() const { return fContextUniqueID; }
-
/**
* Sets the cache limits in terms of number of resources, max gpu memory byte size, and number
* of external GrContext flushes that a resource can be unused before it is evicted. The latter
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index 347a5de2cd..35c36826af 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -251,7 +251,6 @@ public:
fGpu = nullptr;
}
- uint32_t contextUniqueID() const { return fCache->contextUniqueID(); }
const GrCaps* caps() const { return fCaps.get(); }
bool overBudget() const { return fCache->overBudget(); }
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 213dbdb025..ee52122840 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -216,9 +216,7 @@ private:
// When the SkPathRef genID changes, invalidate a corresponding GrResource described by key.
class PathInvalidator : public SkPathRef::GenIDChangeListener {
public:
- PathInvalidator(const GrUniqueKey& key, uint32_t contextUniqueID)
- : fMsg(key, contextUniqueID) {}
-
+ explicit PathInvalidator(const GrUniqueKey& key) : fMsg(key) {}
private:
GrUniqueKeyInvalidatedMessage fMsg;
@@ -368,8 +366,7 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
if (useCache) {
SkASSERT(proxy->origin() == kTopLeft_GrSurfaceOrigin);
fProxyProvider->assignUniqueKeyToProxy(maskKey, proxy.get());
- args.fShape->addGenIDChangeListener(
- sk_make_sp<PathInvalidator>(maskKey, args.fContext->uniqueID()));
+ args.fShape->addGenIDChangeListener(sk_make_sp<PathInvalidator>(maskKey));
}
}
if (inverseFilled) {
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp
index d016896c3f..4b21bac9d0 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -33,7 +33,7 @@ void GrTextureAdjuster::makeCopyKey(const CopyParams& params, GrUniqueKey* copyK
MakeCopyKeyFromOrigKey(baseKey, params, copyKey);
}
-void GrTextureAdjuster::didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) {
+void GrTextureAdjuster::didCacheCopy(const GrUniqueKey& copyKey) {
// We don't currently have a mechanism for notifications on Images!
}
@@ -67,7 +67,7 @@ sk_sp<GrTextureProxy> GrTextureAdjuster::refTextureProxyCopy(const CopyParams& c
proxyProvider->removeUniqueKeyFromProxy(key, cachedCopy.get());
}
proxyProvider->assignUniqueKeyToProxy(key, copy.get());
- this->didCacheCopy(key, proxyProvider->contextUniqueID());
+ this->didCacheCopy(key);
}
}
return copy;
diff --git a/src/gpu/GrTextureAdjuster.h b/src/gpu/GrTextureAdjuster.h
index e43e87b1dc..885e39059d 100644
--- a/src/gpu/GrTextureAdjuster.h
+++ b/src/gpu/GrTextureAdjuster.h
@@ -37,7 +37,7 @@ protected:
SkAlphaType alphaType() const override { return fAlphaType; }
void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey,
SkColorSpace* dstColorSpace) override;
- void didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) override;
+ void didCacheCopy(const GrUniqueKey& copyKey) override;
GrTextureProxy* originalProxy() const { return fOriginal.get(); }
sk_sp<GrTextureProxy> originalProxyRef() const { return fOriginal; }
diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp
index 22870cc7c8..f9ee7585d2 100644
--- a/src/gpu/GrTextureMaker.cpp
+++ b/src/gpu/GrTextureMaker.cpp
@@ -109,7 +109,7 @@ sk_sp<GrTextureProxy> GrTextureMaker::onRefTextureProxyForParams(const GrSampler
proxyProvider->removeUniqueKeyFromProxy(copyKey, cachedProxy.get());
}
proxyProvider->assignUniqueKeyToProxy(copyKey, result.get());
- this->didCacheCopy(copyKey, proxyProvider->contextUniqueID());
+ this->didCacheCopy(copyKey);
}
return result;
}
diff --git a/src/gpu/GrTextureProducer.h b/src/gpu/GrTextureProducer.h
index 176247b67e..c458d4fbe6 100644
--- a/src/gpu/GrTextureProducer.h
+++ b/src/gpu/GrTextureProducer.h
@@ -158,7 +158,8 @@ protected:
* makeCopyKey() returns true). In that case, the maker is notified in case it
* wants to note that for when the maker is destroyed.
*/
- virtual void didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) = 0;
+ virtual void didCacheCopy(const GrUniqueKey& copyKey) = 0;
+
enum DomainMode {
kNoDomain_DomainMode,
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 5baf0d4017..ff2b9843e8 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -88,20 +88,17 @@ sk_sp<GrTextureProxy> GrUploadBitmapToTextureProxy(GrProxyProvider* proxyProvide
////////////////////////////////////////////////////////////////////////////////
-void GrInstallBitmapUniqueKeyInvalidator(const GrUniqueKey& key, uint32_t contextUniqueID,
- SkPixelRef* pixelRef) {
+void GrInstallBitmapUniqueKeyInvalidator(const GrUniqueKey& key, SkPixelRef* pixelRef) {
class Invalidator : public SkPixelRef::GenIDChangeListener {
public:
- explicit Invalidator(const GrUniqueKey& key, uint32_t contextUniqueID)
- : fMsg(key, contextUniqueID) {}
-
+ explicit Invalidator(const GrUniqueKey& key) : fMsg(key) {}
private:
GrUniqueKeyInvalidatedMessage fMsg;
void onChange() override { SkMessageBus<GrUniqueKeyInvalidatedMessage>::Post(fMsg); }
};
- pixelRef->addGenIDChangeListener(new Invalidator(key, contextUniqueID));
+ pixelRef->addGenIDChangeListener(new Invalidator(key));
}
sk_sp<GrTextureProxy> GrCopyBaseMipMapToTextureProxy(GrContext* ctx, GrTextureProxy* baseProxy) {
@@ -202,8 +199,7 @@ sk_sp<GrTextureProxy> GrMakeCachedImageProxy(GrProxyProvider* proxyProvider,
// When recording DDLs we do not want to install change listeners because doing
// so isn't threadsafe.
if (bm && !proxyProvider->recordingDDL()) {
- GrInstallBitmapUniqueKeyInvalidator(originalKey, proxyProvider->contextUniqueID(),
- bm->pixelRef());
+ GrInstallBitmapUniqueKeyInvalidator(originalKey, bm->pixelRef());
}
}
}
diff --git a/src/gpu/SkGr.h b/src/gpu/SkGr.h
index ec9f30a3bf..a2ac670712 100644
--- a/src/gpu/SkGr.h
+++ b/src/gpu/SkGr.h
@@ -243,7 +243,6 @@ void GrMakeKeyFromImageID(GrUniqueKey* key, uint32_t imageID, const SkIRect& ima
/** Call this after installing a GrUniqueKey on texture. It will cause the texture's key to be
removed should the bitmap's contents change or be destroyed. */
-void GrInstallBitmapUniqueKeyInvalidator(const GrUniqueKey& key, uint32_t contextUniqueID,
- SkPixelRef* pixelRef);
+void GrInstallBitmapUniqueKeyInvalidator(const GrUniqueKey& key, SkPixelRef* pixelRef);
#endif
diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.cpp b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
index 016756a7f6..2d250deb00 100644
--- a/src/gpu/ccpr/GrCCDrawPathsOp.cpp
+++ b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
@@ -251,8 +251,7 @@ void GrCCDrawPathsOp::setupResources(GrOnFlushResourceProvider* onFlushRP,
GrCCAtlas* atlas =
resources->copyPathToCachedAtlas(*cacheEntry, doEvenOddFill, &newOffset);
cacheEntry->updateToCachedAtlas(atlas->getOrAssignUniqueKey(onFlushRP),
- onFlushRP->contextUniqueID(), newOffset,
- atlas->refOrMakeCachedAtlasInfo());
+ newOffset, atlas->refOrMakeCachedAtlasInfo());
this->recordInstance(atlas->textureProxy(), resources->nextPathInstanceIdx());
resources->appendDrawPathInstance().set(*cacheEntry, draw.fCachedMaskShift,
draw.fColor);
@@ -297,9 +296,8 @@ void GrCCDrawPathsOp::setupResources(GrOnFlushResourceProvider* onFlushRP,
const GrUniqueKey& atlasKey =
resources->nextAtlasToStash()->getOrAssignUniqueKey(onFlushRP);
- cacheEntry->initAsStashedAtlas(atlasKey, onFlushRP->contextUniqueID(),
- devToAtlasOffset, devBounds, devBounds45, devIBounds,
- draw.fCachedMaskShift);
+ cacheEntry->initAsStashedAtlas(atlasKey, devToAtlasOffset, devBounds, devBounds45,
+ devIBounds, draw.fCachedMaskShift);
// Remember this atlas in case we encounter the path again during the same flush.
cacheEntry->setCurrFlushAtlas(atlas);
}
diff --git a/src/gpu/ccpr/GrCCPathCache.cpp b/src/gpu/ccpr/GrCCPathCache.cpp
index d7dc714c82..b22b1dd726 100644
--- a/src/gpu/ccpr/GrCCPathCache.cpp
+++ b/src/gpu/ccpr/GrCCPathCache.cpp
@@ -149,16 +149,13 @@ GrCCPathCacheEntry::~GrCCPathCacheEntry() {
this->invalidateAtlas();
}
-void GrCCPathCacheEntry::initAsStashedAtlas(const GrUniqueKey& atlasKey, uint32_t contextUniqueID,
+void GrCCPathCacheEntry::initAsStashedAtlas(const GrUniqueKey& atlasKey,
const SkIVector& atlasOffset, const SkRect& devBounds,
const SkRect& devBounds45, const SkIRect& devIBounds,
const SkIVector& maskShift) {
- SkASSERT(contextUniqueID != SK_InvalidUniqueID);
SkASSERT(atlasKey.isValid());
SkASSERT(!fCurrFlushAtlas); // Otherwise we should reuse the atlas from last time.
- fContextUniqueID = contextUniqueID;
-
fAtlasKey = atlasKey;
fAtlasOffset = atlasOffset + maskShift;
SkASSERT(!fCachedAtlasInfo); // Otherwise they should have reused the cached atlas instead.
@@ -169,15 +166,12 @@ void GrCCPathCacheEntry::initAsStashedAtlas(const GrUniqueKey& atlasKey, uint32_
fDevIBounds = devIBounds.makeOffset(-maskShift.fX, -maskShift.fY);
}
-void GrCCPathCacheEntry::updateToCachedAtlas(const GrUniqueKey& atlasKey, uint32_t contextUniqueID,
+void GrCCPathCacheEntry::updateToCachedAtlas(const GrUniqueKey& atlasKey,
const SkIVector& newAtlasOffset,
sk_sp<GrCCAtlas::CachedAtlasInfo> info) {
- SkASSERT(contextUniqueID != SK_InvalidUniqueID);
SkASSERT(atlasKey.isValid());
SkASSERT(!fCurrFlushAtlas); // Otherwise we should reuse the atlas from last time.
- fContextUniqueID = contextUniqueID;
-
fAtlasKey = atlasKey;
fAtlasOffset = newAtlasOffset;
@@ -194,7 +188,7 @@ void GrCCPathCacheEntry::invalidateAtlas() {
fCachedAtlasInfo->fNumInvalidatedPathPixels >= fCachedAtlasInfo->fNumPathPixels / 2) {
// Too many invalidated pixels: purge the atlas texture from the resource cache.
SkMessageBus<GrUniqueKeyInvalidatedMessage>::Post(
- GrUniqueKeyInvalidatedMessage(fAtlasKey, fContextUniqueID));
+ GrUniqueKeyInvalidatedMessage(fAtlasKey));
fCachedAtlasInfo->fIsPurgedFromResourceCache = true;
}
}
diff --git a/src/gpu/ccpr/GrCCPathCache.h b/src/gpu/ccpr/GrCCPathCache.h
index 7a552bbc2a..67e7d9f571 100644
--- a/src/gpu/ccpr/GrCCPathCache.h
+++ b/src/gpu/ccpr/GrCCPathCache.h
@@ -121,15 +121,14 @@ public:
// Called once our path has been rendered into the mainline CCPR (fp16, coverage count) atlas.
// The caller will stash this atlas texture away after drawing, and during the next flush,
// recover it and attempt to copy any paths that got reused into permanent 8-bit atlases.
- void initAsStashedAtlas(const GrUniqueKey& atlasKey, uint32_t contextUniqueID,
- const SkIVector& atlasOffset, const SkRect& devBounds,
- const SkRect& devBounds45, const SkIRect& devIBounds,
- const SkIVector& maskShift);
+ void initAsStashedAtlas(const GrUniqueKey& atlasKey, const SkIVector& atlasOffset,
+ const SkRect& devBounds, const SkRect& devBounds45,
+ const SkIRect& devIBounds, const SkIVector& maskShift);
// Called once our path mask has been copied into a permanent, 8-bit atlas. This method points
// the entry at the new atlas and updates the CachedAtlasInfo data.
- void updateToCachedAtlas(const GrUniqueKey& atlasKey, uint32_t contextUniqueID,
- const SkIVector& newAtlasOffset, sk_sp<GrCCAtlas::CachedAtlasInfo>);
+ void updateToCachedAtlas(const GrUniqueKey& atlasKey, const SkIVector& newAtlasOffset,
+ sk_sp<GrCCAtlas::CachedAtlasInfo>);
const GrUniqueKey& atlasKey() const { return fAtlasKey; }
@@ -163,7 +162,6 @@ private:
// Called when our corresponding path is modified or deleted.
void onChange() override;
- uint32_t fContextUniqueID;
GrCCPathCache* fCacheWeakPtr; // Gets manually reset to null by the path cache upon eviction.
MaskTransform fMaskTransform;
int fHitCount = 1;
diff --git a/src/gpu/ops/GrMeshDrawOp.h b/src/gpu/ops/GrMeshDrawOp.h
index 449fd53807..ddc29f1dab 100644
--- a/src/gpu/ops/GrMeshDrawOp.h
+++ b/src/gpu/ops/GrMeshDrawOp.h
@@ -170,7 +170,6 @@ public:
virtual const GrXferProcessor::DstProxy& dstProxy() const = 0;
virtual GrResourceProvider* resourceProvider() const = 0;
- uint32_t contextUniqueID() const { return this->resourceProvider()->contextUniqueID(); }
virtual GrGlyphCache* glyphCache() const = 0;
virtual GrAtlasManager* atlasManager() const = 0;
diff --git a/src/gpu/ops/GrTessellatingPathRenderer.cpp b/src/gpu/ops/GrTessellatingPathRenderer.cpp
index 475197e197..1c0a7f5551 100644
--- a/src/gpu/ops/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/ops/GrTessellatingPathRenderer.cpp
@@ -42,9 +42,7 @@ struct TessInfo {
// When the SkPathRef genID changes, invalidate a corresponding GrResource described by key.
class PathInvalidator : public SkPathRef::GenIDChangeListener {
public:
- PathInvalidator(const GrUniqueKey& key, uint32_t contextUniqueID)
- : fMsg(key, contextUniqueID) {}
-
+ explicit PathInvalidator(const GrUniqueKey& key) : fMsg(key) {}
private:
GrUniqueKeyInvalidatedMessage fMsg;
@@ -286,7 +284,7 @@ private:
info.fCount = count;
key.setCustomData(SkData::MakeWithCopy(&info, sizeof(info)));
rp->assignUniqueKeyToResource(key, allocator.vertexBuffer());
- fShape.addGenIDChangeListener(sk_make_sp<PathInvalidator>(key, target->contextUniqueID()));
+ fShape.addGenIDChangeListener(sk_make_sp<PathInvalidator>(key));
}
void drawAA(Target* target, const GrGeometryProcessor* gp, size_t vertexStride) {
diff --git a/src/gpu/text/GrTextBlobCache.cpp b/src/gpu/text/GrTextBlobCache.cpp
index a60903fca3..71d9052ade 100644
--- a/src/gpu/text/GrTextBlobCache.cpp
+++ b/src/gpu/text/GrTextBlobCache.cpp
@@ -30,7 +30,7 @@ void GrTextBlobCache::freeAll() {
void GrTextBlobCache::PostPurgeBlobMessage(uint32_t blobID, uint32_t cacheID) {
SkASSERT(blobID != SK_InvalidGenID);
- SkMessageBus<PurgeBlobMessage>::Post(PurgeBlobMessage(blobID, cacheID));
+ SkMessageBus<PurgeBlobMessage>::Post(PurgeBlobMessage({blobID}), cacheID);
}
void GrTextBlobCache::purgeStaleBlobs() {
@@ -38,7 +38,7 @@ void GrTextBlobCache::purgeStaleBlobs() {
fPurgeBlobInbox.poll(&msgs);
for (const auto& msg : msgs) {
- auto* idEntry = fBlobIDCache.find(msg.fBlobID);
+ auto* idEntry = fBlobIDCache.find(msg.fID);
if (!idEntry) {
// no cache entries for id
continue;
@@ -51,7 +51,7 @@ void GrTextBlobCache::purgeStaleBlobs() {
}
// drop the idEntry itself (unrefs all blobs)
- fBlobIDCache.remove(msg.fBlobID);
+ fBlobIDCache.remove(msg.fID);
}
}
diff --git a/src/gpu/text/GrTextBlobCache.h b/src/gpu/text/GrTextBlobCache.h
index a174c9cf90..b41d401aee 100644
--- a/src/gpu/text/GrTextBlobCache.h
+++ b/src/gpu/text/GrTextBlobCache.h
@@ -99,12 +99,7 @@ public:
}
struct PurgeBlobMessage {
- PurgeBlobMessage(uint32_t blobID, uint32_t contextUniqueID)
- : fBlobID(blobID), fContextID(contextUniqueID) {}
- bool shouldSend(uint32_t inboxID) const { return fContextID == inboxID; }
-
- uint32_t fBlobID;
- uint32_t fContextID;
+ uint32_t fID;
};
static void PostPurgeBlobMessage(uint32_t blobID, uint32_t cacheID);