Revert "Add a deferred copy surface"
This reverts commit 4431de6af930a8638c194b072558ea3a4b79d908.
Reason for revert: ANGLE errors (at the very least)
Original change's description:
> Add a deferred copy surface
>
> This CL forces all GrSurface copies to go through a GrSurfaceContext (rather than GrContext).
>
> There is a bit of goofiness going on here until read/writePixels is also consolidated in GrSurfaceContext and a proxy-backed SkImage/SkSurface is added.
>
> Change-Id: Iab1867668d8146a766201158a251b9174438ee2b
> Reviewed-on: https://skia-review.googlesource.com/5773
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
>
TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I61408d9e306b9b1ab32f93ab086e95184e12857f
Reviewed-on: https://skia-review.googlesource.com/5938
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 2e66c0c..ff5b026 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -541,6 +541,43 @@
fDrawingManager->prepareSurfaceForExternalIO(surface);
}
+bool GrContext::copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
+ const SkIPoint& dstPoint) {
+ ASSERT_SINGLE_OWNER
+ RETURN_FALSE_IF_ABANDONED
+ GR_AUDIT_TRAIL_AUTO_FRAME(&fAuditTrail, "GrContext::copySurface");
+
+ if (!src || !dst) {
+ return false;
+ }
+ ASSERT_OWNED_RESOURCE(src);
+ ASSERT_OWNED_RESOURCE(dst);
+
+ // We don't allow conversion between integer configs and float/fixed configs.
+ if (GrPixelConfigIsSint(dst->config()) != GrPixelConfigIsSint(src->config())) {
+ return false;
+ }
+
+#ifndef ENABLE_MDB
+ // We can't yet fully defer copies to textures, so GrTextureContext::copySurface will
+ // execute the copy immediately. Ensure the data is ready.
+ src->flushWrites();
+#endif
+
+ sk_sp<GrSurfaceContext> surfaceContext(
+ this->contextPriv().makeWrappedSurfaceContext(sk_ref_sp(dst)));
+
+ if (!surfaceContext) {
+ return false;
+ }
+
+ if (!surfaceContext->copySurface(src, srcRect, dstPoint)) {
+ return false;
+ }
+
+ return true;
+}
+
void GrContext::flushSurfaceWrites(GrSurface* surface) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
@@ -602,36 +639,8 @@
}
}
-sk_sp<GrSurfaceContext> GrContextPriv::makeDeferredSurfaceContext(const GrSurfaceDesc& dstDesc,
- SkBudgeted isDstBudgeted) {
-
- sk_sp<GrSurfaceProxy> proxy = GrSurfaceProxy::MakeDeferred(*fContext->caps(), dstDesc,
- SkBackingFit::kExact, isDstBudgeted);
-
- if (proxy->asRenderTargetProxy()) {
- return this->drawingManager()->makeRenderTargetContext(std::move(proxy), nullptr, nullptr);
- } else {
- SkASSERT(proxy->asTextureProxy());
- return this->drawingManager()->makeTextureContext(std::move(proxy));
- }
-
- return nullptr;
-}
-
-sk_sp<GrSurfaceContext> GrContextPriv::makeTestSurfaceContext(sk_sp<GrSurfaceProxy> proxy) {
-
- if (proxy->asRenderTargetProxy()) {
- return this->drawingManager()->makeRenderTargetContext(std::move(proxy), nullptr, nullptr);
- } else {
- SkASSERT(proxy->asTextureProxy());
- return this->drawingManager()->makeTextureContext(std::move(proxy));
- }
-
- return nullptr;
-}
-
sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContext(
- const GrBackendTextureDesc& desc,
+ const GrBackendTextureDesc& desc,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* props,
GrWrapOwnership ownership) {