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

Side by Side Diff: src/gpu/gl/GrGpuGL.cpp

Issue 423943003: Remove gpu support for willUseHWAALines. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 months 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "GrGpuGL.h" 9 #include "GrGpuGL.h"
10 #include "GrGLNameAllocator.h" 10 #include "GrGLNameAllocator.h"
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 // the target is not multisampled. Single pixel wide lines are rendered thicker than 1 pixel wide. 2157 // the target is not multisampled. Single pixel wide lines are rendered thicker than 1 pixel wide.
2158 #if 0 2158 #if 0
2159 // Replace RT_HAS_MSAA with this definition once this driver bug is no longe r a relevant concern 2159 // Replace RT_HAS_MSAA with this definition once this driver bug is no longe r a relevant concern
2160 #define RT_HAS_MSAA rt->isMultisampled() 2160 #define RT_HAS_MSAA rt->isMultisampled()
2161 #else 2161 #else
2162 #define RT_HAS_MSAA (rt->isMultisampled() || kDrawLines_DrawType == type) 2162 #define RT_HAS_MSAA (rt->isMultisampled() || kDrawLines_DrawType == type)
2163 #endif 2163 #endif
2164 2164
2165 const GrRenderTarget* rt = this->getDrawState().getRenderTarget(); 2165 const GrRenderTarget* rt = this->getDrawState().getRenderTarget();
2166 if (kGL_GrGLStandard == this->glStandard()) { 2166 if (kGL_GrGLStandard == this->glStandard()) {
2167 // ES doesn't support toggling GL_MULTISAMPLE and doesn't have
2168 // smooth lines.
2169 // we prefer smooth lines over multisampled lines
2170 bool smoothLines = false;
2171
2172 if (kDrawLines_DrawType == type) { 2167 if (kDrawLines_DrawType == type) {
2173 smoothLines = this->willUseHWAALines(); 2168 if (kNo_TriState != fHWAAState.fSmoothLineEnabled) {
2174 if (smoothLines) { 2169 GL_CALL(Disable(GR_GL_LINE_SMOOTH));
bsalomon 2014/07/28 19:46:05 We already disable this in onResetContext. Let's g
2175 if (kYes_TriState != fHWAAState.fSmoothLineEnabled) { 2170 fHWAAState.fSmoothLineEnabled = kNo_TriState;
2176 GL_CALL(Enable(GR_GL_LINE_SMOOTH));
2177 fHWAAState.fSmoothLineEnabled = kYes_TriState;
2178 // must disable msaa to use line smoothing
2179 if (RT_HAS_MSAA &&
2180 kNo_TriState != fHWAAState.fMSAAEnabled) {
2181 GL_CALL(Disable(GR_GL_MULTISAMPLE));
2182 fHWAAState.fMSAAEnabled = kNo_TriState;
2183 }
2184 }
2185 } else {
2186 if (kNo_TriState != fHWAAState.fSmoothLineEnabled) {
2187 GL_CALL(Disable(GR_GL_LINE_SMOOTH));
2188 fHWAAState.fSmoothLineEnabled = kNo_TriState;
2189 }
2190 } 2171 }
2191 } 2172 }
2192 if (!smoothLines && RT_HAS_MSAA) { 2173 if (RT_HAS_MSAA) {
2193 // FIXME: GL_NV_pr doesn't seem to like MSAA disabled. The paths 2174 // FIXME: GL_NV_pr doesn't seem to like MSAA disabled. The paths
2194 // convex hulls of each segment appear to get filled. 2175 // convex hulls of each segment appear to get filled.
2195 bool enableMSAA = kStencilPath_DrawType == type || 2176 bool enableMSAA = kStencilPath_DrawType == type ||
2196 this->getDrawState().isHWAntialiasState(); 2177 this->getDrawState().isHWAntialiasState();
2197 if (enableMSAA) { 2178 if (enableMSAA) {
2198 if (kYes_TriState != fHWAAState.fMSAAEnabled) { 2179 if (kYes_TriState != fHWAAState.fMSAAEnabled) {
2199 GL_CALL(Enable(GR_GL_MULTISAMPLE)); 2180 GL_CALL(Enable(GR_GL_MULTISAMPLE));
2200 fHWAAState.fMSAAEnabled = kYes_TriState; 2181 fHWAAState.fMSAAEnabled = kYes_TriState;
2201 } 2182 }
2202 } else { 2183 } else {
(...skipping 18 matching lines...) Expand all
2221 pathStencilSettings.funcRef(GrStencilSettings::k Front_Face), 2202 pathStencilSettings.funcRef(GrStencilSettings::k Front_Face),
2222 pathStencilSettings.funcMask(GrStencilSettings:: kFront_Face))); 2203 pathStencilSettings.funcMask(GrStencilSettings:: kFront_Face)));
2223 2204
2224 fHWPathStencilSettings = pathStencilSettings; 2205 fHWPathStencilSettings = pathStencilSettings;
2225 } 2206 }
2226 } 2207 }
2227 2208
2228 void GrGpuGL::flushBlend(bool isLines, 2209 void GrGpuGL::flushBlend(bool isLines,
2229 GrBlendCoeff srcCoeff, 2210 GrBlendCoeff srcCoeff,
2230 GrBlendCoeff dstCoeff) { 2211 GrBlendCoeff dstCoeff) {
2231 if (isLines && this->willUseHWAALines()) { 2212 // any optimization to disable blending should
2213 // have already been applied and tweaked the coeffs
2214 // to (1, 0).
2215 bool blendOff = kOne_GrBlendCoeff == srcCoeff &&
2216 kZero_GrBlendCoeff == dstCoeff;
2217 if (blendOff) {
2218 if (kNo_TriState != fHWBlendState.fEnabled) {
2219 GL_CALL(Disable(GR_GL_BLEND));
2220 fHWBlendState.fEnabled = kNo_TriState;
2221 }
2222 } else {
2232 if (kYes_TriState != fHWBlendState.fEnabled) { 2223 if (kYes_TriState != fHWBlendState.fEnabled) {
2233 GL_CALL(Enable(GR_GL_BLEND)); 2224 GL_CALL(Enable(GR_GL_BLEND));
2234 fHWBlendState.fEnabled = kYes_TriState; 2225 fHWBlendState.fEnabled = kYes_TriState;
2235 } 2226 }
2236 if (kSA_GrBlendCoeff != fHWBlendState.fSrcCoeff || 2227 if (fHWBlendState.fSrcCoeff != srcCoeff ||
2237 kISA_GrBlendCoeff != fHWBlendState.fDstCoeff) { 2228 fHWBlendState.fDstCoeff != dstCoeff) {
2238 GL_CALL(BlendFunc(gXfermodeCoeff2Blend[kSA_GrBlendCoeff], 2229 GL_CALL(BlendFunc(gXfermodeCoeff2Blend[srcCoeff],
2239 gXfermodeCoeff2Blend[kISA_GrBlendCoeff])); 2230 gXfermodeCoeff2Blend[dstCoeff]));
2240 fHWBlendState.fSrcCoeff = kSA_GrBlendCoeff; 2231 fHWBlendState.fSrcCoeff = srcCoeff;
2241 fHWBlendState.fDstCoeff = kISA_GrBlendCoeff; 2232 fHWBlendState.fDstCoeff = dstCoeff;
2242 } 2233 }
2243 } else { 2234 GrColor blendConst = this->getDrawState().getBlendConstant();
2244 // any optimization to disable blending should 2235 if ((BlendCoeffReferencesConstant(srcCoeff) ||
2245 // have already been applied and tweaked the coeffs 2236 BlendCoeffReferencesConstant(dstCoeff)) &&
2246 // to (1, 0). 2237 (!fHWBlendState.fConstColorValid ||
2247 bool blendOff = kOne_GrBlendCoeff == srcCoeff && 2238 fHWBlendState.fConstColor != blendConst)) {
2248 kZero_GrBlendCoeff == dstCoeff; 2239 GrGLfloat c[4];
2249 if (blendOff) { 2240 GrColorToRGBAFloat(blendConst, c);
2250 if (kNo_TriState != fHWBlendState.fEnabled) { 2241 GL_CALL(BlendColor(c[0], c[1], c[2], c[3]));
2251 GL_CALL(Disable(GR_GL_BLEND)); 2242 fHWBlendState.fConstColor = blendConst;
2252 fHWBlendState.fEnabled = kNo_TriState; 2243 fHWBlendState.fConstColorValid = true;
2253 }
2254 } else {
2255 if (kYes_TriState != fHWBlendState.fEnabled) {
2256 GL_CALL(Enable(GR_GL_BLEND));
2257 fHWBlendState.fEnabled = kYes_TriState;
2258 }
2259 if (fHWBlendState.fSrcCoeff != srcCoeff ||
2260 fHWBlendState.fDstCoeff != dstCoeff) {
2261 GL_CALL(BlendFunc(gXfermodeCoeff2Blend[srcCoeff],
2262 gXfermodeCoeff2Blend[dstCoeff]));
2263 fHWBlendState.fSrcCoeff = srcCoeff;
2264 fHWBlendState.fDstCoeff = dstCoeff;
2265 }
2266 GrColor blendConst = this->getDrawState().getBlendConstant();
2267 if ((BlendCoeffReferencesConstant(srcCoeff) ||
2268 BlendCoeffReferencesConstant(dstCoeff)) &&
2269 (!fHWBlendState.fConstColorValid ||
2270 fHWBlendState.fConstColor != blendConst)) {
2271 GrGLfloat c[4];
2272 GrColorToRGBAFloat(blendConst, c);
2273 GL_CALL(BlendColor(c[0], c[1], c[2], c[3]));
2274 fHWBlendState.fConstColor = blendConst;
2275 fHWBlendState.fConstColorValid = true;
2276 }
2277 } 2244 }
2278 } 2245 }
2279 } 2246 }
2280 2247
2281 static inline GrGLenum tile_to_gl_wrap(SkShader::TileMode tm) { 2248 static inline GrGLenum tile_to_gl_wrap(SkShader::TileMode tm) {
2282 static const GrGLenum gWrapModes[] = { 2249 static const GrGLenum gWrapModes[] = {
2283 GR_GL_CLAMP_TO_EDGE, 2250 GR_GL_CLAMP_TO_EDGE,
2284 GR_GL_REPEAT, 2251 GR_GL_REPEAT,
2285 GR_GL_MIRRORED_REPEAT 2252 GR_GL_MIRRORED_REPEAT
2286 }; 2253 };
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 this->setVertexArrayID(gpu, 0); 2985 this->setVertexArrayID(gpu, 0);
3019 } 2986 }
3020 int attrCount = gpu->glCaps().maxVertexAttributes(); 2987 int attrCount = gpu->glCaps().maxVertexAttributes();
3021 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2988 if (fDefaultVertexArrayAttribState.count() != attrCount) {
3022 fDefaultVertexArrayAttribState.resize(attrCount); 2989 fDefaultVertexArrayAttribState.resize(attrCount);
3023 } 2990 }
3024 attribState = &fDefaultVertexArrayAttribState; 2991 attribState = &fDefaultVertexArrayAttribState;
3025 } 2992 }
3026 return attribState; 2993 return attribState;
3027 } 2994 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698