aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/gpu/GrRenderTargetContext.cpp4
-rw-r--r--src/gpu/GrRenderTargetOpList.cpp10
-rw-r--r--src/gpu/GrRenderTargetOpList.h4
-rw-r--r--src/gpu/GrTextureContext.cpp2
-rw-r--r--src/gpu/GrTextureOpList.cpp6
-rw-r--r--src/gpu/GrTextureOpList.h2
-rw-r--r--src/gpu/ops/GrCopySurfaceOp.cpp16
-rw-r--r--src/gpu/ops/GrCopySurfaceOp.h40
8 files changed, 36 insertions, 48 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 4e6dc35af4..c72c4d1d6f 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -138,8 +138,8 @@ bool GrRenderTargetContext::onCopy(GrSurfaceProxy* srcProxy,
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::onCopy");
- return this->getOpList()->copySurface(fContext->resourceProvider(),
- this, srcProxy, srcRect, dstPoint);
+ return this->getOpList()->copySurface(*this->caps(),
+ this->asSurfaceProxy(), srcProxy, srcRect, dstPoint);
}
void GrRenderTargetContext::drawText(const GrClip& clip, const SkPaint& skPaint,
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 5618bdcc0d..f7aecdd9d7 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -209,15 +209,13 @@ void GrRenderTargetOpList::fullClear(const GrCaps& caps, GrColor color) {
////////////////////////////////////////////////////////////////////////////////
// MDB TODO: fuse with GrTextureOpList::copySurface
-bool GrRenderTargetOpList::copySurface(GrResourceProvider* resourceProvider,
- GrRenderTargetContext* dst,
+bool GrRenderTargetOpList::copySurface(const GrCaps& caps,
+ GrSurfaceProxy* dst,
GrSurfaceProxy* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
SkASSERT(dst->asRenderTargetProxy() == fTarget.get());
-
- std::unique_ptr<GrOp> op = GrCopySurfaceOp::Make(resourceProvider, dst->asSurfaceProxy(),
- src, srcRect, dstPoint);
+ std::unique_ptr<GrOp> op = GrCopySurfaceOp::Make(dst, src, srcRect, dstPoint);
if (!op) {
return false;
}
@@ -225,7 +223,7 @@ bool GrRenderTargetOpList::copySurface(GrResourceProvider* resourceProvider,
this->addDependency(src);
#endif
- this->recordOp(std::move(op), *resourceProvider->caps());
+ this->recordOp(std::move(op), caps);
return true;
}
diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h
index 79dbd748de..216ede451e 100644
--- a/src/gpu/GrRenderTargetOpList.h
+++ b/src/gpu/GrRenderTargetOpList.h
@@ -88,8 +88,8 @@ public:
* depending on the type of surface, configs, etc, and the backend-specific
* limitations.
*/
- bool copySurface(GrResourceProvider* resourceProvider,
- GrRenderTargetContext* dst,
+ bool copySurface(const GrCaps& caps,
+ GrSurfaceProxy* dst,
GrSurfaceProxy* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint);
diff --git a/src/gpu/GrTextureContext.cpp b/src/gpu/GrTextureContext.cpp
index 0021c23da1..b4e76cbca1 100644
--- a/src/gpu/GrTextureContext.cpp
+++ b/src/gpu/GrTextureContext.cpp
@@ -77,7 +77,7 @@ bool GrTextureContext::onCopy(GrSurfaceProxy* srcProxy,
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrTextureContext::onCopy");
- return this->getOpList()->copySurface(fContext->resourceProvider(),
+ return this->getOpList()->copySurface(*fContext->caps(),
fTextureProxy.get(), srcProxy, srcRect, dstPoint);
}
diff --git a/src/gpu/GrTextureOpList.cpp b/src/gpu/GrTextureOpList.cpp
index d15c778296..3c127f69f0 100644
--- a/src/gpu/GrTextureOpList.cpp
+++ b/src/gpu/GrTextureOpList.cpp
@@ -78,12 +78,14 @@ void GrTextureOpList::reset() {
////////////////////////////////////////////////////////////////////////////////
// MDB TODO: fuse with GrRenderTargetOpList::copySurface
-bool GrTextureOpList::copySurface(GrResourceProvider* resourceProvider,
+bool GrTextureOpList::copySurface(const GrCaps& caps,
GrSurfaceProxy* dst,
GrSurfaceProxy* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
- std::unique_ptr<GrOp> op = GrCopySurfaceOp::Make(resourceProvider, dst, src, srcRect, dstPoint);
+ SkASSERT(dst == fTarget.get());
+
+ std::unique_ptr<GrOp> op = GrCopySurfaceOp::Make(dst, src, srcRect, dstPoint);
if (!op) {
return false;
}
diff --git a/src/gpu/GrTextureOpList.h b/src/gpu/GrTextureOpList.h
index 0cc138d171..1ca45b530f 100644
--- a/src/gpu/GrTextureOpList.h
+++ b/src/gpu/GrTextureOpList.h
@@ -51,7 +51,7 @@ public:
* depending on the type of surface, configs, etc, and the backend-specific
* limitations.
*/
- bool copySurface(GrResourceProvider* resourceProvider,
+ bool copySurface(const GrCaps& caps,
GrSurfaceProxy* dst,
GrSurfaceProxy* src,
const SkIRect& srcRect,
diff --git a/src/gpu/ops/GrCopySurfaceOp.cpp b/src/gpu/ops/GrCopySurfaceOp.cpp
index 9cbde0e53b..1a9a5e0dfa 100644
--- a/src/gpu/ops/GrCopySurfaceOp.cpp
+++ b/src/gpu/ops/GrCopySurfaceOp.cpp
@@ -58,8 +58,7 @@ static bool clip_src_rect_and_dst_point(const GrSurfaceProxy* dst,
return !clippedSrcRect->isEmpty();
}
-std::unique_ptr<GrOp> GrCopySurfaceOp::Make(GrResourceProvider* resourceProvider,
- GrSurfaceProxy* dstProxy, GrSurfaceProxy* srcProxy,
+std::unique_ptr<GrOp> GrCopySurfaceOp::Make(GrSurfaceProxy* dstProxy, GrSurfaceProxy* srcProxy,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
SkASSERT(dstProxy);
@@ -75,17 +74,6 @@ std::unique_ptr<GrOp> GrCopySurfaceOp::Make(GrResourceProvider* resourceProvider
return nullptr;
}
- // MDB TODO: remove this instantiation
- GrSurface* dstTex = dstProxy->instantiate(resourceProvider);
- if (!dstTex) {
- return nullptr;
- }
- GrSurface* srcTex = srcProxy->instantiate(resourceProvider);
- if (!srcTex) {
- return nullptr;
- }
-
- return std::unique_ptr<GrOp>(new GrCopySurfaceOp(dstTex, srcTex,
- dstProxy->uniqueID(), srcProxy->uniqueID(),
+ return std::unique_ptr<GrOp>(new GrCopySurfaceOp(dstProxy, srcProxy,
clippedSrcRect, clippedDstPoint));
}
diff --git a/src/gpu/ops/GrCopySurfaceOp.h b/src/gpu/ops/GrCopySurfaceOp.h
index f479f28d1e..f1dac8fdfa 100644
--- a/src/gpu/ops/GrCopySurfaceOp.h
+++ b/src/gpu/ops/GrCopySurfaceOp.h
@@ -15,9 +15,7 @@ class GrCopySurfaceOp final : public GrOp {
public:
DEFINE_OP_CLASS_ID
- // MDB TODO: remove the resourceProvider parameter
- static std::unique_ptr<GrOp> Make(GrResourceProvider*,
- GrSurfaceProxy* dst, GrSurfaceProxy* src,
+ static std::unique_ptr<GrOp> Make(GrSurfaceProxy* dst, GrSurfaceProxy* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint);
@@ -26,10 +24,10 @@ public:
SkString dumpInfo() const override {
SkString string;
string.append(INHERITED::dumpInfo());
- string.printf("src: (proxyID: %d, rtID: %d), dst: (proxyID: %d, rtID: %d),\n"
- "srcRect: [L: %d, T: %d, R: %d, B: %d], dstPt: [X: %d, Y: %d]\n",
- fSrcProxyID.asUInt(), fSrc.get()->uniqueID().asUInt(),
- fDstProxyID.asUInt(), fDst.get()->uniqueID().asUInt(),
+ string.printf("srcProxyID: %d, dstProxyID: %d,\n"
+ "srcRect: [ L: %d, T: %d, R: %d, B: %d ], dstPt: [ X: %d, Y: %d ]\n",
+ fSrc.get()->uniqueID().asUInt(),
+ fDst.get()->uniqueID().asUInt(),
fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBottom,
fDstPoint.fX, fDstPoint.fY);
return string;
@@ -38,12 +36,9 @@ public:
bool needsCommandBufferIsolation() const override { return true; }
private:
- GrCopySurfaceOp(GrSurface* dst, GrSurface* src,
- GrSurfaceProxy::UniqueID dstID, GrSurfaceProxy::UniqueID srcID,
+ GrCopySurfaceOp(GrSurfaceProxy* dst, GrSurfaceProxy* src,
const SkIRect& srcRect, const SkIPoint& dstPoint)
: INHERITED(ClassID())
- , fDstProxyID(dstID)
- , fSrcProxyID(srcID)
, fDst(dst)
, fSrc(src)
, fSrcRect(srcRect)
@@ -60,17 +55,22 @@ private:
void onExecute(GrOpFlushState* state) override {
SkASSERT(!state->commandBuffer());
- state->gpu()->copySurface(fDst.get(), fSrc.get(), fSrcRect, fDstPoint);
+
+ GrSurface* dst = fDst.get()->instantiate(state->resourceProvider());
+ GrSurface* src = fSrc.get()->instantiate(state->resourceProvider());
+ if (!dst || !src) {
+ return;
+ }
+
+ state->gpu()->copySurface(dst, src, fSrcRect, fDstPoint);
}
- // MDB TODO: remove the proxy IDs once the GrSurfaceProxy carries the ref since they will
- // be redundant
- GrSurfaceProxy::UniqueID fDstProxyID;
- GrSurfaceProxy::UniqueID fSrcProxyID;
- GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst;
- GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc;
- SkIRect fSrcRect;
- SkIPoint fDstPoint;
+ // For RenderTargetContexts 'fDst' is redundant with the RenderTarget that will be passed
+ // into onExecute in the drawOpArgs.
+ GrPendingIOResource<GrSurfaceProxy, kWrite_GrIOType> fDst;
+ GrPendingIOResource<GrSurfaceProxy, kRead_GrIOType> fSrc;
+ SkIRect fSrcRect;
+ SkIPoint fDstPoint;
typedef GrOp INHERITED;
};