Index: src/gpu/GrGpu.cpp |
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp |
index eef7118a1b290aea3eccc3131fa3f4c67f14254d..691c0ab83abbaf672b6c031dcf12bad0bfbdeda6 100644 |
--- a/src/gpu/GrGpu.cpp |
+++ b/src/gpu/GrGpu.cpp |
@@ -20,6 +20,7 @@ |
#include "GrRenderTargetPriv.h" |
#include "GrStencilAttachment.h" |
#include "GrSurfacePriv.h" |
+#include "GrTexturePriv.h" |
#include "SkTypes.h" |
GrMesh& GrMesh::operator =(const GrMesh& di) { |
@@ -375,6 +376,8 @@ bool GrGpu::writePixels(GrSurface* surface, |
this->handleDirtyContext(); |
if (this->onWritePixels(surface, left, top, width, height, config, texels)) { |
+ SkIRect rect = SkIRect::MakeXYWH(left, top, width, height); |
+ this->didWriteToSurface(surface, &rect, texels.count()); |
fStats.incTextureUploads(); |
return true; |
} |
@@ -403,6 +406,8 @@ bool GrGpu::transferPixels(GrSurface* surface, |
this->handleDirtyContext(); |
if (this->onTransferPixels(surface, left, top, width, height, config, |
transferBuffer, offset, rowBytes)) { |
+ SkIRect rect = SkIRect::MakeXYWH(left, top, width, height); |
+ this->didWriteToSurface(surface, &rect); |
fStats.incTransfersToTexture(); |
return true; |
} |
@@ -415,6 +420,20 @@ void GrGpu::resolveRenderTarget(GrRenderTarget* target) { |
this->onResolveRenderTarget(target); |
} |
+void GrGpu::didWriteToSurface(GrSurface* surface, const SkIRect* bounds, uint32_t 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); |
+ } |
+ GrTexture* texture = surface->asTexture(); |
+ if (texture && 1 == mipLevels) { |
egdaniel
2016/04/29 18:10:28
just to clarify for myself here. The reason we mak
jvanverth1
2016/04/29 18:16:10
Yes, that's right.
|
+ texture->texturePriv().dirtyMipMaps(true); |
+ } |
+ } |
+} |
+ |
inline static uint8_t multisample_specs_id(uint8_t numSamples, GrSurfaceOrigin origin, |
const GrCaps& caps) { |
if (!caps.sampleLocationsSupport()) { |