diff options
author | 2017-05-22 20:14:41 +0000 | |
---|---|---|
committer | 2017-05-22 20:14:50 +0000 | |
commit | bc262e110a7292950ce912e42de75b7573d0367e (patch) | |
tree | 3a5777eb2ab87791b487e3141d00c91b9749adf4 /src/gpu/GrResourceProvider.cpp | |
parent | bcd8637772e3a678c744e28b4f4b2d42f8405284 (diff) |
Revert "Remove compressed (ETC1) texture support from Ganesh"
This reverts commit ee26363aaae62db2a851f2873e2405a9cf7f995a.
Reason for revert: Failing Google 3 roll.
Original change's description:
> Remove compressed (ETC1) texture support from Ganesh
>
> Change-Id: If4cf286df87ea87338aba47001d90a5fcc4f2667
> Reviewed-on: https://skia-review.googlesource.com/17456
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
>
TBR=bsalomon@google.com,robertphillips@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: Ie1a57187287e03600a69e374501478e93c41415c
Reviewed-on: https://skia-review.googlesource.com/17527
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrResourceProvider.cpp')
-rw-r--r-- | src/gpu/GrResourceProvider.cpp | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp index 84e274eee2..2eb82714a2 100644 --- a/src/gpu/GrResourceProvider.cpp +++ b/src/gpu/GrResourceProvider.cpp @@ -157,15 +157,17 @@ sk_sp<GrTextureProxy> GrResourceProvider::createTextureProxy(const GrSurfaceDesc GrContext* context = fGpu->getContext(); - SkImageInfo srcInfo; - - if (make_info(desc.fWidth, desc.fHeight, desc.fConfig, &srcInfo)) { - sk_sp<GrTexture> tex = this->getExactScratch(desc, budgeted, 0); - sk_sp<GrSurfaceContext> sContext = - context->contextPriv().makeWrappedSurfaceContext(std::move(tex)); - if (sContext) { - if (sContext->writePixels(srcInfo, mipLevel.fPixels, mipLevel.fRowBytes, 0, 0)) { - return sContext->asTextureProxyRef(); + if (!GrPixelConfigIsCompressed(desc.fConfig)) { + SkImageInfo srcInfo; + + if (make_info(desc.fWidth, desc.fHeight, desc.fConfig, &srcInfo)) { + sk_sp<GrTexture> tex = this->getExactScratch(desc, budgeted, 0); + sk_sp<GrSurfaceContext> sContext = + context->contextPriv().makeWrappedSurfaceContext(std::move(tex)); + if (sContext) { + if (sContext->writePixels(srcInfo, mipLevel.fPixels, mipLevel.fRowBytes, 0, 0)) { + return sContext->asTextureProxyRef(); + } } } } @@ -190,12 +192,14 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, Sk return nullptr; } - sk_sp<GrTexture> tex = this->getExactScratch(desc, budgeted, flags); - if (tex) { - return tex; + if (!GrPixelConfigIsCompressed(desc.fConfig)) { + sk_sp<GrTexture> tex = this->getExactScratch(desc, budgeted, flags); + if (tex) { + return tex; + } } - tex.reset(fGpu->createTexture(desc, budgeted)); + sk_sp<GrTexture> tex(fGpu->createTexture(desc, budgeted)); return tex; } @@ -207,6 +211,11 @@ GrTexture* GrResourceProvider::createApproxTexture(const GrSurfaceDesc& desc, ui return nullptr; } + // Currently we don't recycle compressed textures as scratch. + if (GrPixelConfigIsCompressed(desc.fConfig)) { + return nullptr; + } + if (!validate_desc(desc, *fCaps)) { return nullptr; } @@ -217,6 +226,7 @@ GrTexture* GrResourceProvider::createApproxTexture(const GrSurfaceDesc& desc, ui GrTexture* GrResourceProvider::refScratchTexture(const GrSurfaceDesc& inDesc, uint32_t flags) { ASSERT_SINGLE_OWNER SkASSERT(!this->isAbandoned()); + SkASSERT(!GrPixelConfigIsCompressed(inDesc.fConfig)); SkASSERT(validate_desc(inDesc, *fCaps)); SkTCopyOnFirstWrite<GrSurfaceDesc> desc(inDesc); |