Update LazyProxy creation to allow for a non-textureable result

Change-Id: Ic284b4f4220afa714159e07f57798a94fd40d63a
Reviewed-on: https://skia-review.googlesource.com/102484
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index ff66844..d7c1a46 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -167,9 +167,14 @@
     size_t maxResourceBytes;
     ctx->getResourceCacheLimits(&maxResourceCount, &maxResourceBytes);
 
+    bool mipmapped = rtc->asTextureProxy() ? GrMipMapped::kYes == rtc->asTextureProxy()->mipMapped()
+                                           : false;
+
     data->set(ctx->threadSafeProxy(), maxResourceCount, maxResourceBytes,
               rtc->origin(), rtc->width(), rtc->height(),
               rtc->colorSpaceInfo().config(), rtc->fsaaType(), rtc->numStencilSamples(),
+              SkSurfaceCharacterization::Textureable(SkToBool(rtc->asTextureProxy())),
+              SkSurfaceCharacterization::MipMapped(mipmapped),
               rtc->colorSpaceInfo().refColorSpace(), this->props());
 
     return true;
@@ -185,6 +190,21 @@
     size_t maxResourceBytes;
     ctx->getResourceCacheLimits(&maxResourceCount, &maxResourceBytes);
 
+    if (data.isTextureable()) {
+        if (!rtc->asTextureProxy()) {
+            // If the characterization was textureable we require the replay dest to also be
+            // textureable. If the characterized surface wasn't textureable we allow the replay
+            // dest to be textureable.
+            return false;
+        }
+
+        if (data.isMipMapped() && GrMipMapped::kNo == rtc->asTextureProxy()->mipMapped()) {
+            // Fail if the DDL's surface was mipmapped but the replay surface is not.
+            // Allow drawing to proceed if the DDL was not mipmapped but the replay surface is.
+            return false;
+        }
+    }
+
     return data.contextInfo() && data.contextInfo()->matches(ctx) &&
            data.cacheMaxResourceCount() <= maxResourceCount &&
            data.cacheMaxResourceBytes() <= maxResourceBytes &&