aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-03-14 09:17:43 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-14 14:09:12 +0000
commitd3749485db2de966a80e39669a49192fc7c0bd9d (patch)
tree2a86aa3d24a394dd569f25f94eae08cd58674efe /src/gpu/effects
parent4a01ac9e410e7b78fb04c8632e0676082b9408aa (diff)
Consolidate Proxy caching code in GrResourceProvider
This doesn't implement the GrSurfaceProxy-based caching but just carves out a space for it. Split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors) Change-Id: Iec87b45e3264b349d7804f63e361e970b925e335 Reviewed-on: https://skia-review.googlesource.com/9626 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/GrTextureStripAtlas.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp
index df36e65070..2bf5a721e6 100644
--- a/src/gpu/effects/GrTextureStripAtlas.cpp
+++ b/src/gpu/effects/GrTextureStripAtlas.cpp
@@ -196,10 +196,10 @@ GrTextureStripAtlas::AtlasRow* GrTextureStripAtlas::getLRU() {
void GrTextureStripAtlas::lockTexture() {
GrSurfaceDesc texDesc;
+ texDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
texDesc.fWidth = fDesc.fWidth;
texDesc.fHeight = fDesc.fHeight;
texDesc.fConfig = fDesc.fConfig;
- texDesc.fIsMipMapped = false;
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
GrUniqueKey key;
@@ -207,24 +207,24 @@ void GrTextureStripAtlas::lockTexture() {
builder[0] = static_cast<uint32_t>(fCacheKey);
builder.finish();
- // MDB TODO (caching): this side-steps the issue of proxies with unique IDs
- sk_sp<GrTexture> texture(fDesc.fContext->resourceProvider()->findAndRefTextureByUniqueKey(key));
- if (!texture) {
- texture.reset(fDesc.fContext->resourceProvider()->createTexture(
- texDesc, SkBudgeted::kYes,
- nullptr, 0,
- GrResourceProvider::kNoPendingIO_Flag));
- if (!texture) {
+ sk_sp<GrTextureProxy> proxy = fDesc.fContext->resourceProvider()->findProxyByUniqueKey(key);
+ if (!proxy) {
+ proxy = GrSurfaceProxy::MakeDeferred(fDesc.fContext->resourceProvider(),
+ *fDesc.fContext->caps(), texDesc, SkBackingFit::kExact,
+ SkBudgeted::kYes,
+ GrResourceProvider::kNoPendingIO_Flag);
+ if (!proxy) {
return;
}
- fDesc.fContext->resourceProvider()->assignUniqueKeyToTexture(key, texture.get());
+ fDesc.fContext->resourceProvider()->assignUniqueKeyToProxy(key, proxy.get());
// This is a new texture, so all of our cache info is now invalid
this->initLRU();
fKeyTable.rewind();
}
- SkASSERT(texture);
- fTexContext = fDesc.fContext->contextPriv().makeWrappedSurfaceContext(std::move(texture));
+ SkASSERT(proxy);
+ fTexContext = fDesc.fContext->contextPriv().makeWrappedSurfaceContext(std::move(proxy),
+ nullptr);
}
void GrTextureStripAtlas::unlockTexture() {