updateBackendTexture uses GrSurfaceContext to write pixmaps.

Bug: skia:11786

Change-Id: I1c70b7152a69b2bb976aec2ed1dc9d5f96cad7ab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348185
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrSurfaceContext.h b/src/gpu/GrSurfaceContext.h
index beff3c7..deb2242 100644
--- a/src/gpu/GrSurfaceContext.h
+++ b/src/gpu/GrSurfaceContext.h
@@ -132,8 +132,14 @@
      * @param dContext         The direct context to use
      * @param src              source for the write
      * @param dstPt            offset w/in the surface context at which to write
+     * @param prepForSampling  Should the surface be configured for sampling after the write
+     *                         completes. Used to avoid a separate submission to change texture
+     *                         layout
      */
-    bool writePixels(GrDirectContext* dContext, GrCPixmap src, SkIPoint dstPt);
+    bool writePixels(GrDirectContext* dContext,
+                     GrCPixmap src,
+                     SkIPoint dstPt,
+                     bool prepForSampling = false);
 
     /**
      * Fully populates either the base level or all MIP levels of the GrSurface with pixel data.
@@ -141,8 +147,14 @@
      * @param src              Array of pixmaps
      * @param numLevels        Number of pixmaps in src. To succeed this must be 1 or the total
      *                         number of MIP levels.
+     * @param prepForSampling  Should the surface be configured for sampling after the write
+     *                         completes. Used to avoid a separate submission to change texture
+     *                         layout
      */
-    bool writePixels(GrDirectContext* dContext, const GrCPixmap src[], int numLevels);
+    bool writePixels(GrDirectContext* dContext,
+                     const GrCPixmap src[],
+                     int numLevels,
+                     bool prepForSampling = false);
 
     GrSurfaceProxy* asSurfaceProxy() { return fReadView.proxy(); }
     const GrSurfaceProxy* asSurfaceProxy() const { return fReadView.proxy(); }
@@ -257,7 +269,8 @@
     bool internalWritePixels(GrDirectContext* dContext,
                              const GrCPixmap src[],
                              int numLevels,
-                             SkIPoint);
+                             SkIPoint,
+                             bool prepForSampling);
 
     class AsyncReadResult;