diff options
author | Greg Daniel <egdaniel@google.com> | 2017-09-28 20:46:45 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-28 20:46:53 +0000 |
commit | 8b059bd946d9f14607f6d2e8b966267dd8e5a54d (patch) | |
tree | 0e88e6107bf964705c85cdead1a95f082a1d7e61 /src/gpu/GrBitmapTextureMaker.cpp | |
parent | 4b050009067044ad9352d26013c10991bda38f91 (diff) |
Revert "Update GrBitmapTextureMaker for handling mipped requests"
This reverts commit d1935c16e889b6707a522f711e79c75353caa343.
Reason for revert: breaking lots of GMs, especially on gles
Original change's description:
> Update GrBitmapTextureMaker for handling mipped requests
>
> Specifically this updates the case when we are requesting to use mip
> maps but there is already an unmipped version in the cache. Previously
> we just grabbed the unmipped.
>
> Now we will create a new mipped resource. Upload the cpu data to all
> the levels besides the base, copy the base level on GPU from the
> original resource to the mipped one. Then the mipped resource will
> take over the originals unique key.
>
> Bug: skia:
> Change-Id: I38e9725c93280dc2460a0be8a7a229e7f20e1614
> Reviewed-on: https://skia-review.googlesource.com/43840
> 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: Id82e8b6e8ab69e46ff018bb07ae5d1f6ea8d7e76
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/52901
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 | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/src/gpu/GrBitmapTextureMaker.cpp b/src/gpu/GrBitmapTextureMaker.cpp index 00dd48d0a9..6654901e20 100644 --- a/src/gpu/GrBitmapTextureMaker.cpp +++ b/src/gpu/GrBitmapTextureMaker.cpp @@ -8,13 +8,10 @@ #include "GrBitmapTextureMaker.h" #include "GrContext.h" -#include "GrContextPriv.h" #include "GrGpuResourcePriv.h" #include "GrResourceProvider.h" -#include "GrSurfaceContext.h" #include "SkBitmap.h" #include "SkGr.h" -#include "SkMipMap.h" #include "SkPixelRef.h" static bool bmp_is_alpha_only(const SkBitmap& bm) { return kAlpha_8_SkColorType == bm.colorType(); } @@ -37,25 +34,17 @@ sk_sp<GrTextureProxy> GrBitmapTextureMaker::refOriginalTextureProxy(bool willBeM return nullptr; } - sk_sp<GrTextureProxy> originalProxy; + sk_sp<GrTextureProxy> proxy; if (fOriginalKey.isValid()) { - originalProxy = this->context()->resourceProvider()->findOrCreateProxyByUniqueKey( - fOriginalKey, kTopLeft_GrSurfaceOrigin); - if (originalProxy && (!willBeMipped || originalProxy->isMipMapped())) { - return originalProxy; + proxy = this->context()->resourceProvider()->findOrCreateProxyByUniqueKey( + fOriginalKey, kTopLeft_GrSurfaceOrigin); + if (proxy) { + return proxy; } } - - sk_sp<GrTextureProxy> proxy; if (willBeMipped) { - if (!originalProxy) { - proxy = GrGenerateMipMapsAndUploadToTextureProxy(this->context(), fBitmap, - dstColorSpace); - } else { - proxy = GrCopyBaseMipMapToTextureProxy(this->context(), originalProxy.get(), - dstColorSpace); - } + proxy = GrGenerateMipMapsAndUploadToTextureProxy(this->context(), fBitmap, dstColorSpace); } if (!proxy) { proxy = GrUploadBitmapToTextureProxy(this->context()->resourceProvider(), fBitmap, @@ -63,15 +52,6 @@ sk_sp<GrTextureProxy> GrBitmapTextureMaker::refOriginalTextureProxy(bool willBeM } 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()); - } this->context()->resourceProvider()->assignUniqueKeyToProxy(fOriginalKey, proxy.get()); GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef()); } |