Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 885923002: Move DstCopy on gpu into the GrXferProcessor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index b89d70ea2be724e2a8fb5bff5e1f6364efd5f31d..03d4115c329fd1a395c05f4d4b83de4bcec02967 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -384,15 +384,15 @@ bool GrDrawTarget::checkDraw(const GrPipelineBuilder& pipelineBuilder,
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, &copyRect);
if (drawBounds) {
@@ -416,6 +416,7 @@ bool GrDrawTarget::setupDstReadIfNecessary(GrPipelineBuilder* pipelineBuilder,
this->initCopySurfaceDstDesc(rt, &desc);
desc.fWidth = copyRect.width();
desc.fHeight = copyRect.height();
+ desc.fOrigin = kTopLeft_GrSurfaceOrigin;
bsalomon 2015/02/03 17:28:24 maybe a comment here that our contract with XP is
egdaniel 2015/02/03 19:50:57 Done.
SkAutoTUnref<GrTexture> copy(
fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch));
@@ -470,14 +471,9 @@ void GrDrawTarget::drawIndexed(GrPipelineBuilder* pipelineBuilder,
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 +510,9 @@ void GrDrawTarget::drawNonIndexed(GrPipelineBuilder* pipelineBuilder,
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 +531,7 @@ void GrDrawTarget::drawBatch(GrPipelineBuilder* pipelineBuilder,
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 +621,8 @@ void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder,
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 +656,12 @@ void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder,
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 +767,6 @@ void GrDrawTarget::drawIndexedInstances(GrPipelineBuilder* pipelineBuilder,
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 +780,7 @@ void GrDrawTarget::drawIndexedInstances(GrPipelineBuilder* pipelineBuilder,
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;

Powered by Google App Engine
This is Rietveld 408576698