| Index: src/gpu/gl/GrGpuGL_program.cpp
|
| diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
|
| index 476f174cdc8e542ccfa579b153b450d826138143..be21abf3e9817a14a5722ac3dc62a7c91e7e36f0 100644
|
| --- a/src/gpu/gl/GrGpuGL_program.cpp
|
| +++ b/src/gpu/gl/GrGpuGL_program.cpp
|
| @@ -9,9 +9,8 @@
|
|
|
| #include "GrEffect.h"
|
| #include "GrGLEffect.h"
|
| +#include "SkRTConf.h"
|
| #include "GrGLPathRendering.h"
|
| -#include "GrOptDrawState.h"
|
| -#include "SkRTConf.h"
|
| #include "SkTSearch.h"
|
|
|
| #ifdef PROGRAM_CACHE_STATS
|
| @@ -205,25 +204,23 @@
|
| #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
|
|
|
| bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstCopy) {
|
| - SkAutoTUnref<GrOptDrawState> optState(this->getDrawState().createOptState());
|
| + const GrDrawState& drawState = this->getDrawState();
|
|
|
| // GrGpu::setupClipAndFlushState should have already checked this and bailed if not true.
|
| - SkASSERT(optState->getRenderTarget());
|
| + SkASSERT(drawState.getRenderTarget());
|
|
|
| if (kStencilPath_DrawType == type) {
|
| - const GrRenderTarget* rt = optState->getRenderTarget();
|
| + const GrRenderTarget* rt = this->getDrawState().getRenderTarget();
|
| SkISize size;
|
| size.set(rt->width(), rt->height());
|
| - this->glPathRendering()->setProjectionMatrix(optState->getViewMatrix(), size, rt->origin());
|
| + this->glPathRendering()->setProjectionMatrix(drawState.getViewMatrix(), size, rt->origin());
|
| } else {
|
| this->flushMiscFixedFunctionState();
|
|
|
| - GrBlendCoeff srcCoeff = optState->getSrcBlendCoeff();
|
| - GrBlendCoeff dstCoeff = optState->getDstBlendCoeff();
|
| -
|
| - // In these blend coeff's we end up drawing nothing so we can skip draw all together
|
| - if (kZero_GrBlendCoeff == srcCoeff && kOne_GrBlendCoeff == dstCoeff &&
|
| - !optState->getStencil().doesWrite()) {
|
| + GrBlendCoeff srcCoeff;
|
| + GrBlendCoeff dstCoeff;
|
| + GrDrawState::BlendOptFlags blendOpts = drawState.getBlendOpts(false, &srcCoeff, &dstCoeff);
|
| + if (GrDrawState::kSkipDraw_BlendOptFlag & blendOpts) {
|
| return false;
|
| }
|
|
|
| @@ -231,8 +228,9 @@
|
| SkSTArray<8, const GrEffectStage*, true> colorStages;
|
| SkSTArray<8, const GrEffectStage*, true> coverageStages;
|
| GrGLProgramDesc desc;
|
| - if (!GrGLProgramDesc::Build(*optState.get(),
|
| + if (!GrGLProgramDesc::Build(this->getDrawState(),
|
| type,
|
| + blendOpts,
|
| srcCoeff,
|
| dstCoeff,
|
| this,
|
| @@ -265,8 +263,8 @@
|
| fCurrentProgram->overrideBlend(&srcCoeff, &dstCoeff);
|
| this->flushBlend(kDrawLines_DrawType == type, srcCoeff, dstCoeff);
|
|
|
| - fCurrentProgram->setData(*optState.get(),
|
| - type,
|
| + fCurrentProgram->setData(type,
|
| + blendOpts,
|
| geometryProcessor,
|
| colorStages.begin(),
|
| coverageStages.begin(),
|
| @@ -274,15 +272,15 @@
|
| &fSharedGLProgramState);
|
| }
|
|
|
| - GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState->getRenderTarget());
|
| + GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(drawState.getRenderTarget());
|
| this->flushStencil(type);
|
| this->flushScissor(glRT->getViewport(), glRT->origin());
|
| this->flushAAState(type);
|
|
|
| SkIRect* devRect = NULL;
|
| SkIRect devClipBounds;
|
| - if (optState->isClipState()) {
|
| - this->getClip()->getConservativeBounds(optState->getRenderTarget(), &devClipBounds);
|
| + if (drawState.isClipState()) {
|
| + this->getClip()->getConservativeBounds(drawState.getRenderTarget(), &devClipBounds);
|
| devRect = &devClipBounds;
|
| }
|
| // This must come after textures are flushed because a texture may need
|
| @@ -293,9 +291,8 @@
|
| }
|
|
|
| void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) {
|
| - SkAutoTUnref<GrOptDrawState> optState(this->getDrawState().createOptState());
|
| -
|
| - GrGLsizei stride = static_cast<GrGLsizei>(optState->getVertexStride());
|
| +
|
| + GrGLsizei stride = static_cast<GrGLsizei>(this->getDrawState().getVertexStride());
|
|
|
| size_t vertexOffsetInBytes = stride * info.startVertex();
|
|
|
| @@ -349,12 +346,16 @@
|
| fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf);
|
|
|
| if (fCurrentProgram->hasVertexShader()) {
|
| - int vertexAttribCount = optState->getVertexAttribCount();
|
| + int vertexAttribCount = this->getDrawState().getVertexAttribCount();
|
| uint32_t usedAttribArraysMask = 0;
|
| - const GrVertexAttrib* vertexAttrib = optState->getVertexAttribs();
|
| + const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttribs();
|
| +
|
| + bool canIgnoreColorAttrib = this->getDrawState().canIgnoreColorAttribute();
|
|
|
| for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount;
|
| ++vertexAttribIndex, ++vertexAttrib) {
|
| +
|
| + if (kColor_GrVertexAttribBinding != vertexAttrib->fBinding || !canIgnoreColorAttrib) {
|
| usedAttribArraysMask |= (1 << vertexAttribIndex);
|
| GrVertexAttribType attribType = vertexAttrib->fType;
|
| attribState->set(this,
|
| @@ -366,6 +367,7 @@
|
| stride,
|
| reinterpret_cast<GrGLvoid*>(
|
| vertexOffsetInBytes + vertexAttrib->fOffset));
|
| + }
|
| }
|
| attribState->disableUnusedArrays(this, usedAttribArraysMask);
|
| }
|
|
|