diff options
author | Greg Daniel <egdaniel@google.com> | 2018-04-16 11:24:10 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-16 17:05:20 +0000 |
commit | e3204864899651a132d3387422d7fd599c21b3ac (patch) | |
tree | dcc19da5c650a435de56317f73044eb03b82a3c4 /src/gpu/GrGpu.cpp | |
parent | 45c92203ef43d09ca6444430bd4081ac97b71237 (diff) |
Don't allow ganesh to allocate mip maps for wrapped textures.
We will not allocate new mips on a wrapped texture but we will use mips
if the wrapped texture already has one. If we need mips for a draw this
will trigger a copy to occur.
Also some cleanup up of our InternalSurfaceFlags in general.
Bug: skia:7806
Change-Id: I7aa666478cc91bba6e0644b323825fcc9b49793a
Reviewed-on: https://skia-review.googlesource.com/121348
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrGpu.cpp')
-rw-r--r-- | src/gpu/GrGpu.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index fafce10f57..297aa15684 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -138,8 +138,10 @@ sk_sp<GrTexture> GrGpu::wrapBackendTexture(const GrBackendTexture& backendTex, return nullptr; } sk_sp<GrTexture> tex = this->onWrapBackendTexture(backendTex, ownership); - if (!tex) { - return nullptr; + if (tex && !backendTex.hasMipMaps()) { + // Ganesh will not ever allocate mipmaps for a wrapped resource. By setting this flag here, + // it will be propagated to any proxy that wraps this texture. + tex->texturePriv().setDoesNotSupportMipMaps(); } return tex; } @@ -160,10 +162,12 @@ sk_sp<GrTexture> GrGpu::wrapRenderableBackendTexture(const GrBackendTexture& bac return nullptr; } sk_sp<GrTexture> tex = this->onWrapRenderableBackendTexture(backendTex, sampleCnt, ownership); - if (!tex) { - return nullptr; + if (tex && !backendTex.hasMipMaps()) { + // Ganesh will not ever allocate mipmaps for a wrapped resource. By setting this flag here, + // it will be propagated to any proxy that wraps this texture. + tex->texturePriv().setDoesNotSupportMipMaps(); } - SkASSERT(tex->asRenderTarget()); + SkASSERT(!tex || tex->asRenderTarget()); return tex; } |