Check that instantiated texture matches the proxy's protectedness


Change-Id: I9241c66f4312216dce8b0c1983dcfaf1c6ca8e50
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/738883
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/ganesh/GrSurfaceProxy.cpp b/src/gpu/ganesh/GrSurfaceProxy.cpp
index e41b6f2..3448077 100644
--- a/src/gpu/ganesh/GrSurfaceProxy.cpp
+++ b/src/gpu/ganesh/GrSurfaceProxy.cpp
@@ -501,6 +501,7 @@
 void GrSurfaceProxy::validateSurface(const GrSurface* surface) {
     SkASSERTF(surface->backendFormat() == fFormat, "%s != %s",
               surface->backendFormat().toStr().c_str(), fFormat.toStr().c_str());
+    SkASSERT(skgpu::Protected(surface->isProtected()) == this->isProtected());
 
     this->onValidateSurface(surface);
 }