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
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index 1f3216f..c230d40 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -389,12 +389,15 @@
}
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 @@
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);