[graphite] Add support for caching scratch textures.
Bug: skia:12754 Change-Id: I666bda6a192e3c3dc95953e5a36fbabbf65171ec Reviewed-on: https://skia-review.googlesource.com/c/skia/+/515857 Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
f60584eb0f
commit
0cab38e81a
@ -83,8 +83,17 @@ sk_sp<GraphicsPipeline> ResourceProvider::GraphicsPipelineCache::refPipeline(
|
|||||||
return (*entry)->fPipeline;
|
return (*entry)->fPipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<Texture> ResourceProvider::findOrCreateTexture(SkISize dimensions, const TextureInfo& info) {
|
sk_sp<Texture> ResourceProvider::findOrCreateScratchTexture(SkISize dimensions,
|
||||||
return this->createTexture(dimensions, info);
|
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<Texture> ResourceProvider::findOrCreateDepthStencilAttachment(SkISize dimensions,
|
sk_sp<Texture> ResourceProvider::findOrCreateDepthStencilAttachment(SkISize dimensions,
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
sk_sp<GraphicsPipeline> findOrCreateGraphicsPipeline(const GraphicsPipelineDesc&,
|
sk_sp<GraphicsPipeline> findOrCreateGraphicsPipeline(const GraphicsPipelineDesc&,
|
||||||
const RenderPassDesc&);
|
const RenderPassDesc&);
|
||||||
|
|
||||||
sk_sp<Texture> findOrCreateTexture(SkISize, const TextureInfo&);
|
sk_sp<Texture> findOrCreateScratchTexture(SkISize, const TextureInfo&);
|
||||||
virtual sk_sp<Texture> createWrappedTexture(const BackendTexture&) = 0;
|
virtual sk_sp<Texture> createWrappedTexture(const BackendTexture&) = 0;
|
||||||
|
|
||||||
sk_sp<Texture> findOrCreateDepthStencilAttachment(SkISize dimensions,
|
sk_sp<Texture> findOrCreateDepthStencilAttachment(SkISize dimensions,
|
||||||
|
@ -26,7 +26,7 @@ bool TextureProxy::instantiate(ResourceProvider* resourceProvider) {
|
|||||||
if (fTexture) {
|
if (fTexture) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
fTexture = resourceProvider->findOrCreateTexture(fDimensions, fInfo);
|
fTexture = resourceProvider->findOrCreateScratchTexture(fDimensions, fInfo);
|
||||||
if (!fTexture) {
|
if (!fTexture) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user