diff --git a/experimental/graphite/src/ResourceProvider.cpp b/experimental/graphite/src/ResourceProvider.cpp index 81b9a5365a..c07104b692 100644 --- a/experimental/graphite/src/ResourceProvider.cpp +++ b/experimental/graphite/src/ResourceProvider.cpp @@ -83,8 +83,17 @@ sk_sp ResourceProvider::GraphicsPipelineCache::refPipeline( return (*entry)->fPipeline; } -sk_sp ResourceProvider::findOrCreateTexture(SkISize dimensions, const TextureInfo& info) { - return this->createTexture(dimensions, info); +sk_sp ResourceProvider::findOrCreateScratchTexture(SkISize dimensions, + const TextureInfo& info) { + SkASSERT(info.isValid()); + + static const ResourceType kType = GraphiteResourceKey::GenerateResourceType(); + + GraphiteResourceKey key; + // Scratch textures are not shareable + fGpu->caps()->buildKeyForTexture(dimensions, info, kType, Shareable::kNo, &key); + + return this->findOrCreateTextureWithKey(dimensions, info, key); } sk_sp ResourceProvider::findOrCreateDepthStencilAttachment(SkISize dimensions, diff --git a/experimental/graphite/src/ResourceProvider.h b/experimental/graphite/src/ResourceProvider.h index 993b464cd9..45ea885a67 100644 --- a/experimental/graphite/src/ResourceProvider.h +++ b/experimental/graphite/src/ResourceProvider.h @@ -43,7 +43,7 @@ public: sk_sp findOrCreateGraphicsPipeline(const GraphicsPipelineDesc&, const RenderPassDesc&); - sk_sp findOrCreateTexture(SkISize, const TextureInfo&); + sk_sp findOrCreateScratchTexture(SkISize, const TextureInfo&); virtual sk_sp createWrappedTexture(const BackendTexture&) = 0; sk_sp findOrCreateDepthStencilAttachment(SkISize dimensions, diff --git a/experimental/graphite/src/TextureProxy.cpp b/experimental/graphite/src/TextureProxy.cpp index f71fc03cfe..1cc3918a67 100644 --- a/experimental/graphite/src/TextureProxy.cpp +++ b/experimental/graphite/src/TextureProxy.cpp @@ -26,7 +26,7 @@ bool TextureProxy::instantiate(ResourceProvider* resourceProvider) { if (fTexture) { return true; } - fTexture = resourceProvider->findOrCreateTexture(fDimensions, fInfo); + fTexture = resourceProvider->findOrCreateScratchTexture(fDimensions, fInfo); if (!fTexture) { return false; }