Move prepareForExternalIO from GrRenderTarget to GrDrawContext
This is part of the push to remove GrRenderTarget from SkGpuDevice
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2182543003
Review-Url: https://codereview.chromium.org/2182543003
diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h
index 3cc57b5..01f4ac9 100644
--- a/include/gpu/GrDrawContext.h
+++ b/include/gpu/GrDrawContext.h
@@ -253,6 +253,12 @@
const SkIRect& center,
const SkRect& dst);
+ /**
+ * After this returns any pending surface IO will be issued to the backend 3D API and
+ * if the surface has MSAA it will be resolved.
+ */
+ void prepareForExternalIO();
+
bool isStencilBufferMultisampled() const {
return fRenderTarget->isStencilBufferMultisampled();
}
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index 8e8eb0f..e002765 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -114,13 +114,6 @@
*/
void flushWrites();
-
- /**
- * After this returns any pending surface IO will be issued to the backend 3D API and
- * if the surface has MSAA it will be resolved.
- */
- void prepareForExternalIO();
-
/** Access methods that are only to be used within Skia code. */
inline GrSurfacePriv surfacePriv();
inline const GrSurfacePriv surfacePriv() const;
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 48242e2..e6bc55b 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -980,6 +980,16 @@
this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch);
}
+void GrDrawContext::prepareForExternalIO() {
+ ASSERT_SINGLE_OWNER
+ RETURN_IF_ABANDONED
+ SkDEBUGCODE(this->validate();)
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::prepareForExternalIO");
+
+ ASSERT_OWNED_RESOURCE(fRenderTarget);
+
+ fDrawingManager->getContext()->prepareSurfaceForExternalIO(fRenderTarget.get());
+}
void GrDrawContext::drawNonAAFilledRect(const GrClip& clip,
const GrPaint& paint,
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index 6dc90a3..824a6a2 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -149,12 +149,6 @@
}
}
-void GrSurface::prepareForExternalIO() {
- if (!this->wasDestroyed()) {
- this->getContext()->prepareSurfaceForExternalIO(this);
- }
-}
-
bool GrSurface::hasPendingRead() const {
const GrTexture* thisTex = this->asTexture();
if (thisTex && thisTex->internalHasPendingRead()) {
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 5bc347c..116d3c6 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1727,7 +1727,7 @@
void SkGpuDevice::flush() {
ASSERT_SINGLE_OWNER
- fRenderTarget->prepareForExternalIO();
+ fDrawContext->prepareForExternalIO();
}
///////////////////////////////////////////////////////////////////////////////