Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 if (resetBits & kView_GrGLBackendState) { | 349 if (resetBits & kView_GrGLBackendState) { |
| 350 fHWScissorSettings.invalidate(); | 350 fHWScissorSettings.invalidate(); |
| 351 fHWViewport.invalidate(); | 351 fHWViewport.invalidate(); |
| 352 } | 352 } |
| 353 | 353 |
| 354 if (resetBits & kStencil_GrGLBackendState) { | 354 if (resetBits & kStencil_GrGLBackendState) { |
| 355 fHWStencilSettings.invalidate(); | 355 fHWStencilSettings.invalidate(); |
| 356 fHWStencilTestEnabled = kUnknown_TriState; | 356 fHWStencilTestEnabled = kUnknown_TriState; |
| 357 } | 357 } |
| 358 | 358 |
| 359 if (resetBits & kPathRendering_GrGLBackendState && this->glCaps().pathRender ingSupport()) { | |
| 360 fHWPathStencilSettings.invalidate(); | |
|
Chris Dalton
2013/10/07 22:22:45
It's a little confusing that kPathRendering_GrGLBa
Kimmo Kinnunen
2013/10/08 12:14:09
Done.
| |
| 361 } | |
| 362 | |
| 359 // Vertex | 363 // Vertex |
| 360 if (resetBits & kVertex_GrGLBackendState) { | 364 if (resetBits & kVertex_GrGLBackendState) { |
| 361 fHWGeometryState.invalidate(); | 365 fHWGeometryState.invalidate(); |
| 362 } | 366 } |
| 363 | 367 |
| 364 if (resetBits & kRenderTarget_GrGLBackendState) { | 368 if (resetBits & kRenderTarget_GrGLBackendState) { |
| 365 fHWBoundRenderTarget = NULL; | 369 fHWBoundRenderTarget = NULL; |
| 366 } | 370 } |
| 367 | 371 |
| 368 if (resetBits & kFixedFunction_GrGLBackendState && this->glCaps().fixedFunct ionSupport()) { | 372 if (resetBits & kFixedFunction_GrGLBackendState && this->glCaps().fixedFunct ionSupport()) { |
|
Chris Dalton
2013/10/07 22:22:45
Maybe for now we can just mix path rendering and f
| |
| 369 | 373 |
| 370 fHWProjectionMatrixState.invalidate(); | 374 fHWProjectionMatrixState.invalidate(); |
| 371 // we don't use the model view matrix. | 375 // we don't use the model view matrix. |
| 372 GL_CALL(MatrixMode(GR_GL_MODELVIEW)); | 376 GL_CALL(MatrixMode(GR_GL_MODELVIEW)); |
| 373 GL_CALL(LoadIdentity()); | 377 GL_CALL(LoadIdentity()); |
| 374 | 378 |
| 375 for (int i = 0; i < this->glCaps().maxFixedFunctionTextureCoords(); ++i) { | 379 for (int i = 0; i < this->glCaps().maxFixedFunctionTextureCoords(); ++i) { |
| 376 GL_CALL(ActiveTexture(GR_GL_TEXTURE0 + i)); | 380 GL_CALL(ActiveTexture(GR_GL_TEXTURE0 + i)); |
| 377 GL_CALL(Disable(GR_GL_TEXTURE_GEN_S)); | 381 GL_CALL(Disable(GR_GL_TEXTURE_GEN_S)); |
| 378 GL_CALL(Disable(GR_GL_TEXTURE_GEN_T)); | 382 GL_CALL(Disable(GR_GL_TEXTURE_GEN_T)); |
| 379 GL_CALL(Disable(GR_GL_TEXTURE_GEN_Q)); | 383 GL_CALL(Disable(GR_GL_TEXTURE_GEN_Q)); |
| 380 GL_CALL(Disable(GR_GL_TEXTURE_GEN_R)); | 384 GL_CALL(Disable(GR_GL_TEXTURE_GEN_R)); |
| 381 if (this->caps()->pathStencilingSupport()) { | 385 if (this->caps()->pathRenderingSupport()) { |
| 382 GL_CALL(PathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL)); | 386 GL_CALL(PathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL)); |
| 383 } | 387 } |
| 384 fHWTexGenSettings[i].fMode = GR_GL_NONE; | 388 fHWTexGenSettings[i].fMode = GR_GL_NONE; |
| 385 fHWTexGenSettings[i].fNumComponents = 0; | 389 fHWTexGenSettings[i].fNumComponents = 0; |
| 386 } | 390 } |
| 387 fHWActiveTexGenSets = 0; | 391 fHWActiveTexGenSets = 0; |
| 388 } | 392 } |
| 389 | 393 |
| 390 // we assume these values | 394 // we assume these values |
| 391 if (resetBits & kPixelStore_GrGLBackendState) { | 395 if (resetBits & kPixelStore_GrGLBackendState) { |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1266 return NULL; | 1270 return NULL; |
| 1267 } | 1271 } |
| 1268 GrIndexBuffer* indexBuffer = SkNEW_ARGS(GrGLIndexBuffer, (this, desc )); | 1272 GrIndexBuffer* indexBuffer = SkNEW_ARGS(GrGLIndexBuffer, (this, desc )); |
| 1269 return indexBuffer; | 1273 return indexBuffer; |
| 1270 } | 1274 } |
| 1271 return NULL; | 1275 return NULL; |
| 1272 } | 1276 } |
| 1273 } | 1277 } |
| 1274 | 1278 |
| 1275 GrPath* GrGpuGL::onCreatePath(const SkPath& inPath) { | 1279 GrPath* GrGpuGL::onCreatePath(const SkPath& inPath) { |
| 1276 SkASSERT(this->caps()->pathStencilingSupport()); | 1280 SkASSERT(this->caps()->pathRenderingSupport()); |
| 1277 return SkNEW_ARGS(GrGLPath, (this, inPath)); | 1281 return SkNEW_ARGS(GrGLPath, (this, inPath)); |
| 1278 } | 1282 } |
| 1279 | 1283 |
| 1280 void GrGpuGL::flushScissor() { | 1284 void GrGpuGL::flushScissor() { |
| 1281 if (fScissorState.fEnabled) { | 1285 if (fScissorState.fEnabled) { |
| 1282 // Only access the RT if scissoring is being enabled. We can call this b efore performing | 1286 // Only access the RT if scissoring is being enabled. We can call this b efore performing |
| 1283 // a glBitframebuffer for a surface->surface copy, which requires no RT to be bound to the | 1287 // a glBitframebuffer for a surface->surface copy, which requires no RT to be bound to the |
| 1284 // GrDrawState. | 1288 // GrDrawState. |
| 1285 const GrDrawState& drawState = this->getDrawState(); | 1289 const GrDrawState& drawState = this->getDrawState(); |
| 1286 const GrGLRenderTarget* rt = | 1290 const GrGLRenderTarget* rt = |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1660 aglSwapBuffers(aglGetCurrentContext()); | 1664 aglSwapBuffers(aglGetCurrentContext()); |
| 1661 #elif defined(SK_BUILD_FOR_WIN32) | 1665 #elif defined(SK_BUILD_FOR_WIN32) |
| 1662 SwapBuf(); | 1666 SwapBuf(); |
| 1663 int set_a_break_pt_here = 9; | 1667 int set_a_break_pt_here = 9; |
| 1664 SwapBuf(); | 1668 SwapBuf(); |
| 1665 #endif | 1669 #endif |
| 1666 #endif | 1670 #endif |
| 1667 } | 1671 } |
| 1668 | 1672 |
| 1669 namespace { | 1673 namespace { |
| 1670 | 1674 GrGLenum gr_stencil_op_to_gl_path_rendering_fill_mode(GrStencilOp op) { |
| 1671 static const uint16_t kOnes16 = static_cast<uint16_t>(~0); | 1675 switch (op) { |
| 1672 const GrStencilSettings& winding_nv_path_stencil_settings() { | 1676 default: |
| 1673 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, | 1677 GrCrash("Unexpected path fill."); |
| 1674 kIncClamp_StencilOp, | 1678 /* fallthrough */; |
| 1675 kIncClamp_StencilOp, | 1679 case kIncClamp_StencilOp: |
| 1676 kAlwaysIfInClip_StencilFunc, | 1680 return GR_GL_COUNT_UP; |
| 1677 kOnes16, kOnes16, kOnes16); | 1681 case kInvert_StencilOp: |
| 1678 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); | 1682 return GR_GL_INVERT; |
| 1679 } | 1683 } |
| 1680 const GrStencilSettings& even_odd_nv_path_stencil_settings() { | |
| 1681 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, | |
| 1682 kInvert_StencilOp, | |
| 1683 kInvert_StencilOp, | |
| 1684 kAlwaysIfInClip_StencilFunc, | |
| 1685 kOnes16, kOnes16, kOnes16); | |
| 1686 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); | |
| 1687 } | 1684 } |
| 1688 } | 1685 } |
| 1689 | 1686 |
| 1690 void GrGpuGL::setStencilPathSettings(const GrPath&, | 1687 void GrGpuGL::onGpuStencilPath(const GrPath* path, SkPath::FillType fill) { |
| 1691 SkPath::FillType fill, | 1688 SkASSERT(this->caps()->pathRenderingSupport()); |
| 1692 GrStencilSettings* settings) { | 1689 |
| 1693 switch (fill) { | 1690 GrGLuint id = static_cast<const GrGLPath*>(path)->pathID(); |
| 1694 case SkPath::kEvenOdd_FillType: | 1691 SkASSERT(NULL != this->drawState()->getRenderTarget()); |
| 1695 *settings = even_odd_nv_path_stencil_settings(); | 1692 SkASSERT(NULL != this->drawState()->getRenderTarget()->getStencilBuffer()); |
| 1696 return; | 1693 |
| 1697 case SkPath::kWinding_FillType: | 1694 flushPathStencilSettings(fill); |
| 1698 *settings = winding_nv_path_stencil_settings(); | 1695 |
| 1699 return; | 1696 // Decide how to manipulate the stencil buffer based on the fill rule. |
| 1700 default: | 1697 SkASSERT(!fHWPathStencilSettings.isTwoSided()); |
| 1701 GrCrash("Unexpected path fill."); | 1698 |
| 1699 GrGLenum fillMode = | |
| 1700 gr_stencil_op_to_gl_path_rendering_fill_mode(fHWPathStencilSettings.pass Op(GrStencilSettings::kFront_Face)); | |
| 1701 GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFro nt_Face); | |
| 1702 GL_CALL(StencilFillPath(id, fillMode, writeMask)); | |
| 1703 } | |
| 1704 | |
| 1705 void GrGpuGL::onGpuFillPath(const GrPath* path, SkPath::FillType fill) { | |
| 1706 SkASSERT(this->caps()->pathRenderingSupport()); | |
| 1707 | |
| 1708 GrGLuint id = static_cast<const GrGLPath*>(path)->pathID(); | |
| 1709 SkASSERT(NULL != this->drawState()->getRenderTarget()); | |
| 1710 SkASSERT(NULL != this->drawState()->getRenderTarget()->getStencilBuffer()); | |
| 1711 SkASSERT(!fCurrentProgram->hasVertexShader()); | |
| 1712 | |
| 1713 flushPathStencilSettings(fill); | |
| 1714 | |
| 1715 SkPath::FillType nonInvertedFill = SkPath::ConvertToNonInverseFillType(fill) ; | |
| 1716 SkASSERT(!fHWPathStencilSettings.isTwoSided()); | |
| 1717 GrGLenum fillMode = | |
| 1718 gr_stencil_op_to_gl_path_rendering_fill_mode(fHWPathStencilSettings.pass Op(GrStencilSettings::kFront_Face)); | |
| 1719 GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFro nt_Face); | |
| 1720 GL_CALL(StencilFillPath(id, fillMode, writeMask)); | |
| 1721 | |
| 1722 if (nonInvertedFill == fill) { | |
| 1723 GL_CALL(CoverFillPath(id, GR_GL_BOUNDING_BOX)); | |
| 1724 } else { | |
| 1725 GrDrawState* drawState = this->drawState(); | |
| 1726 GrDrawState::AutoViewMatrixRestore avmr; | |
| 1727 SkRect bounds = SkRect::MakeLTRB(0, 0, | |
| 1728 SkIntToScalar(drawState->getRenderTarge t()->width()), | |
| 1729 SkIntToScalar(drawState->getRenderTarge t()->height())); | |
| 1730 SkMatrix vmi; | |
| 1731 // mapRect through persp matrix may not be correct | |
| 1732 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn verse(&vmi)) { | |
| 1733 vmi.mapRect(&bounds); | |
| 1734 // theoretically could set bloat = 0, instead leave it because of ma trix inversion | |
| 1735 // precision. | |
| 1736 SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_Sca larHalf; | |
| 1737 bounds.outset(bloat, bloat); | |
| 1738 } else { | |
| 1739 avmr.setIdentity(drawState); | |
| 1740 } | |
| 1741 | |
| 1742 this->drawSimpleRect(bounds, NULL); | |
| 1702 } | 1743 } |
| 1703 } | 1744 } |
| 1704 | 1745 |
| 1705 void GrGpuGL::onGpuStencilPath(const GrPath* path, SkPath::FillType fill) { | |
| 1706 SkASSERT(this->caps()->pathStencilingSupport()); | |
| 1707 | |
| 1708 GrGLuint id = static_cast<const GrGLPath*>(path)->pathID(); | |
| 1709 GrDrawState* drawState = this->drawState(); | |
| 1710 SkASSERT(NULL != drawState->getRenderTarget()); | |
| 1711 if (NULL == drawState->getRenderTarget()->getStencilBuffer()) { | |
| 1712 return; | |
| 1713 } | |
| 1714 | |
| 1715 // Decide how to manipulate the stencil buffer based on the fill rule. | |
| 1716 // Also, assert that the stencil settings we set in setStencilPathSettings | |
| 1717 // are present. | |
| 1718 SkASSERT(!fStencilSettings.isTwoSided()); | |
| 1719 GrGLenum fillMode; | |
| 1720 switch (fill) { | |
| 1721 case SkPath::kWinding_FillType: | |
| 1722 fillMode = GR_GL_COUNT_UP; | |
| 1723 SkASSERT(kIncClamp_StencilOp == | |
| 1724 fStencilSettings.passOp(GrStencilSettings::kFront_Face)); | |
| 1725 SkASSERT(kIncClamp_StencilOp == | |
| 1726 fStencilSettings.failOp(GrStencilSettings::kFront_Face)); | |
| 1727 break; | |
| 1728 case SkPath::kEvenOdd_FillType: | |
| 1729 fillMode = GR_GL_INVERT; | |
| 1730 SkASSERT(kInvert_StencilOp == | |
| 1731 fStencilSettings.passOp(GrStencilSettings::kFront_Face)); | |
| 1732 SkASSERT(kInvert_StencilOp == | |
| 1733 fStencilSettings.failOp(GrStencilSettings::kFront_Face)); | |
| 1734 break; | |
| 1735 default: | |
| 1736 // Only the above two fill rules are allowed. | |
| 1737 GrCrash("Unexpected path fill."); | |
| 1738 return; // suppress unused var warning. | |
| 1739 } | |
| 1740 GrGLint writeMask = fStencilSettings.writeMask(GrStencilSettings::kFront_Fac e); | |
| 1741 GL_CALL(StencilFillPath(id, fillMode, writeMask)); | |
| 1742 } | |
| 1743 | |
| 1744 void GrGpuGL::onResolveRenderTarget(GrRenderTarget* target) { | 1746 void GrGpuGL::onResolveRenderTarget(GrRenderTarget* target) { |
| 1745 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(target); | 1747 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(target); |
| 1746 if (rt->needsResolve()) { | 1748 if (rt->needsResolve()) { |
| 1747 // Some extensions automatically resolves the texture when it is read. | 1749 // Some extensions automatically resolves the texture when it is read. |
| 1748 if (this->glCaps().usesMSAARenderBuffers()) { | 1750 if (this->glCaps().usesMSAARenderBuffers()) { |
| 1749 SkASSERT(rt->textureFBOID() != rt->renderFBOID()); | 1751 SkASSERT(rt->textureFBOID() != rt->renderFBOID()); |
| 1750 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, rt->renderFBOID())); | 1752 GL_CALL(BindFramebuffer(GR_GL_READ_FRAMEBUFFER, rt->renderFBOID())); |
| 1751 GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, rt->textureFBOID())) ; | 1753 GL_CALL(BindFramebuffer(GR_GL_DRAW_FRAMEBUFFER, rt->textureFBOID())) ; |
| 1752 // make sure we go through flushRenderTarget() since we've modified | 1754 // make sure we go through flushRenderTarget() since we've modified |
| 1753 // the bound DRAW FBO ID. | 1755 // the bound DRAW FBO ID. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1855 GR_GL_CALL(gl, StencilOp(glFailOp, glPassOp, glPassOp)); | 1857 GR_GL_CALL(gl, StencilOp(glFailOp, glPassOp, glPassOp)); |
| 1856 } else { | 1858 } else { |
| 1857 GR_GL_CALL(gl, StencilFuncSeparate(glFace, glFunc, ref, mask)); | 1859 GR_GL_CALL(gl, StencilFuncSeparate(glFace, glFunc, ref, mask)); |
| 1858 GR_GL_CALL(gl, StencilMaskSeparate(glFace, writeMask)); | 1860 GR_GL_CALL(gl, StencilMaskSeparate(glFace, writeMask)); |
| 1859 GR_GL_CALL(gl, StencilOpSeparate(glFace, glFailOp, glPassOp, glPassOp)); | 1861 GR_GL_CALL(gl, StencilOpSeparate(glFace, glFailOp, glPassOp, glPassOp)); |
| 1860 } | 1862 } |
| 1861 } | 1863 } |
| 1862 } | 1864 } |
| 1863 | 1865 |
| 1864 void GrGpuGL::flushStencil(DrawType type) { | 1866 void GrGpuGL::flushStencil(DrawType type) { |
| 1865 if (kStencilPath_DrawType == type) { | 1867 if (kStencilPath_DrawType != type && fHWStencilSettings != fStencilSettings) { |
| 1866 SkASSERT(!fStencilSettings.isTwoSided()); | |
| 1867 // Just the func, ref, and mask is set here. The op and write mask are p arams to the call | |
| 1868 // that draws the path to the SB (glStencilFillPath) | |
| 1869 GrGLenum func = | |
| 1870 gr_to_gl_stencil_func(fStencilSettings.func(GrStencilSettings::kFron t_Face)); | |
| 1871 GL_CALL(PathStencilFunc(func, | |
| 1872 fStencilSettings.funcRef(GrStencilSettings::kFro nt_Face), | |
| 1873 fStencilSettings.funcMask(GrStencilSettings::kFr ont_Face))); | |
| 1874 } else if (fHWStencilSettings != fStencilSettings) { | |
| 1875 if (fStencilSettings.isDisabled()) { | 1868 if (fStencilSettings.isDisabled()) { |
| 1876 if (kNo_TriState != fHWStencilTestEnabled) { | 1869 if (kNo_TriState != fHWStencilTestEnabled) { |
| 1877 GL_CALL(Disable(GR_GL_STENCIL_TEST)); | 1870 GL_CALL(Disable(GR_GL_STENCIL_TEST)); |
| 1878 fHWStencilTestEnabled = kNo_TriState; | 1871 fHWStencilTestEnabled = kNo_TriState; |
| 1879 } | 1872 } |
| 1880 } else { | 1873 } else { |
| 1881 if (kYes_TriState != fHWStencilTestEnabled) { | 1874 if (kYes_TriState != fHWStencilTestEnabled) { |
| 1882 GL_CALL(Enable(GR_GL_STENCIL_TEST)); | 1875 GL_CALL(Enable(GR_GL_STENCIL_TEST)); |
| 1883 fHWStencilTestEnabled = kYes_TriState; | 1876 fHWStencilTestEnabled = kYes_TriState; |
| 1884 } | 1877 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1954 } else { | 1947 } else { |
| 1955 if (kNo_TriState != fHWAAState.fMSAAEnabled) { | 1948 if (kNo_TriState != fHWAAState.fMSAAEnabled) { |
| 1956 GL_CALL(Disable(GR_GL_MULTISAMPLE)); | 1949 GL_CALL(Disable(GR_GL_MULTISAMPLE)); |
| 1957 fHWAAState.fMSAAEnabled = kNo_TriState; | 1950 fHWAAState.fMSAAEnabled = kNo_TriState; |
| 1958 } | 1951 } |
| 1959 } | 1952 } |
| 1960 } | 1953 } |
| 1961 } | 1954 } |
| 1962 } | 1955 } |
| 1963 | 1956 |
| 1957 void GrGpuGL::flushPathStencilSettings(SkPath::FillType fill) { | |
| 1958 GrStencilSettings pathStencilSettings; | |
| 1959 this->getPathStencilSettingsForFillType(fill, &pathStencilSettings); | |
| 1960 if (fHWPathStencilSettings != pathStencilSettings) { | |
| 1961 // Just the func, ref, and mask is set here. The op and write mask are p arams to the call | |
| 1962 // that draws the path to the SB (glStencilFillPath) | |
| 1963 GrGLenum func = | |
| 1964 gr_to_gl_stencil_func(pathStencilSettings.func(GrStencilSettings::kF ront_Face)); | |
| 1965 GL_CALL(PathStencilFunc(func, | |
| 1966 pathStencilSettings.funcRef(GrStencilSettings::k Front_Face), | |
| 1967 pathStencilSettings.funcMask(GrStencilSettings:: kFront_Face))); | |
| 1968 | |
| 1969 fHWPathStencilSettings = pathStencilSettings; | |
| 1970 } | |
| 1971 } | |
| 1972 | |
| 1964 void GrGpuGL::flushBlend(bool isLines, | 1973 void GrGpuGL::flushBlend(bool isLines, |
| 1965 GrBlendCoeff srcCoeff, | 1974 GrBlendCoeff srcCoeff, |
| 1966 GrBlendCoeff dstCoeff) { | 1975 GrBlendCoeff dstCoeff) { |
| 1967 if (isLines && this->willUseHWAALines()) { | 1976 if (isLines && this->willUseHWAALines()) { |
| 1968 if (kYes_TriState != fHWBlendState.fEnabled) { | 1977 if (kYes_TriState != fHWBlendState.fEnabled) { |
| 1969 GL_CALL(Enable(GR_GL_BLEND)); | 1978 GL_CALL(Enable(GR_GL_BLEND)); |
| 1970 fHWBlendState.fEnabled = kYes_TriState; | 1979 fHWBlendState.fEnabled = kYes_TriState; |
| 1971 } | 1980 } |
| 1972 if (kSA_GrBlendCoeff != fHWBlendState.fSrcCoeff || | 1981 if (kSA_GrBlendCoeff != fHWBlendState.fSrcCoeff || |
| 1973 kISA_GrBlendCoeff != fHWBlendState.fDstCoeff) { | 1982 kISA_GrBlendCoeff != fHWBlendState.fDstCoeff) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2141 fHWProjectionMatrixState.getGLMatrix<4>(glMatrix); | 2150 fHWProjectionMatrixState.getGLMatrix<4>(glMatrix); |
| 2142 GL_CALL(MatrixMode(GR_GL_PROJECTION)); | 2151 GL_CALL(MatrixMode(GR_GL_PROJECTION)); |
| 2143 GL_CALL(LoadMatrixf(glMatrix)); | 2152 GL_CALL(LoadMatrixf(glMatrix)); |
| 2144 } | 2153 } |
| 2145 | 2154 |
| 2146 void GrGpuGL::enableTexGen(int unitIdx, | 2155 void GrGpuGL::enableTexGen(int unitIdx, |
| 2147 TexGenComponents components, | 2156 TexGenComponents components, |
| 2148 const GrGLfloat* coefficients) { | 2157 const GrGLfloat* coefficients) { |
| 2149 | 2158 |
| 2150 SkASSERT(this->glCaps().fixedFunctionSupport()); | 2159 SkASSERT(this->glCaps().fixedFunctionSupport()); |
| 2151 SkASSERT(this->caps()->pathStencilingSupport()); | 2160 SkASSERT(this->caps()->pathRenderingSupport()); |
| 2152 SkASSERT(components >= kS_TexGenComponents && components <= kSTR_TexGenCompo nents); | 2161 SkASSERT(components >= kS_TexGenComponents && components <= kSTR_TexGenCompo nents); |
| 2153 | 2162 |
| 2154 if (GR_GL_OBJECT_LINEAR == fHWTexGenSettings[unitIdx].fMode && | 2163 if (GR_GL_OBJECT_LINEAR == fHWTexGenSettings[unitIdx].fMode && |
| 2155 components == fHWTexGenSettings[unitIdx].fNumComponents && | 2164 components == fHWTexGenSettings[unitIdx].fNumComponents && |
| 2156 !memcmp(coefficients, fHWTexGenSettings[unitIdx].fCoefficients, | 2165 !memcmp(coefficients, fHWTexGenSettings[unitIdx].fCoefficients, |
| 2157 3 * components * sizeof(GrGLfloat))) { | 2166 3 * components * sizeof(GrGLfloat))) { |
| 2158 return; | 2167 return; |
| 2159 } | 2168 } |
| 2160 | 2169 |
| 2161 this->setTextureUnit(unitIdx); | 2170 this->setTextureUnit(unitIdx); |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2715 this->setVertexArrayID(gpu, 0); | 2724 this->setVertexArrayID(gpu, 0); |
| 2716 } | 2725 } |
| 2717 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2726 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2718 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2727 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2719 fDefaultVertexArrayAttribState.resize(attrCount); | 2728 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2720 } | 2729 } |
| 2721 attribState = &fDefaultVertexArrayAttribState; | 2730 attribState = &fDefaultVertexArrayAttribState; |
| 2722 } | 2731 } |
| 2723 return attribState; | 2732 return attribState; |
| 2724 } | 2733 } |
| OLD | NEW |