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();)
|
SkDEBUGCODE(this->validate();)
|
||||||
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::onCopy");
|
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::onCopy");
|
||||||
|
|
||||||
return this->getOpList()->copySurface(fContext->resourceProvider(),
|
return this->getOpList()->copySurface(*this->caps(),
|
||||||
this, srcProxy, srcRect, dstPoint);
|
this->asSurfaceProxy(), srcProxy, srcRect, dstPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrRenderTargetContext::drawText(const GrClip& clip, const SkPaint& skPaint,
|
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
|
// MDB TODO: fuse with GrTextureOpList::copySurface
|
||||||
bool GrRenderTargetOpList::copySurface(GrResourceProvider* resourceProvider,
|
bool GrRenderTargetOpList::copySurface(const GrCaps& caps,
|
||||||
GrRenderTargetContext* dst,
|
GrSurfaceProxy* dst,
|
||||||
GrSurfaceProxy* src,
|
GrSurfaceProxy* src,
|
||||||
const SkIRect& srcRect,
|
const SkIRect& srcRect,
|
||||||
const SkIPoint& dstPoint) {
|
const SkIPoint& dstPoint) {
|
||||||
SkASSERT(dst->asRenderTargetProxy() == fTarget.get());
|
SkASSERT(dst->asRenderTargetProxy() == fTarget.get());
|
||||||
|
std::unique_ptr<GrOp> op = GrCopySurfaceOp::Make(dst, src, srcRect, dstPoint);
|
||||||
std::unique_ptr<GrOp> op = GrCopySurfaceOp::Make(resourceProvider, dst->asSurfaceProxy(),
|
|
||||||
src, srcRect, dstPoint);
|
|
||||||
if (!op) {
|
if (!op) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -225,7 +223,7 @@ bool GrRenderTargetOpList::copySurface(GrResourceProvider* resourceProvider,
|
|||||||
this->addDependency(src);
|
this->addDependency(src);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this->recordOp(std::move(op), *resourceProvider->caps());
|
this->recordOp(std::move(op), caps);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,8 +88,8 @@ public:
|
|||||||
* depending on the type of surface, configs, etc, and the backend-specific
|
* depending on the type of surface, configs, etc, and the backend-specific
|
||||||
* limitations.
|
* limitations.
|
||||||
*/
|
*/
|
||||||
bool copySurface(GrResourceProvider* resourceProvider,
|
bool copySurface(const GrCaps& caps,
|
||||||
GrRenderTargetContext* dst,
|
GrSurfaceProxy* dst,
|
||||||
GrSurfaceProxy* src,
|
GrSurfaceProxy* src,
|
||||||
const SkIRect& srcRect,
|
const SkIRect& srcRect,
|
||||||
const SkIPoint& dstPoint);
|
const SkIPoint& dstPoint);
|
||||||
|
@ -77,7 +77,7 @@ bool GrTextureContext::onCopy(GrSurfaceProxy* srcProxy,
|
|||||||
SkDEBUGCODE(this->validate();)
|
SkDEBUGCODE(this->validate();)
|
||||||
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrTextureContext::onCopy");
|
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);
|
fTextureProxy.get(), srcProxy, srcRect, dstPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,12 +78,14 @@ void GrTextureOpList::reset() {
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// MDB TODO: fuse with GrRenderTargetOpList::copySurface
|
// MDB TODO: fuse with GrRenderTargetOpList::copySurface
|
||||||
bool GrTextureOpList::copySurface(GrResourceProvider* resourceProvider,
|
bool GrTextureOpList::copySurface(const GrCaps& caps,
|
||||||
GrSurfaceProxy* dst,
|
GrSurfaceProxy* dst,
|
||||||
GrSurfaceProxy* src,
|
GrSurfaceProxy* src,
|
||||||
const SkIRect& srcRect,
|
const SkIRect& srcRect,
|
||||||
const SkIPoint& dstPoint) {
|
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) {
|
if (!op) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
* depending on the type of surface, configs, etc, and the backend-specific
|
* depending on the type of surface, configs, etc, and the backend-specific
|
||||||
* limitations.
|
* limitations.
|
||||||
*/
|
*/
|
||||||
bool copySurface(GrResourceProvider* resourceProvider,
|
bool copySurface(const GrCaps& caps,
|
||||||
GrSurfaceProxy* dst,
|
GrSurfaceProxy* dst,
|
||||||
GrSurfaceProxy* src,
|
GrSurfaceProxy* src,
|
||||||
const SkIRect& srcRect,
|
const SkIRect& srcRect,
|
||||||
|
@ -58,8 +58,7 @@ static bool clip_src_rect_and_dst_point(const GrSurfaceProxy* dst,
|
|||||||
return !clippedSrcRect->isEmpty();
|
return !clippedSrcRect->isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<GrOp> GrCopySurfaceOp::Make(GrResourceProvider* resourceProvider,
|
std::unique_ptr<GrOp> GrCopySurfaceOp::Make(GrSurfaceProxy* dstProxy, GrSurfaceProxy* srcProxy,
|
||||||
GrSurfaceProxy* dstProxy, GrSurfaceProxy* srcProxy,
|
|
||||||
const SkIRect& srcRect,
|
const SkIRect& srcRect,
|
||||||
const SkIPoint& dstPoint) {
|
const SkIPoint& dstPoint) {
|
||||||
SkASSERT(dstProxy);
|
SkASSERT(dstProxy);
|
||||||
@ -75,17 +74,6 @@ std::unique_ptr<GrOp> GrCopySurfaceOp::Make(GrResourceProvider* resourceProvider
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MDB TODO: remove this instantiation
|
return std::unique_ptr<GrOp>(new GrCopySurfaceOp(dstProxy, srcProxy,
|
||||||
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(),
|
|
||||||
clippedSrcRect, clippedDstPoint));
|
clippedSrcRect, clippedDstPoint));
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,7 @@ class GrCopySurfaceOp final : public GrOp {
|
|||||||
public:
|
public:
|
||||||
DEFINE_OP_CLASS_ID
|
DEFINE_OP_CLASS_ID
|
||||||
|
|
||||||
// MDB TODO: remove the resourceProvider parameter
|
static std::unique_ptr<GrOp> Make(GrSurfaceProxy* dst, GrSurfaceProxy* src,
|
||||||
static std::unique_ptr<GrOp> Make(GrResourceProvider*,
|
|
||||||
GrSurfaceProxy* dst, GrSurfaceProxy* src,
|
|
||||||
const SkIRect& srcRect,
|
const SkIRect& srcRect,
|
||||||
const SkIPoint& dstPoint);
|
const SkIPoint& dstPoint);
|
||||||
|
|
||||||
@ -26,10 +24,10 @@ public:
|
|||||||
SkString dumpInfo() const override {
|
SkString dumpInfo() const override {
|
||||||
SkString string;
|
SkString string;
|
||||||
string.append(INHERITED::dumpInfo());
|
string.append(INHERITED::dumpInfo());
|
||||||
string.printf("src: (proxyID: %d, rtID: %d), dst: (proxyID: %d, rtID: %d),\n"
|
string.printf("srcProxyID: %d, dstProxyID: %d,\n"
|
||||||
"srcRect: [L: %d, T: %d, R: %d, B: %d], dstPt: [X: %d, Y: %d]\n",
|
"srcRect: [ L: %d, T: %d, R: %d, B: %d ], dstPt: [ X: %d, Y: %d ]\n",
|
||||||
fSrcProxyID.asUInt(), fSrc.get()->uniqueID().asUInt(),
|
fSrc.get()->uniqueID().asUInt(),
|
||||||
fDstProxyID.asUInt(), fDst.get()->uniqueID().asUInt(),
|
fDst.get()->uniqueID().asUInt(),
|
||||||
fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBottom,
|
fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBottom,
|
||||||
fDstPoint.fX, fDstPoint.fY);
|
fDstPoint.fX, fDstPoint.fY);
|
||||||
return string;
|
return string;
|
||||||
@ -38,12 +36,9 @@ public:
|
|||||||
bool needsCommandBufferIsolation() const override { return true; }
|
bool needsCommandBufferIsolation() const override { return true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GrCopySurfaceOp(GrSurface* dst, GrSurface* src,
|
GrCopySurfaceOp(GrSurfaceProxy* dst, GrSurfaceProxy* src,
|
||||||
GrSurfaceProxy::UniqueID dstID, GrSurfaceProxy::UniqueID srcID,
|
|
||||||
const SkIRect& srcRect, const SkIPoint& dstPoint)
|
const SkIRect& srcRect, const SkIPoint& dstPoint)
|
||||||
: INHERITED(ClassID())
|
: INHERITED(ClassID())
|
||||||
, fDstProxyID(dstID)
|
|
||||||
, fSrcProxyID(srcID)
|
|
||||||
, fDst(dst)
|
, fDst(dst)
|
||||||
, fSrc(src)
|
, fSrc(src)
|
||||||
, fSrcRect(srcRect)
|
, fSrcRect(srcRect)
|
||||||
@ -60,17 +55,22 @@ private:
|
|||||||
|
|
||||||
void onExecute(GrOpFlushState* state) override {
|
void onExecute(GrOpFlushState* state) override {
|
||||||
SkASSERT(!state->commandBuffer());
|
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
|
// For RenderTargetContexts 'fDst' is redundant with the RenderTarget that will be passed
|
||||||
// be redundant
|
// into onExecute in the drawOpArgs.
|
||||||
GrSurfaceProxy::UniqueID fDstProxyID;
|
GrPendingIOResource<GrSurfaceProxy, kWrite_GrIOType> fDst;
|
||||||
GrSurfaceProxy::UniqueID fSrcProxyID;
|
GrPendingIOResource<GrSurfaceProxy, kRead_GrIOType> fSrc;
|
||||||
GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst;
|
SkIRect fSrcRect;
|
||||||
GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc;
|
SkIPoint fDstPoint;
|
||||||
SkIRect fSrcRect;
|
|
||||||
SkIPoint fDstPoint;
|
|
||||||
|
|
||||||
typedef GrOp INHERITED;
|
typedef GrOp INHERITED;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user