Index: src/gpu/GrDrawTarget.cpp |
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp |
index adb7128e1c5118d9d6a428185d943c8710c2c0ec..320052ec06557047f2a26ff473672551e38064cd 100644 |
--- a/src/gpu/GrDrawTarget.cpp |
+++ b/src/gpu/GrDrawTarget.cpp |
@@ -307,6 +307,7 @@ void GrDrawTarget::popGeometrySource() { |
//////////////////////////////////////////////////////////////////////////////// |
bool GrDrawTarget::checkDraw(const GrDrawState& drawState, |
+ const GrGeometryProcessor* gp, |
GrPrimitiveType type, |
int startVertex, |
int startIndex, |
@@ -349,8 +350,7 @@ bool GrDrawTarget::checkDraw(const GrDrawState& drawState, |
SkASSERT(drawState.getRenderTarget()); |
- if (drawState.hasGeometryProcessor()) { |
- const GrGeometryProcessor* gp = drawState.getGeometryProcessor(); |
+ if (gp) { |
int numTextures = gp->numTextures(); |
for (int t = 0; t < numTextures; ++t) { |
GrTexture* texture = gp->texture(t); |
@@ -383,12 +383,13 @@ bool GrDrawTarget::checkDraw(const GrDrawState& drawState, |
} |
bool GrDrawTarget::setupDstReadIfNecessary(GrDrawState* ds, |
+ const GrPrimitiveProcessor* pp, |
GrColor color, |
uint8_t coverage, |
GrDeviceCoordTexture* dstCopy, |
const SkRect* drawBounds) { |
GrColor c = GrColorPackRGBA(coverage, coverage, coverage, coverage); |
- if (this->caps()->dstReadInShaderSupport() || !ds->willEffectReadDstColor(color, c)) { |
+ if (this->caps()->dstReadInShaderSupport() || !ds->willEffectReadDstColor(pp, color, c)) { |
return true; |
} |
SkIRect copyRect; |
@@ -436,6 +437,7 @@ bool GrDrawTarget::setupDstReadIfNecessary(GrDrawState* ds, |
} |
void GrDrawTarget::drawIndexed(GrDrawState* ds, |
+ const GrGeometryProcessor* gp, |
GrPrimitiveType type, |
int startVertex, |
int startIndex, |
@@ -444,7 +446,7 @@ void GrDrawTarget::drawIndexed(GrDrawState* ds, |
const SkRect* devBounds) { |
SkASSERT(ds); |
if (indexCount > 0 && |
- this->checkDraw(*ds, type, startVertex, startIndex, vertexCount, indexCount)) { |
+ this->checkDraw(*ds, gp, type, startVertex, startIndex, vertexCount, indexCount)) { |
// Setup clip |
GrClipMaskManager::ScissorState scissorState; |
@@ -471,24 +473,24 @@ void GrDrawTarget::drawIndexed(GrDrawState* ds, |
// TODO: We should continue with incorrect blending. |
GrDeviceCoordTexture dstCopy; |
- const GrGeometryProcessor* gp = ds->getGeometryProcessor(); |
- if (!this->setupDstReadIfNecessary(ds, gp->getColor(), gp->getCoverage(), &dstCopy, |
+ if (!this->setupDstReadIfNecessary(ds, gp, gp->getColor(), gp->getCoverage(), &dstCopy, |
devBounds)) { |
return; |
} |
this->setDrawBuffers(&info, gp->getVertexStride()); |
- this->onDraw(*ds, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); |
+ this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); |
} |
} |
void GrDrawTarget::drawNonIndexed(GrDrawState* ds, |
+ const GrGeometryProcessor* gp, |
GrPrimitiveType type, |
int startVertex, |
int vertexCount, |
const SkRect* devBounds) { |
SkASSERT(ds); |
- if (vertexCount > 0 && this->checkDraw(*ds, type, startVertex, -1, vertexCount, -1)) { |
+ if (vertexCount > 0 && this->checkDraw(*ds, gp, type, startVertex, -1, vertexCount, -1)) { |
// Setup clip |
GrClipMaskManager::ScissorState scissorState; |
@@ -515,15 +517,14 @@ void GrDrawTarget::drawNonIndexed(GrDrawState* ds, |
// TODO: We should continue with incorrect blending. |
GrDeviceCoordTexture dstCopy; |
- const GrGeometryProcessor* gp = ds->getGeometryProcessor(); |
- if (!this->setupDstReadIfNecessary(ds, gp->getColor(), gp->getCoverage(), &dstCopy, |
+ if (!this->setupDstReadIfNecessary(ds, gp, gp->getColor(), gp->getCoverage(), &dstCopy, |
devBounds)) { |
return; |
} |
this->setDrawBuffers(&info, gp->getVertexStride()); |
- this->onDraw(*ds, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); |
+ this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); |
} |
} |
@@ -615,7 +616,7 @@ void GrDrawTarget::drawPath(GrDrawState* ds, |
&stencilSettings); |
GrDeviceCoordTexture dstCopy; |
- if (!this->setupDstReadIfNecessary(ds, color, 0xff, &dstCopy, &devBounds)) { |
+ if (!this->setupDstReadIfNecessary(ds, NULL, color, 0xff, &dstCopy, &devBounds)) { |
return; |
} |
@@ -659,7 +660,7 @@ void GrDrawTarget::drawPaths(GrDrawState* ds, |
// point, because any context that supports NV_path_rendering will also |
// support NV_blend_equation_advanced. |
GrDeviceCoordTexture dstCopy; |
- if (!this->setupDstReadIfNecessary(ds, color, 0xff, &dstCopy, NULL)) { |
+ if (!this->setupDstReadIfNecessary(ds, NULL, color, 0xff, &dstCopy, NULL)) { |
return; |
} |
@@ -733,6 +734,7 @@ void GrDrawTarget::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
//////////////////////////////////////////////////////////////////////////////// |
void GrDrawTarget::drawIndexedInstances(GrDrawState* ds, |
+ const GrGeometryProcessor* gp, |
GrPrimitiveType type, |
int instanceCount, |
int verticesPerInstance, |
@@ -771,8 +773,8 @@ void GrDrawTarget::drawIndexedInstances(GrDrawState* ds, |
// TODO: We should continue with incorrect blending. |
GrDeviceCoordTexture dstCopy; |
- const GrGeometryProcessor* gp = ds->getGeometryProcessor(); |
- if (!this->setupDstReadIfNecessary(ds, gp->getColor(), gp->getCoverage(), &dstCopy,devBounds)) { |
+ if (!this->setupDstReadIfNecessary(ds, gp, gp->getColor(), gp->getCoverage(), |
+ &dstCopy,devBounds)) { |
return; |
} |
@@ -782,13 +784,14 @@ void GrDrawTarget::drawIndexedInstances(GrDrawState* ds, |
info.fIndexCount = info.fInstanceCount * indicesPerInstance; |
if (this->checkDraw(*ds, |
+ gp, |
type, |
info.fStartVertex, |
info.fStartIndex, |
info.fVertexCount, |
info.fIndexCount)) { |
this->setDrawBuffers(&info, gp->getVertexStride()); |
- this->onDraw(*ds, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); |
+ this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); |
} |
info.fStartVertex += info.fVertexCount; |
instanceCount -= info.fInstanceCount; |