Update copyOp to split-opList world
Change-Id: Ib18fc0a589185b11b21241e50acb7b506c44bfac Reviewed-on: https://skia-review.googlesource.com/17325 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
9f6f41b01b
commit
a16f6cb40a
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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,15 +55,20 @@ 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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
state->gpu()->copySurface(dst, src, fSrcRect, 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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user