aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2014-09-24 10:30:12 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-24 10:30:13 -0700
commitd632ea4b9eec5be3f83a9fa4982a30202e1239a7 (patch)
tree3439f8dd1d58997be6918eb9cf4c31f7e6e7f7b2
parenteee606c7bf6b343429dcdbf56b6b71bd83575060 (diff)
Use OptDrawState instead of DrawState when flushing state in GrGpuGL
BUG=skia: R=bsalomon@google.com, joshualitt@google.com Author: egdaniel@google.com Review URL: https://codereview.chromium.org/599963002
-rw-r--r--src/gpu/gl/GrGpuGL.cpp28
-rw-r--r--src/gpu/gl/GrGpuGL.h7
-rw-r--r--src/gpu/gl/GrGpuGL_program.cpp6
3 files changed, 19 insertions, 22 deletions
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index ebc34572fe..a01f7b74ff 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -1931,7 +1931,7 @@ void GrGpuGL::flushStencil(DrawType type) {
}
}
-void GrGpuGL::flushAAState(DrawType type) {
+void GrGpuGL::flushAAState(const GrOptDrawState& optState, DrawType type) {
// At least some ATI linux drivers will render GL_LINES incorrectly when MSAA state is enabled but
// the target is not multisampled. Single pixel wide lines are rendered thicker than 1 pixel wide.
#if 0
@@ -1941,13 +1941,13 @@ void GrGpuGL::flushAAState(DrawType type) {
#define RT_HAS_MSAA (rt->isMultisampled() || kDrawLines_DrawType == type)
#endif
- const GrRenderTarget* rt = this->getDrawState().getRenderTarget();
+ const GrRenderTarget* rt = optState.getRenderTarget();
if (kGL_GrGLStandard == this->glStandard()) {
if (RT_HAS_MSAA) {
// FIXME: GL_NV_pr doesn't seem to like MSAA disabled. The paths
// convex hulls of each segment appear to get filled.
bool enableMSAA = kStencilPath_DrawType == type ||
- this->getDrawState().isHWAntialiasState();
+ optState.isHWAntialiasState();
if (enableMSAA) {
if (kYes_TriState != fMSAAEnabled) {
GL_CALL(Enable(GR_GL_MULTISAMPLE));
@@ -1963,9 +1963,8 @@ void GrGpuGL::flushAAState(DrawType type) {
}
}
-void GrGpuGL::flushBlend(bool isLines,
- GrBlendCoeff srcCoeff,
- GrBlendCoeff dstCoeff) {
+void GrGpuGL::flushBlend(const GrOptDrawState& optState, bool isLines,
+ GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff) {
// Any optimization to disable blending should have already been applied and
// tweaked the coeffs to (1, 0).
bool blendOff = kOne_GrBlendCoeff == srcCoeff && kZero_GrBlendCoeff == dstCoeff;
@@ -1986,7 +1985,7 @@ void GrGpuGL::flushBlend(bool isLines,
fHWBlendState.fSrcCoeff = srcCoeff;
fHWBlendState.fDstCoeff = dstCoeff;
}
- GrColor blendConst = this->getDrawState().getBlendConstant();
+ GrColor blendConst = optState.getBlendConstant();
if ((BlendCoeffReferencesConstant(srcCoeff) ||
BlendCoeffReferencesConstant(dstCoeff)) &&
(!fHWBlendState.fConstColorValid ||
@@ -2109,11 +2108,8 @@ void GrGpuGL::bindTexture(int unitIdx, const GrTextureParams& params, GrGLTextur
texture->setCachedTexParams(newTexParams, this->getResetTimestamp());
}
-void GrGpuGL::flushMiscFixedFunctionState() {
-
- const GrDrawState& drawState = this->getDrawState();
-
- if (drawState.isDitherState()) {
+void GrGpuGL::flushMiscFixedFunctionState(const GrOptDrawState& optState) {
+ if (optState.isDitherState()) {
if (kYes_TriState != fHWDitherEnabled) {
GL_CALL(Enable(GR_GL_DITHER));
fHWDitherEnabled = kYes_TriState;
@@ -2125,7 +2121,7 @@ void GrGpuGL::flushMiscFixedFunctionState() {
}
}
- if (drawState.isColorWriteDisabled()) {
+ if (optState.isColorWriteDisabled()) {
if (kNo_TriState != fHWWriteToColor) {
GL_CALL(ColorMask(GR_GL_FALSE, GR_GL_FALSE,
GR_GL_FALSE, GR_GL_FALSE));
@@ -2138,8 +2134,8 @@ void GrGpuGL::flushMiscFixedFunctionState() {
}
}
- if (fHWDrawFace != drawState.getDrawFace()) {
- switch (this->getDrawState().getDrawFace()) {
+ if (fHWDrawFace != optState.getDrawFace()) {
+ switch (optState.getDrawFace()) {
case GrDrawState::kCCW_DrawFace:
GL_CALL(Enable(GR_GL_CULL_FACE));
GL_CALL(CullFace(GR_GL_BACK));
@@ -2154,7 +2150,7 @@ void GrGpuGL::flushMiscFixedFunctionState() {
default:
SkFAIL("Unknown draw face.");
}
- fHWDrawFace = drawState.getDrawFace();
+ fHWDrawFace = optState.getDrawFace();
}
}
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h
index 9dccd1828b..65816b54a8 100644
--- a/src/gpu/gl/GrGpuGL.h
+++ b/src/gpu/gl/GrGpuGL.h
@@ -166,7 +166,8 @@ private:
// The params should be the final coefficients to apply
// (after any blending optimizations or dual source blending considerations
// have been accounted for).
- void flushBlend(bool isLines, GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff);
+ void flushBlend(const GrOptDrawState& optState, bool isLines,
+ GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff);
bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ext); }
@@ -216,7 +217,7 @@ private:
};
// flushes dithering, color-mask, and face culling stat
- void flushMiscFixedFunctionState();
+ void flushMiscFixedFunctionState(const GrOptDrawState&);
// flushes the scissor. see the note on flushBoundTextureAndParams about
// flushing the scissor after that function is called.
@@ -236,7 +237,7 @@ private:
void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds);
void flushStencil(DrawType);
- void flushAAState(DrawType);
+ void flushAAState(const GrOptDrawState&, DrawType);
bool configToGLFormats(GrPixelConfig config,
bool getSizedInternal,
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index 91a39f00dd..2e6bfc4f92 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -216,7 +216,7 @@ bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
size.set(rt->width(), rt->height());
this->glPathRendering()->setProjectionMatrix(optState->getViewMatrix(), size, rt->origin());
} else {
- this->flushMiscFixedFunctionState();
+ this->flushMiscFixedFunctionState(*optState.get());
GrBlendCoeff srcCoeff = optState->getSrcBlendCoeff();
GrBlendCoeff dstCoeff = optState->getDstBlendCoeff();
@@ -262,7 +262,7 @@ bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
fHWProgramID = programID;
}
- this->flushBlend(kDrawLines_DrawType == type, srcCoeff, dstCoeff);
+ this->flushBlend(*optState.get(), kDrawLines_DrawType == type, srcCoeff, dstCoeff);
fCurrentProgram->setData(*optState.get(),
type,
@@ -276,7 +276,7 @@ bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState->getRenderTarget());
this->flushStencil(type);
this->flushScissor(glRT->getViewport(), glRT->origin());
- this->flushAAState(type);
+ this->flushAAState(*optState.get(), type);
SkIRect* devRect = NULL;
SkIRect devClipBounds;