aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2014-07-29 13:15:47 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-29 13:15:47 -0700
commitb414f25cf97a690034a180a2c704b4b3935b8ed0 (patch)
tree1dbc2630a301a22d23300893ae9cb6b3acdb753b /src/gpu
parent5ae5fc59b27a48711e514b3ede548b228e393e9b (diff)
Remove support in the gpu to use hardware AA lines. Current code paths could not reach this code and thus was never used.
The blend opt flag kDisableBlend should now be able to be removed, however it is left in this CL and will removed in its own. BUG=skia: R=bsalomon@google.com Author: egdaniel@google.com Review URL: https://codereview.chromium.org/427823002
Diffstat (limited to 'src/gpu')
-rwxr-xr-xsrc/gpu/GrContext.cpp4
-rw-r--r--src/gpu/GrDrawTarget.cpp13
-rw-r--r--src/gpu/GrDrawTarget.h6
-rw-r--r--src/gpu/gl/GrGpuGL.cpp107
-rw-r--r--src/gpu/gl/GrGpuGL.h10
5 files changed, 34 insertions, 106 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 55a9ccf2a8..95e0d51cf8 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -751,10 +751,6 @@ static bool apply_aa_to_rect(GrDrawTarget* target,
return false;
}
- if (0 == strokeWidth && target->willUseHWAALines()) {
- return false;
- }
-
#if defined(SHADER_AA_FILL_RECT) || !defined(IGNORE_ROT_AA_RECT_OPT)
if (strokeWidth >= 0) {
#endif
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 72204fa14b..28369fde88 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -613,19 +613,6 @@ void GrDrawTarget::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
////////////////////////////////////////////////////////////////////////////////
-bool GrDrawTarget::willUseHWAALines() const {
- // There is a conflict between using smooth lines and our use of premultiplied alpha. Smooth
- // lines tweak the incoming alpha value but not in a premul-alpha way. So we only use them when
- // our alpha is 0xff and tweaking the color for partial coverage is OK
- if (!this->caps()->hwAALineSupport() ||
- !this->getDrawState().isHWAntialiasState()) {
- return false;
- }
- GrDrawState::BlendOptFlags opts = this->getDrawState().getBlendOpts();
- return (GrDrawState::kDisableBlend_BlendOptFlag & opts) &&
- (GrDrawState::kCoverageAsAlpha_BlendOptFlag & opts);
-}
-
bool GrDrawTarget::canApplyCoverage() const {
// we can correctly apply coverage if a) we have dual source blending
// or b) one of our blend optimizations applies.
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index c868e56aa7..0c03e34041 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -113,12 +113,6 @@ public:
}
/**
- * Given the current draw state and hw support, will HW AA lines be used (if
- * a line primitive type is drawn)?
- */
- bool willUseHWAALines() const;
-
- /**
* There are three types of "sources" of geometry (vertices and indices) for
* draw calls made on the target. When performing an indexed draw, the
* indices and vertices can use different source types. Once a source is
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index a0e08e5a00..f079abce49 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -280,8 +280,8 @@ void GrGpuGL::onResetContext(uint32_t resetBits) {
GL_CALL(LineWidth(1));
}
- if (resetBits & kAA_GrGLBackendState) {
- fHWAAState.invalidate();
+ if (resetBits & kMSAAEnable_GrGLBackendState) {
+ fMSAAEnabled = kUnknown_TriState;
}
fHWActiveTextureUnitIdx = -1; // invalid
@@ -2164,45 +2164,20 @@ void GrGpuGL::flushAAState(DrawType type) {
const GrRenderTarget* rt = this->getDrawState().getRenderTarget();
if (kGL_GrGLStandard == this->glStandard()) {
- // ES doesn't support toggling GL_MULTISAMPLE and doesn't have
- // smooth lines.
- // we prefer smooth lines over multisampled lines
- bool smoothLines = false;
-
- if (kDrawLines_DrawType == type) {
- smoothLines = this->willUseHWAALines();
- if (smoothLines) {
- if (kYes_TriState != fHWAAState.fSmoothLineEnabled) {
- GL_CALL(Enable(GR_GL_LINE_SMOOTH));
- fHWAAState.fSmoothLineEnabled = kYes_TriState;
- // must disable msaa to use line smoothing
- if (RT_HAS_MSAA &&
- kNo_TriState != fHWAAState.fMSAAEnabled) {
- GL_CALL(Disable(GR_GL_MULTISAMPLE));
- fHWAAState.fMSAAEnabled = kNo_TriState;
- }
- }
- } else {
- if (kNo_TriState != fHWAAState.fSmoothLineEnabled) {
- GL_CALL(Disable(GR_GL_LINE_SMOOTH));
- fHWAAState.fSmoothLineEnabled = kNo_TriState;
- }
- }
- }
- if (!smoothLines && RT_HAS_MSAA) {
+ 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();
if (enableMSAA) {
- if (kYes_TriState != fHWAAState.fMSAAEnabled) {
+ if (kYes_TriState != fMSAAEnabled) {
GL_CALL(Enable(GR_GL_MULTISAMPLE));
- fHWAAState.fMSAAEnabled = kYes_TriState;
+ fMSAAEnabled = kYes_TriState;
}
} else {
- if (kNo_TriState != fHWAAState.fMSAAEnabled) {
+ if (kNo_TriState != fMSAAEnabled) {
GL_CALL(Disable(GR_GL_MULTISAMPLE));
- fHWAAState.fMSAAEnabled = kNo_TriState;
+ fMSAAEnabled = kNo_TriState;
}
}
}
@@ -2228,52 +2203,36 @@ void GrGpuGL::flushPathStencilSettings(SkPath::FillType fill) {
void GrGpuGL::flushBlend(bool isLines,
GrBlendCoeff srcCoeff,
GrBlendCoeff dstCoeff) {
- if (isLines && this->willUseHWAALines()) {
+ // 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;
+ if (blendOff) {
+ if (kNo_TriState != fHWBlendState.fEnabled) {
+ GL_CALL(Disable(GR_GL_BLEND));
+ fHWBlendState.fEnabled = kNo_TriState;
+ }
+ } else {
if (kYes_TriState != fHWBlendState.fEnabled) {
GL_CALL(Enable(GR_GL_BLEND));
fHWBlendState.fEnabled = kYes_TriState;
}
- if (kSA_GrBlendCoeff != fHWBlendState.fSrcCoeff ||
- kISA_GrBlendCoeff != fHWBlendState.fDstCoeff) {
- GL_CALL(BlendFunc(gXfermodeCoeff2Blend[kSA_GrBlendCoeff],
- gXfermodeCoeff2Blend[kISA_GrBlendCoeff]));
- fHWBlendState.fSrcCoeff = kSA_GrBlendCoeff;
- fHWBlendState.fDstCoeff = kISA_GrBlendCoeff;
- }
- } else {
- // 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;
- if (blendOff) {
- if (kNo_TriState != fHWBlendState.fEnabled) {
- GL_CALL(Disable(GR_GL_BLEND));
- fHWBlendState.fEnabled = kNo_TriState;
- }
- } else {
- if (kYes_TriState != fHWBlendState.fEnabled) {
- GL_CALL(Enable(GR_GL_BLEND));
- fHWBlendState.fEnabled = kYes_TriState;
- }
- if (fHWBlendState.fSrcCoeff != srcCoeff ||
- fHWBlendState.fDstCoeff != dstCoeff) {
- GL_CALL(BlendFunc(gXfermodeCoeff2Blend[srcCoeff],
- gXfermodeCoeff2Blend[dstCoeff]));
- fHWBlendState.fSrcCoeff = srcCoeff;
- fHWBlendState.fDstCoeff = dstCoeff;
- }
- GrColor blendConst = this->getDrawState().getBlendConstant();
- if ((BlendCoeffReferencesConstant(srcCoeff) ||
- BlendCoeffReferencesConstant(dstCoeff)) &&
- (!fHWBlendState.fConstColorValid ||
- fHWBlendState.fConstColor != blendConst)) {
- GrGLfloat c[4];
- GrColorToRGBAFloat(blendConst, c);
- GL_CALL(BlendColor(c[0], c[1], c[2], c[3]));
- fHWBlendState.fConstColor = blendConst;
- fHWBlendState.fConstColorValid = true;
- }
+ if (fHWBlendState.fSrcCoeff != srcCoeff ||
+ fHWBlendState.fDstCoeff != dstCoeff) {
+ GL_CALL(BlendFunc(gXfermodeCoeff2Blend[srcCoeff],
+ gXfermodeCoeff2Blend[dstCoeff]));
+ fHWBlendState.fSrcCoeff = srcCoeff;
+ fHWBlendState.fDstCoeff = dstCoeff;
+ }
+ GrColor blendConst = this->getDrawState().getBlendConstant();
+ if ((BlendCoeffReferencesConstant(srcCoeff) ||
+ BlendCoeffReferencesConstant(dstCoeff)) &&
+ (!fHWBlendState.fConstColorValid ||
+ fHWBlendState.fConstColor != blendConst)) {
+ GrGLfloat c[4];
+ GrColorToRGBAFloat(blendConst, c);
+ GL_CALL(BlendColor(c[0], c[1], c[2], c[3]));
+ fHWBlendState.fConstColor = blendConst;
+ fHWBlendState.fConstColorValid = true;
}
}
}
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h
index a8a9727b32..e67197219d 100644
--- a/src/gpu/gl/GrGpuGL.h
+++ b/src/gpu/gl/GrGpuGL.h
@@ -443,15 +443,7 @@ private:
}
} fHWBlendState;
- struct {
- TriState fMSAAEnabled;
- TriState fSmoothLineEnabled;
- void invalidate() {
- fMSAAEnabled = kUnknown_TriState;
- fSmoothLineEnabled = kUnknown_TriState;
- }
- } fHWAAState;
-
+ TriState fMSAAEnabled;
GrGLProgram::MatrixState fHWProjectionMatrixState;