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

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

Issue 816513003: Stop creating GrODS for stencilPath commands. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 unified diff | Download patch
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 "GrGLStencilBuffer.h" 10 #include "GrGLStencilBuffer.h"
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 this->notifyIndexBufferDelete(desc.fID); 1306 this->notifyIndexBufferDelete(desc.fID);
1307 return NULL; 1307 return NULL;
1308 } 1308 }
1309 GrIndexBuffer* indexBuffer = SkNEW_ARGS(GrGLIndexBuffer, (this, desc )); 1309 GrIndexBuffer* indexBuffer = SkNEW_ARGS(GrGLIndexBuffer, (this, desc ));
1310 return indexBuffer; 1310 return indexBuffer;
1311 } 1311 }
1312 return NULL; 1312 return NULL;
1313 } 1313 }
1314 } 1314 }
1315 1315
1316 void GrGLGpu::flushScissor(const GrClipMaskManager::ScissorState& scissorState, 1316 void GrGLGpu::flushScissor(const GrScissorState& scissorState,
1317 const GrGLIRect& rtViewport, 1317 const GrGLIRect& rtViewport,
1318 GrSurfaceOrigin rtOrigin) { 1318 GrSurfaceOrigin rtOrigin) {
1319 if (scissorState.fEnabled) { 1319 if (scissorState.fEnabled) {
1320 GrGLIRect scissor; 1320 GrGLIRect scissor;
1321 scissor.setRelativeTo(rtViewport, 1321 scissor.setRelativeTo(rtViewport,
1322 scissorState.fRect.fLeft, 1322 scissorState.fRect.fLeft,
1323 scissorState.fRect.fTop, 1323 scissorState.fRect.fTop,
1324 scissorState.fRect.width(), 1324 scissorState.fRect.width(),
1325 scissorState.fRect.height(), 1325 scissorState.fRect.height(),
1326 rtOrigin); 1326 rtOrigin);
(...skipping 10 matching lines...) Expand all
1337 } 1337 }
1338 return; 1338 return;
1339 } 1339 }
1340 } 1340 }
1341 1341
1342 // See fall through note above 1342 // See fall through note above
1343 this->disableScissor(); 1343 this->disableScissor();
1344 } 1344 }
1345 1345
1346 bool GrGLGpu::flushGLState(const GrOptDrawState& optState) { 1346 bool GrGLGpu::flushGLState(const GrOptDrawState& optState) {
1347 SkASSERT(kStencilPath_DrawType != optState.drawType()); 1347 this->flushDither(optState.isDitherState());
1348 this->flushMiscFixedFunctionState(optState); 1348 this->flushColorWriteDisable(optState.isColorWriteDisabled());
1349 this->flushDrawFace(optState.getDrawFace());
1349 1350
1350 fCurrentProgram.reset(fProgramCache->getProgram(optState)); 1351 fCurrentProgram.reset(fProgramCache->getProgram(optState));
1351 if (NULL == fCurrentProgram.get()) { 1352 if (NULL == fCurrentProgram.get()) {
1352 SkDEBUGFAIL("Failed to create program!"); 1353 SkDEBUGFAIL("Failed to create program!");
1353 return false; 1354 return false;
1354 } 1355 }
1355 1356
1356 fCurrentProgram.get()->ref(); 1357 fCurrentProgram.get()->ref();
1357 1358
1358 GrGLuint programID = fCurrentProgram->programID(); 1359 GrGLuint programID = fCurrentProgram->programID();
1359 if (fHWProgramID != programID) { 1360 if (fHWProgramID != programID) {
1360 GL_CALL(UseProgram(programID)); 1361 GL_CALL(UseProgram(programID));
1361 fHWProgramID = programID; 1362 fHWProgramID = programID;
1362 } 1363 }
1363 1364
1364 this->flushBlend(optState); 1365 this->flushBlend(optState);
1365 1366
1366 fCurrentProgram->setData(optState); 1367 fCurrentProgram->setData(optState);
1367 1368
1368 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState.getRenderTa rget()); 1369 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState.getRenderTa rget());
1369 this->flushStencil(optState.getStencil(), optState.drawType()); 1370 this->flushStencil(optState.getStencil());
1370 this->flushScissor(optState.getScissorState(), glRT->getViewport(), glRT->or igin()); 1371 this->flushScissor(optState.getScissorState(), glRT->getViewport(), glRT->or igin());
1371 this->flushAAState(optState); 1372 this->flushHWAAState(glRT, optState.isHWAntialiasState(),
1373 kDrawLines_DrawType == optState.drawType());
1372 1374
1373 // This must come after textures are flushed because a texture may need 1375 // This must come after textures are flushed because a texture may need
1374 // to be msaa-resolved (which will modify bound FBO state). 1376 // to be msaa-resolved (which will modify bound FBO state).
1375 this->flushRenderTarget(glRT, NULL); 1377 this->flushRenderTarget(glRT, NULL);
1376 1378
1377 return true; 1379 return true;
1378 } 1380 }
1379 1381
1380 void GrGLGpu::setupGeometry(const GrOptDrawState& optState, 1382 void GrGLGpu::setupGeometry(const GrOptDrawState& optState,
1381 const GrDrawTarget::DrawInfo& info, 1383 const GrDrawTarget::DrawInfo& info,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 clippedRect = *rect; 1466 clippedRect = *rect;
1465 SkIRect rtRect = SkIRect::MakeWH(target->width(), target->height()); 1467 SkIRect rtRect = SkIRect::MakeWH(target->width(), target->height());
1466 if (clippedRect.intersect(rtRect)) { 1468 if (clippedRect.intersect(rtRect)) {
1467 rect = &clippedRect; 1469 rect = &clippedRect;
1468 } else { 1470 } else {
1469 return; 1471 return;
1470 } 1472 }
1471 } 1473 }
1472 1474
1473 this->flushRenderTarget(glRT, rect); 1475 this->flushRenderTarget(glRT, rect);
1474 GrClipMaskManager::ScissorState scissorState; 1476 GrScissorState scissorState;
1475 scissorState.fEnabled = SkToBool(rect); 1477 scissorState.fEnabled = SkToBool(rect);
1476 if (scissorState.fEnabled) { 1478 if (scissorState.fEnabled) {
1477 scissorState.fRect = *rect; 1479 scissorState.fRect = *rect;
1478 } 1480 }
1479 this->flushScissor(scissorState, glRT->getViewport(), glRT->origin()); 1481 this->flushScissor(scissorState, glRT->getViewport(), glRT->origin());
1480 1482
1481 GrGLfloat r, g, b, a; 1483 GrGLfloat r, g, b, a;
1482 static const GrGLfloat scale255 = 1.f / 255.f; 1484 static const GrGLfloat scale255 = 1.f / 255.f;
1483 a = GrColorUnpackA(color) * scale255; 1485 a = GrColorUnpackA(color) * scale255;
1484 GrGLfloat scaleRGB = scale255; 1486 GrGLfloat scaleRGB = scale255;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 #endif 1579 #endif
1578 GrGLint value; 1580 GrGLint value;
1579 if (insideClip) { 1581 if (insideClip) {
1580 value = (1 << (stencilBitCount - 1)); 1582 value = (1 << (stencilBitCount - 1));
1581 } else { 1583 } else {
1582 value = 0; 1584 value = 0;
1583 } 1585 }
1584 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target); 1586 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target);
1585 this->flushRenderTarget(glRT, &SkIRect::EmptyIRect()); 1587 this->flushRenderTarget(glRT, &SkIRect::EmptyIRect());
1586 1588
1587 GrClipMaskManager::ScissorState scissorState; 1589 GrScissorState scissorState;
1588 scissorState.fEnabled = true; 1590 scissorState.fEnabled = true;
1589 scissorState.fRect = rect; 1591 scissorState.fRect = rect;
1590 this->flushScissor(scissorState, glRT->getViewport(), glRT->origin()); 1592 this->flushScissor(scissorState, glRT->getViewport(), glRT->origin());
1591 1593
1592 GL_CALL(StencilMask((uint32_t) clipStencilMask)); 1594 GL_CALL(StencilMask((uint32_t) clipStencilMask));
1593 GL_CALL(ClearStencil(value)); 1595 GL_CALL(ClearStencil(value));
1594 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); 1596 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT));
1595 fHWStencilSettings.invalidate(); 1597 fHWStencilSettings.invalidate();
1596 } 1598 }
1597 1599
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 int set_a_break_pt_here = 9; 1856 int set_a_break_pt_here = 9;
1855 aglSwapBuffers(aglGetCurrentContext()); 1857 aglSwapBuffers(aglGetCurrentContext());
1856 #elif defined(SK_BUILD_FOR_WIN32) 1858 #elif defined(SK_BUILD_FOR_WIN32)
1857 SwapBuf(); 1859 SwapBuf();
1858 int set_a_break_pt_here = 9; 1860 int set_a_break_pt_here = 9;
1859 SwapBuf(); 1861 SwapBuf();
1860 #endif 1862 #endif
1861 #endif 1863 #endif
1862 } 1864 }
1863 1865
1864 void GrGLGpu::onStencilPath(const GrOptDrawState& ds, 1866 void GrGLGpu::onStencilPath(const GrPath* path, const StencilPathState& state) {
1865 const GrPath* path, 1867 this->flushColorWriteDisable(true);
1866 const GrStencilSettings& stencil) { 1868 this->flushDrawFace(GrDrawState::kBoth_DrawFace);
1867 this->flushMiscFixedFunctionState(ds); 1869
1868 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(ds.getRenderTarget()); 1870 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(state.fRenderTarget);
1869 SkISize size = SkISize::Make(rt->width(), rt->height()); 1871 SkISize size = SkISize::Make(rt->width(), rt->height());
1870 this->glPathRendering()->setProjectionMatrix(ds.getViewMatrix(), size, rt->o rigin()); 1872 this->glPathRendering()->setProjectionMatrix(*state.fViewMatrix, size, rt->o rigin());
1871 this->flushStencil(ds.getStencil(), ds.drawType()); 1873 this->flushScissor(*state.fScissor, rt->getViewport(), rt->origin());
1872 this->flushScissor(ds.getScissorState(), rt->getViewport(), rt->origin()); 1874 this->flushHWAAState(rt, state.fUseHWAA, false);
1873 this->flushAAState(ds);
1874 this->flushRenderTarget(rt, NULL); 1875 this->flushRenderTarget(rt, NULL);
1875 1876
1876 fPathRendering->stencilPath(path, stencil); 1877 fPathRendering->stencilPath(path, *state.fStencil);
1877 } 1878 }
1878 1879
1879 void GrGLGpu::onDrawPath(const GrOptDrawState& ds, const GrPath* path, 1880 void GrGLGpu::onDrawPath(const GrOptDrawState& ds, const GrPath* path,
1880 const GrStencilSettings& stencil) { 1881 const GrStencilSettings& stencil) {
1881 if (!this->flushGLState(ds)) { 1882 if (!this->flushGLState(ds)) {
1882 return; 1883 return;
1883 } 1884 }
1884 fPathRendering->drawPath(path, stencil); 1885 fPathRendering->drawPath(path, stencil);
1885 } 1886 }
1886 1887
(...skipping 26 matching lines...) Expand all
1913 // the bound DRAW FBO ID. 1914 // the bound DRAW FBO ID.
1914 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; 1915 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID;
1915 const GrGLIRect& vp = rt->getViewport(); 1916 const GrGLIRect& vp = rt->getViewport();
1916 const SkIRect dirtyRect = rt->getResolveRect(); 1917 const SkIRect dirtyRect = rt->getResolveRect();
1917 GrGLIRect r; 1918 GrGLIRect r;
1918 r.setRelativeTo(vp, dirtyRect.fLeft, dirtyRect.fTop, 1919 r.setRelativeTo(vp, dirtyRect.fLeft, dirtyRect.fTop,
1919 dirtyRect.width(), dirtyRect.height(), target->origi n()); 1920 dirtyRect.width(), dirtyRect.height(), target->origi n());
1920 1921
1921 if (GrGLCaps::kES_Apple_MSFBOType == this->glCaps().msFBOType()) { 1922 if (GrGLCaps::kES_Apple_MSFBOType == this->glCaps().msFBOType()) {
1922 // Apple's extension uses the scissor as the blit bounds. 1923 // Apple's extension uses the scissor as the blit bounds.
1923 GrClipMaskManager::ScissorState scissorState; 1924 GrScissorState scissorState;
1924 scissorState.fEnabled = true; 1925 scissorState.fEnabled = true;
1925 scissorState.fRect = dirtyRect; 1926 scissorState.fRect = dirtyRect;
1926 this->flushScissor(scissorState, rt->getViewport(), rt->origin() ); 1927 this->flushScissor(scissorState, rt->getViewport(), rt->origin() );
1927 GL_CALL(ResolveMultisampleFramebuffer()); 1928 GL_CALL(ResolveMultisampleFramebuffer());
1928 } else { 1929 } else {
1929 int right = r.fLeft + r.fWidth; 1930 int right = r.fLeft + r.fWidth;
1930 int top = r.fBottom + r.fHeight; 1931 int top = r.fBottom + r.fHeight;
1931 1932
1932 // BlitFrameBuffer respects the scissor, so disable it. 1933 // BlitFrameBuffer respects the scissor, so disable it.
1933 this->disableScissor(); 1934 this->disableScissor();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 GR_GL_CALL(gl, StencilMask(writeMask)); 1987 GR_GL_CALL(gl, StencilMask(writeMask));
1987 GR_GL_CALL(gl, StencilOp(glFailOp, glPassOp, glPassOp)); 1988 GR_GL_CALL(gl, StencilOp(glFailOp, glPassOp, glPassOp));
1988 } else { 1989 } else {
1989 GR_GL_CALL(gl, StencilFuncSeparate(glFace, glFunc, ref, mask)); 1990 GR_GL_CALL(gl, StencilFuncSeparate(glFace, glFunc, ref, mask));
1990 GR_GL_CALL(gl, StencilMaskSeparate(glFace, writeMask)); 1991 GR_GL_CALL(gl, StencilMaskSeparate(glFace, writeMask));
1991 GR_GL_CALL(gl, StencilOpSeparate(glFace, glFailOp, glPassOp, glPassOp)); 1992 GR_GL_CALL(gl, StencilOpSeparate(glFace, glFailOp, glPassOp, glPassOp));
1992 } 1993 }
1993 } 1994 }
1994 } 1995 }
1995 1996
1996 void GrGLGpu::flushStencil(const GrStencilSettings& stencilSettings, DrawType ty pe) { 1997 void GrGLGpu::flushStencil(const GrStencilSettings& stencilSettings) {
1997 // TODO figure out why we need to flush stencil settings on path draws at al l 1998 if (fHWStencilSettings != stencilSettings) {
1998 if (kStencilPath_DrawType != type && fHWStencilSettings != stencilSettings) {
1999 if (stencilSettings.isDisabled()) { 1999 if (stencilSettings.isDisabled()) {
2000 if (kNo_TriState != fHWStencilTestEnabled) { 2000 if (kNo_TriState != fHWStencilTestEnabled) {
2001 GL_CALL(Disable(GR_GL_STENCIL_TEST)); 2001 GL_CALL(Disable(GR_GL_STENCIL_TEST));
2002 fHWStencilTestEnabled = kNo_TriState; 2002 fHWStencilTestEnabled = kNo_TriState;
2003 } 2003 }
2004 } else { 2004 } else {
2005 if (kYes_TriState != fHWStencilTestEnabled) { 2005 if (kYes_TriState != fHWStencilTestEnabled) {
2006 GL_CALL(Enable(GR_GL_STENCIL_TEST)); 2006 GL_CALL(Enable(GR_GL_STENCIL_TEST));
2007 fHWStencilTestEnabled = kYes_TriState; 2007 fHWStencilTestEnabled = kYes_TriState;
2008 } 2008 }
(...skipping 12 matching lines...) Expand all
2021 set_gl_stencil(this->glInterface(), 2021 set_gl_stencil(this->glInterface(),
2022 stencilSettings, 2022 stencilSettings,
2023 GR_GL_FRONT_AND_BACK, 2023 GR_GL_FRONT_AND_BACK,
2024 GrStencilSettings::kFront_Face); 2024 GrStencilSettings::kFront_Face);
2025 } 2025 }
2026 } 2026 }
2027 fHWStencilSettings = stencilSettings; 2027 fHWStencilSettings = stencilSettings;
2028 } 2028 }
2029 } 2029 }
2030 2030
2031 void GrGLGpu::flushAAState(const GrOptDrawState& optState) { 2031 void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA, bool isLineDraw) {
2032 // At least some ATI linux drivers will render GL_LINES incorrectly when MSAA st ate is enabled but 2032 // At least some ATI linux drivers will render GL_LINES incorrectly when MSAA st ate is enabled but
2033 // the target is not multisampled. Single pixel wide lines are rendered thicker than 1 pixel wide. 2033 // the target is not multisampled. Single pixel wide lines are rendered thicker than 1 pixel wide.
2034 #if 0 2034 #if 0
2035 // Replace RT_HAS_MSAA with this definition once this driver bug is no longe r a relevant concern 2035 // Replace RT_HAS_MSAA with this definition once this driver bug is no longe r a relevant concern
2036 #define RT_HAS_MSAA rt->isMultisampled() 2036 #define RT_HAS_MSAA rt->isMultisampled()
2037 #else 2037 #else
2038 #define RT_HAS_MSAA (rt->isMultisampled() || kDrawLines_DrawType == optState .drawType()) 2038 #define RT_HAS_MSAA (rt->isMultisampled() || isLineDraw)
2039 #endif 2039 #endif
2040 2040
2041 const GrRenderTarget* rt = optState.getRenderTarget();
2042 if (kGL_GrGLStandard == this->glStandard()) { 2041 if (kGL_GrGLStandard == this->glStandard()) {
2043 if (RT_HAS_MSAA) { 2042 if (RT_HAS_MSAA) {
2044 bool enableMSAA = optState.isHWAntialiasState(); 2043 if (useHWAA) {
2045 if (enableMSAA) {
2046 if (kYes_TriState != fMSAAEnabled) { 2044 if (kYes_TriState != fMSAAEnabled) {
2047 GL_CALL(Enable(GR_GL_MULTISAMPLE)); 2045 GL_CALL(Enable(GR_GL_MULTISAMPLE));
2048 fMSAAEnabled = kYes_TriState; 2046 fMSAAEnabled = kYes_TriState;
2049 } 2047 }
2050 } else { 2048 } else {
2051 if (kNo_TriState != fMSAAEnabled) { 2049 if (kNo_TriState != fMSAAEnabled) {
2052 GL_CALL(Disable(GR_GL_MULTISAMPLE)); 2050 GL_CALL(Disable(GR_GL_MULTISAMPLE));
2053 fMSAAEnabled = kNo_TriState; 2051 fMSAAEnabled = kNo_TriState;
2054 } 2052 }
2055 } 2053 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2203 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_SWIZZLE_A, swi zzle[3])); 2201 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_SWIZZLE_A, swi zzle[3]));
2204 } else { 2202 } else {
2205 GR_STATIC_ASSERT(sizeof(newTexParams.fSwizzleRGBA[0]) == sizeof(GrGL int)); 2203 GR_STATIC_ASSERT(sizeof(newTexParams.fSwizzleRGBA[0]) == sizeof(GrGL int));
2206 const GrGLint* swizzle = reinterpret_cast<const GrGLint*>(newTexPara ms.fSwizzleRGBA); 2204 const GrGLint* swizzle = reinterpret_cast<const GrGLint*>(newTexPara ms.fSwizzleRGBA);
2207 GL_CALL(TexParameteriv(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_SWIZZLE_RGBA, swizzle)); 2205 GL_CALL(TexParameteriv(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_SWIZZLE_RGBA, swizzle));
2208 } 2206 }
2209 } 2207 }
2210 texture->setCachedTexParams(newTexParams, this->getResetTimestamp()); 2208 texture->setCachedTexParams(newTexParams, this->getResetTimestamp());
2211 } 2209 }
2212 2210
2213 void GrGLGpu::flushMiscFixedFunctionState(const GrOptDrawState& optState) { 2211 void GrGLGpu::flushDither(bool dither) {
2214 if (optState.isDitherState()) { 2212 if (dither) {
2215 if (kYes_TriState != fHWDitherEnabled) { 2213 if (kYes_TriState != fHWDitherEnabled) {
2216 GL_CALL(Enable(GR_GL_DITHER)); 2214 GL_CALL(Enable(GR_GL_DITHER));
2217 fHWDitherEnabled = kYes_TriState; 2215 fHWDitherEnabled = kYes_TriState;
2218 } 2216 }
2219 } else { 2217 } else {
2220 if (kNo_TriState != fHWDitherEnabled) { 2218 if (kNo_TriState != fHWDitherEnabled) {
2221 GL_CALL(Disable(GR_GL_DITHER)); 2219 GL_CALL(Disable(GR_GL_DITHER));
2222 fHWDitherEnabled = kNo_TriState; 2220 fHWDitherEnabled = kNo_TriState;
2223 } 2221 }
2224 } 2222 }
2223 }
2225 2224
2226 if (optState.isColorWriteDisabled()) { 2225 void GrGLGpu::flushColorWriteDisable(bool disableColorWrites) {
2226 if (disableColorWrites) {
2227 if (kNo_TriState != fHWWriteToColor) { 2227 if (kNo_TriState != fHWWriteToColor) {
2228 GL_CALL(ColorMask(GR_GL_FALSE, GR_GL_FALSE, 2228 GL_CALL(ColorMask(GR_GL_FALSE, GR_GL_FALSE,
2229 GR_GL_FALSE, GR_GL_FALSE)); 2229 GR_GL_FALSE, GR_GL_FALSE));
2230 fHWWriteToColor = kNo_TriState; 2230 fHWWriteToColor = kNo_TriState;
2231 } 2231 }
2232 } else { 2232 } else {
2233 if (kYes_TriState != fHWWriteToColor) { 2233 if (kYes_TriState != fHWWriteToColor) {
2234 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE)); 2234 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE));
2235 fHWWriteToColor = kYes_TriState; 2235 fHWWriteToColor = kYes_TriState;
2236 } 2236 }
2237 } 2237 }
2238 }
2238 2239
2239 if (fHWDrawFace != optState.getDrawFace()) { 2240 void GrGLGpu::flushDrawFace(GrDrawState::DrawFace face) {
2240 switch (optState.getDrawFace()) { 2241 if (fHWDrawFace != face) {
2242 switch (face) {
2241 case GrDrawState::kCCW_DrawFace: 2243 case GrDrawState::kCCW_DrawFace:
2242 GL_CALL(Enable(GR_GL_CULL_FACE)); 2244 GL_CALL(Enable(GR_GL_CULL_FACE));
2243 GL_CALL(CullFace(GR_GL_BACK)); 2245 GL_CALL(CullFace(GR_GL_BACK));
2244 break; 2246 break;
2245 case GrDrawState::kCW_DrawFace: 2247 case GrDrawState::kCW_DrawFace:
2246 GL_CALL(Enable(GR_GL_CULL_FACE)); 2248 GL_CALL(Enable(GR_GL_CULL_FACE));
2247 GL_CALL(CullFace(GR_GL_FRONT)); 2249 GL_CALL(CullFace(GR_GL_FRONT));
2248 break; 2250 break;
2249 case GrDrawState::kBoth_DrawFace: 2251 case GrDrawState::kBoth_DrawFace:
2250 GL_CALL(Disable(GR_GL_CULL_FACE)); 2252 GL_CALL(Disable(GR_GL_CULL_FACE));
2251 break; 2253 break;
2252 default: 2254 default:
2253 SkFAIL("Unknown draw face."); 2255 SkFAIL("Unknown draw face.");
2254 } 2256 }
2255 fHWDrawFace = optState.getDrawFace(); 2257 fHWDrawFace = face;
2256 } 2258 }
2257 } 2259 }
2258 2260
2259 bool GrGLGpu::configToGLFormats(GrPixelConfig config, 2261 bool GrGLGpu::configToGLFormats(GrPixelConfig config,
2260 bool getSizedInternalFormat, 2262 bool getSizedInternalFormat,
2261 GrGLenum* internalFormat, 2263 GrGLenum* internalFormat,
2262 GrGLenum* externalFormat, 2264 GrGLenum* externalFormat,
2263 GrGLenum* externalType) { 2265 GrGLenum* externalType) {
2264 GrGLenum dontCare; 2266 GrGLenum dontCare;
2265 if (NULL == internalFormat) { 2267 if (NULL == internalFormat) {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 this->setVertexArrayID(gpu, 0); 2729 this->setVertexArrayID(gpu, 0);
2728 } 2730 }
2729 int attrCount = gpu->glCaps().maxVertexAttributes(); 2731 int attrCount = gpu->glCaps().maxVertexAttributes();
2730 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2732 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2731 fDefaultVertexArrayAttribState.resize(attrCount); 2733 fDefaultVertexArrayAttribState.resize(attrCount);
2732 } 2734 }
2733 attribState = &fDefaultVertexArrayAttribState; 2735 attribState = &fDefaultVertexArrayAttribState;
2734 } 2736 }
2735 return attribState; 2737 return attribState;
2736 } 2738 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698