Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Unified Diff: src/gpu/gl/GrGpuGL.cpp

Issue 787233003: Add XP to handle the cases where we disable color write. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL.cpp
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 5987c7000f6e7a216d3f09afee549830da463a89..5460a0194599594f8f0cf23114ef3e0948584999 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -1344,8 +1344,11 @@ void GrGLGpu::flushScissor(const GrScissorState& scissorState,
}
bool GrGLGpu::flushGLState(const GrOptDrawState& optState) {
+ GrXferProcessor::BlendInfo blendInfo;
+ optState.getXferProcessor()->getBlendInfo(&blendInfo);
+
this->flushDither(optState.isDitherState());
- this->flushColorWriteDisable(optState.isColorWriteDisabled());
+ this->flushColorWrite(blendInfo.fWriteColor);
this->flushDrawFace(optState.getDrawFace());
fCurrentProgram.reset(fProgramCache->getProgram(optState));
@@ -1362,7 +1365,9 @@ bool GrGLGpu::flushGLState(const GrOptDrawState& optState) {
fHWProgramID = programID;
}
- this->flushBlend(optState);
+ if (blendInfo.fWriteColor) {
+ this->flushBlend(blendInfo);
+ }
fCurrentProgram->setData(optState);
@@ -1864,7 +1869,7 @@ void GrGLGpu::onDraw(const GrOptDrawState& ds, const GrDrawTarget::DrawInfo& inf
}
void GrGLGpu::onStencilPath(const GrPath* path, const StencilPathState& state) {
- this->flushColorWriteDisable(true);
+ this->flushColorWrite(false);
this->flushDrawFace(GrDrawState::kBoth_DrawFace);
GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(state.fRenderTarget);
@@ -2055,12 +2060,10 @@ void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA, bool isLineDraw)
}
}
-void GrGLGpu::flushBlend(const GrOptDrawState& optState) {
+void GrGLGpu::flushBlend(const GrXferProcessor::BlendInfo& blendInfo) {
// Any optimization to disable blending should have already been applied and
// tweaked the coeffs to (1, 0).
- GrXferProcessor::BlendInfo blendInfo;
- optState.getXferProcessor()->getBlendInfo(&blendInfo);
GrBlendCoeff srcCoeff = blendInfo.fSrcBlend;
GrBlendCoeff dstCoeff = blendInfo.fDstBlend;
bool blendOff = kOne_GrBlendCoeff == srcCoeff && kZero_GrBlendCoeff == dstCoeff;
@@ -2222,8 +2225,8 @@ void GrGLGpu::flushDither(bool dither) {
}
}
-void GrGLGpu::flushColorWriteDisable(bool disableColorWrites) {
- if (disableColorWrites) {
+void GrGLGpu::flushColorWrite(bool writeColor) {
+ if (!writeColor) {
if (kNo_TriState != fHWWriteToColor) {
GL_CALL(ColorMask(GR_GL_FALSE, GR_GL_FALSE,
GR_GL_FALSE, GR_GL_FALSE));
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698