diff options
author | Greg Daniel <egdaniel@google.com> | 2017-10-03 13:42:45 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-03 13:43:00 +0000 |
commit | 87c76edd2c2247a6d0194a0e511a7bdc259aedf4 (patch) | |
tree | 97d8a144cc8b1e4c02080675828d6df6f8a91414 /src/gpu/GrBitmapTextureMaker.cpp | |
parent | 862c19675edb26ed7cba56ae6ca9f98c1e4cbef1 (diff) |
Revert "Update lockTextureProxy to return mipped proxys if mipping is requested."
This reverts commit 97abf014b40cc17c4100768299ef8cccd335aff7.
Reason for revert: REALLY Really really really big perf regressions
Original change's description:
> Update lockTextureProxy to return mipped proxys if mipping is requested.
>
> We will either create a new mipped surface from scratch, or just create
> the base layer and copy that into the mipped surface. We then defer the
> creation of the rest of the mips to the GPU.
>
> Bug: skia:
> Change-Id: Ida3000ad5e666153c61b05e714f033138593b09b
> Reviewed-on: https://skia-review.googlesource.com/52743
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
TBR=egdaniel@google.com,robertphillips@google.com,brianosman@google.com
Change-Id: If3b1ff555ef310b75493412a7533175195994684
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/54320
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrBitmapTextureMaker.cpp')
-rw-r--r-- | src/gpu/GrBitmapTextureMaker.cpp | 83 |
1 files changed, 32 insertions, 51 deletions
diff --git a/src/gpu/GrBitmapTextureMaker.cpp b/src/gpu/GrBitmapTextureMaker.cpp index efb9e20291..ab8ee249a9 100644 --- a/src/gpu/GrBitmapTextureMaker.cpp +++ b/src/gpu/GrBitmapTextureMaker.cpp @@ -37,70 +37,51 @@ sk_sp<GrTextureProxy> GrBitmapTextureMaker::refOriginalTextureProxy(bool willBeM return nullptr; } - sk_sp<GrTextureProxy> proxy; + sk_sp<GrTextureProxy> originalProxy; if (fOriginalKey.isValid()) { - proxy = this->context()->resourceProvider()->findOrCreateProxyByUniqueKey( + originalProxy = this->context()->resourceProvider()->findOrCreateProxyByUniqueKey( fOriginalKey, kTopLeft_GrSurfaceOrigin); - if (proxy && (!willBeMipped || proxy->isMipMapped())) { - return proxy; + if (originalProxy && (!willBeMipped || originalProxy->isMipMapped())) { + return originalProxy; } } - if (!proxy) { - if (willBeMipped) { + sk_sp<GrTextureProxy> proxy; + if (willBeMipped) { + if (!originalProxy) { proxy = GrGenerateMipMapsAndUploadToTextureProxy(this->context(), fBitmap, dstColorSpace); - } - if (!proxy) { - proxy = GrUploadBitmapToTextureProxy(this->context()->resourceProvider(), fBitmap, - dstColorSpace); - } - if (proxy) { - if (fOriginalKey.isValid()) { - this->context()->resourceProvider()->assignUniqueKeyToProxy(fOriginalKey, - proxy.get()); - } - if (!willBeMipped || proxy->isMipMapped()) { - SkASSERT(proxy->origin() == kTopLeft_GrSurfaceOrigin); - if (fOriginalKey.isValid()) { - GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef()); - } - return proxy; + } else { + proxy = GrCopyBaseMipMapToTextureProxy(this->context(), originalProxy.get(), + dstColorSpace); + if (!proxy) { + // We failed to make a mipped proxy with the base copied into it. This could have + // been from failure to make the proxy or failure to do the copy. Thus we will fall + // back to just using the non mipped proxy; See skbug.com/7094. + return originalProxy; } } } - - if (proxy) { - SkASSERT(willBeMipped); - SkASSERT(!proxy->isMipMapped()); - // We need a mipped proxy, but we either found a proxy earlier that wasn't mipped or - // generated a non mipped proxy. Thus we generate a new mipped surface and copy the original - // proxy into the base layer. We will then let the gpu generate the rest of the mips. - if (auto mippedProxy = GrCopyBaseMipMapToTextureProxy(this->context(), proxy.get(), - dstColorSpace)) { - SkASSERT(mippedProxy->origin() == kTopLeft_GrSurfaceOrigin); - if (fOriginalKey.isValid()) { - // In this case we are stealing the key from the original proxy which should only - // happen when we have just generated mipmaps for an originally unmipped - // proxy/texture. This means that all future uses of the key will access the - // mipmapped version. The texture backing the unmipped version will remain in the - // resource cache until the last texture proxy referencing it is deleted at which - // time it too will be deleted or recycled. - this->context()->resourceProvider()->removeUniqueKeyFromProxy(fOriginalKey, - proxy.get()); - this->context()->resourceProvider()->assignUniqueKeyToProxy(fOriginalKey, - mippedProxy.get()); - GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef()); - } - return mippedProxy; + if (!proxy) { + proxy = GrUploadBitmapToTextureProxy(this->context()->resourceProvider(), fBitmap, + dstColorSpace); + } + if (proxy && fOriginalKey.isValid()) { + SkASSERT(proxy->origin() == kTopLeft_GrSurfaceOrigin); + if (originalProxy) { + // In this case we are stealing the key from the original proxy which should only happen + // when we have just generated mipmaps for an originally unmipped proxy/texture. This + // means that all future uses of the key will access the mipmapped version. The texture + // backing the unmipped version will remain in the resource cache until the last texture + // proxy referencing it is deleted at which time it too will be deleted or recycled. + this->context()->resourceProvider()->removeUniqueKeyFromProxy(fOriginalKey, + originalProxy.get()); } - // We failed to make a mipped proxy with the base copied into it. This could have - // been from failure to make the proxy or failure to do the copy. Thus we will fall - // back to just using the non mipped proxy; See skbug.com/7094. - return proxy; + this->context()->resourceProvider()->assignUniqueKeyToProxy(fOriginalKey, proxy.get()); + GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef()); } - return nullptr; + return proxy; } void GrBitmapTextureMaker::makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey, |