diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-04 19:31:00 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-04 19:31:00 +0000 |
commit | c96cb3a929f954cd2e7b6319efdfa6b758b20bd3 (patch) | |
tree | 26bc8ac8b128f3f56568c2589528c197eac5dbbb | |
parent | 7b6c19392cd980462908764b5ea17c4796610427 (diff) |
Break up GrGpuGL::flushGLCommonState
Review URL: http://codereview.appspot.com/6270049/
git-svn-id: http://skia.googlecode.com/svn/trunk@4144 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/gpu/gl/GrGpuGL.cpp | 32 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL.h | 12 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL_program.cpp | 20 |
3 files changed, 25 insertions, 39 deletions
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 42043f9f6e..379d40dff8 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -2182,16 +2182,11 @@ void GrGpuGL::flushBoundTextureAndParams(int stage) { this->getResetTimestamp()); } -bool GrGpuGL::flushGLStateCommon(GrPrimitiveType type) { +void GrGpuGL::flushMiscFixedFunctionState() { - GrDrawState* drawState = this->drawState(); - // GrGpu::setupClipAndFlushState should have already checked this - // and bailed if not true. - GrAssert(NULL != drawState->getRenderTarget()); - - this->flushAAState(type); + const GrDrawState& drawState = this->getDrawState(); - if (drawState->isDitherState()) { + if (drawState.isDitherState()) { if (kYes_TriState != fHWDitherEnabled) { GL_CALL(Enable(GR_GL_DITHER)); fHWDitherEnabled = kYes_TriState; @@ -2203,7 +2198,7 @@ bool GrGpuGL::flushGLStateCommon(GrPrimitiveType type) { } } - if (drawState->isColorWriteDisabled()) { + if (drawState.isColorWriteDisabled()) { if (kNo_TriState != fHWWriteToColor) { GL_CALL(ColorMask(GR_GL_FALSE, GR_GL_FALSE, GR_GL_FALSE, GR_GL_FALSE)); @@ -2216,7 +2211,7 @@ bool GrGpuGL::flushGLStateCommon(GrPrimitiveType type) { } } - if (fHWDrawFace != drawState->getDrawFace()) { + if (fHWDrawFace != drawState.getDrawFace()) { switch (this->getDrawState().getDrawFace()) { case GrDrawState::kCCW_DrawFace: GL_CALL(Enable(GR_GL_CULL_FACE)); @@ -2232,23 +2227,8 @@ bool GrGpuGL::flushGLStateCommon(GrPrimitiveType type) { default: GrCrash("Unknown draw face."); } - fHWDrawFace = drawState->getDrawFace(); + fHWDrawFace = drawState.getDrawFace(); } - -#if GR_DEBUG - // check for circular rendering - for (int s = 0; s < GrDrawState::kNumStages; ++s) { - GrAssert(!this->isStageEnabled(s) || - NULL == drawState->getRenderTarget() || - NULL == drawState->getTexture(s) || - drawState->getTexture(s)->asRenderTarget() != - drawState->getRenderTarget()); - } -#endif - - this->flushStencil(); - - return true; } void GrGpuGL::notifyVertexBufferBind(const GrGLVertexBuffer* buffer) { diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h index b5dd09ab51..3fab9eea53 100644 --- a/src/gpu/gl/GrGpuGL.h +++ b/src/gpu/gl/GrGpuGL.h @@ -156,15 +156,6 @@ protected: int* extraVertexOffset, int* extraIndexOffset); - // flushes state that is common to fixed and programmable GL - // dither - // line smoothing - // texture binding - // sampler state (filtering, tiling) - // FBO binding - // line width - bool flushGLStateCommon(GrPrimitiveType type); - // Subclasses should call this to flush the blend state. // The params should be the final coeffecients to apply // (after any blending optimizations or dual source blending considerations @@ -265,6 +256,9 @@ private: // flushes the color matrix void flushColorMatrix(); + // flushes dithering, color-mask, and face culling stat + void flushMiscFixedFunctionState(); + static void DeleteProgram(const GrGLInterface* gl, CachedData* programData); diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp index 1f3216f3ef..c230d40118 100644 --- a/src/gpu/gl/GrGpuGL_program.cpp +++ b/src/gpu/gl/GrGpuGL_program.cpp @@ -389,12 +389,15 @@ void GrGpuGL::flushCoverage(GrColor coverage) { } bool GrGpuGL::flushGraphicsState(GrPrimitiveType type) { - if (!flushGLStateCommon(type)) { - return false; - } - const GrDrawState& drawState = this->getDrawState(); + // GrGpu::setupClipAndFlushState should have already checked this + // and bailed if not true. + GrAssert(NULL != drawState.getRenderTarget()); + + this->flushStencil(); + this->flushAAState(type); + GrBlendCoeff srcCoeff; GrBlendCoeff dstCoeff; BlendOptFlags blendOpts = this->getBlendOpts(false, &srcCoeff, &dstCoeff); @@ -438,6 +441,15 @@ bool GrGpuGL::flushGraphicsState(GrPrimitiveType type) { for (int s = 0; s < GrDrawState::kNumStages; ++s) { if (this->isStageEnabled(s)) { + +#if GR_DEBUG + // check for circular rendering + GrAssert(NULL == drawState.getRenderTarget() || + NULL == drawState.getTexture(s) || + drawState.getTexture(s)->asRenderTarget() != + drawState.getRenderTarget()); +#endif + this->flushBoundTextureAndParams(s); this->flushTextureMatrixAndDomain(s); |