From fb5916486f562b45474fba86ed4bede15b83ef4a Mon Sep 17 00:00:00 2001 From: jvanverth Date: Fri, 29 Apr 2016 09:50:25 -0700 Subject: Don't mark mipmaps dirty if uploading > 1 levels BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1933293002 Review-Url: https://codereview.chromium.org/1933293002 --- src/gpu/gl/GrGLGpu.cpp | 7 ++++--- src/gpu/gl/GrGLGpu.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index d57cbac423..7eb833c880 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -882,7 +882,7 @@ bool GrGLGpu::onWritePixels(GrSurface* surface, if (success) { SkIRect rect = SkIRect::MakeXYWH(left, top, width, height); - this->didWriteToSurface(surface, &rect); + this->didWriteToSurface(surface, &rect, texels.count()); } return success; @@ -2672,14 +2672,15 @@ void GrGLGpu::flushViewport(const GrGLIRect& viewport) { } } -void GrGLGpu::didWriteToSurface(GrSurface* surface, const SkIRect* bounds) const { +void GrGLGpu::didWriteToSurface(GrSurface* surface, const SkIRect* bounds, int mipLevels) const { SkASSERT(surface); // Mark any MIP chain and resolve buffer as dirty if and only if there is a non-empty bounds. if (nullptr == bounds || !bounds->isEmpty()) { if (GrRenderTarget* target = surface->asRenderTarget()) { target->flagAsNeedingResolve(bounds); } - if (GrTexture* texture = surface->asTexture()) { + GrTexture* texture = surface->asTexture(); + if (texture && 1 == mipLevels) { texture->texturePriv().dirtyMipMaps(true); } } diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h index b6bc7baee7..5f3a751fee 100644 --- a/src/gpu/gl/GrGLGpu.h +++ b/src/gpu/gl/GrGLGpu.h @@ -309,7 +309,7 @@ private: // nullptr means whole target. Can be an empty rect. void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds, bool disableSRGB = false); // Handles cases where a surface will be updated without a call to flushRenderTarget - void didWriteToSurface(GrSurface*, const SkIRect* bounds) const; + void didWriteToSurface(GrSurface*, const SkIRect* bounds, int mipLevels = 1) const; // Need not be called if flushRenderTarget is used. void flushViewport(const GrGLIRect&); -- cgit v1.2.3