Revert of Revert of Move DstCopy on gpu into the GrXferProcessor. (patchset #1 id:1 of https://codereview.chromium.org/901663007/)
Reason for revert:
The revert didn't help the 10.9 bot. Unreverting by reverting the revert (which is basically relanding the original patch which itself was a revert of a revert). Revert.
Original issue's description:
> Revert of Move DstCopy on gpu into the GrXferProcessor. (patchset #11 id:200001 of https://codereview.chromium.org/885923002/)
>
> Reason for revert:
> Testing to see if reverting fixes 10.9 bots.
>
> Original issue's description:
> > Move DstCopy on gpu into the GrXferProcessor.
> >
> > BUG=skia:
> >
> > Committed: https://skia.googlesource.com/skia/+/74a11753604768bf461b80cabb66060e8564d82c
> >
> > Committed: https://skia.googlesource.com/skia/+/5e1378d0e075a323144ba14e0a4cbcca35eccc69
>
> TBR=joshualitt@google.com,egdaniel@google.com
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/21b2c53218ab25f4268e3992e51d916076a2a7ee
TBR=joshualitt@google.com,egdaniel@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/873723009
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 29e33b3..cb60f11 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -384,15 +384,15 @@
return true;
}
-bool GrDrawTarget::setupDstReadIfNecessary(GrPipelineBuilder* pipelineBuilder,
+bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuilder,
GrDeviceCoordTexture* dstCopy,
const SkRect* drawBounds) {
- if (this->caps()->dstReadInShaderSupport() || !pipelineBuilder->willEffectReadDstColor()) {
+ if (!pipelineBuilder.willXPNeedDstCopy(*this->caps())) {
return true;
}
SkIRect copyRect;
const GrClipData* clip = this->getClip();
- GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
+ GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
clip->getConservativeBounds(rt, ©Rect);
if (drawBounds) {
@@ -470,14 +470,9 @@
info.setDevBounds(*devBounds);
}
- // TODO: We should continue with incorrect blending.
- GrDeviceCoordTexture dstCopy;
- if (!this->setupDstReadIfNecessary(pipelineBuilder, &dstCopy, devBounds)) {
- return;
- }
this->setDrawBuffers(&info, gp->getVertexStride());
- this->onDraw(*pipelineBuilder, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL);
+ this->onDraw(*pipelineBuilder, gp, info, scissorState);
}
}
@@ -514,15 +509,9 @@
info.setDevBounds(*devBounds);
}
- // TODO: We should continue with incorrect blending.
- GrDeviceCoordTexture dstCopy;
- if (!this->setupDstReadIfNecessary(pipelineBuilder, &dstCopy, devBounds)) {
- return;
- }
-
this->setDrawBuffers(&info, gp->getVertexStride());
- this->onDraw(*pipelineBuilder, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL);
+ this->onDraw(*pipelineBuilder, gp, info, scissorState);
}
}
@@ -541,12 +530,7 @@
return;
}
- GrDeviceCoordTexture dstCopy;
- if (!this->setupDstReadIfNecessary(pipelineBuilder, &dstCopy, devBounds)) {
- return;
- }
-
- this->onDrawBatch(batch, *pipelineBuilder, scissorState, dstCopy.texture() ? &dstCopy : NULL);
+ this->onDrawBatch(batch, *pipelineBuilder, scissorState, devBounds);
}
static const GrStencilSettings& winding_path_stencil_settings() {
@@ -636,13 +620,8 @@
pipelineBuilder->getRenderTarget()->getStencilBuffer(),
&stencilSettings);
- GrDeviceCoordTexture dstCopy;
- if (!this->setupDstReadIfNecessary(pipelineBuilder, &dstCopy, &devBounds)) {
- return;
- }
-
this->onDrawPath(*pipelineBuilder, pathProc, path, scissorState, stencilSettings,
- dstCopy.texture() ? &dstCopy : NULL);
+ &devBounds);
}
void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder,
@@ -676,18 +655,12 @@
pipelineBuilder->getRenderTarget()->getStencilBuffer(),
&stencilSettings);
- // Don't compute a bounding box for setupDstReadIfNecessary(), we'll opt
+ // Don't compute a bounding box for dst copy texture, we'll opt
// instead for it to just copy the entire dst. Realistically this is a moot
// point, because any context that supports NV_path_rendering will also
// support NV_blend_equation_advanced.
- GrDeviceCoordTexture dstCopy;
- if (!this->setupDstReadIfNecessary(pipelineBuilder, &dstCopy, NULL)) {
- return;
- }
-
this->onDrawPaths(*pipelineBuilder, pathProc, pathRange, indices, indexType, transformValues,
- transformType, count, scissorState, stencilSettings,
- dstCopy.texture() ? &dstCopy : NULL);
+ transformType, count, scissorState, stencilSettings, NULL);
}
void GrDrawTarget::clear(const SkIRect* rect,
@@ -793,12 +766,6 @@
info.setDevBounds(*devBounds);
}
- // TODO: We should continue with incorrect blending.
- GrDeviceCoordTexture dstCopy;
- if (!this->setupDstReadIfNecessary(pipelineBuilder, &dstCopy, devBounds)) {
- return;
- }
-
while (instanceCount) {
info.fInstanceCount = SkTMin(instanceCount, maxInstancesPerDraw);
info.fVertexCount = info.fInstanceCount * verticesPerInstance;
@@ -812,8 +779,7 @@
info.fVertexCount,
info.fIndexCount)) {
this->setDrawBuffers(&info, gp->getVertexStride());
- this->onDraw(*pipelineBuilder, gp, info, scissorState,
- dstCopy.texture() ? &dstCopy : NULL);
+ this->onDraw(*pipelineBuilder, gp, info, scissorState);
}
info.fStartVertex += info.fVertexCount;
instanceCount -= info.fInstanceCount;