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

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

Issue 216503004: SK_SUPPORT_LEGACY_GRTYPES to hide duplicate types from SkTypes.h (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« include/gpu/GrPoint.h ('K') | « src/gpu/gl/GrGLStencilBuffer.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 "GrGLStencilBuffer.h" 10 #include "GrGLStencilBuffer.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 true, 74 true,
75 75
76 // extended blend coeffs 76 // extended blend coeffs
77 false, 77 false,
78 false, 78 false,
79 false, 79 false,
80 false, 80 false,
81 }; 81 };
82 return gCoeffReferencesBlendConst[coeff]; 82 return gCoeffReferencesBlendConst[coeff];
83 GR_STATIC_ASSERT(kTotalGrBlendCoeffCount == 83 GR_STATIC_ASSERT(kTotalGrBlendCoeffCount ==
84 GR_ARRAY_COUNT(gCoeffReferencesBlendConst)); 84 SK_ARRAY_COUNT(gCoeffReferencesBlendConst));
85 85
86 GR_STATIC_ASSERT(0 == kZero_GrBlendCoeff); 86 GR_STATIC_ASSERT(0 == kZero_GrBlendCoeff);
87 GR_STATIC_ASSERT(1 == kOne_GrBlendCoeff); 87 GR_STATIC_ASSERT(1 == kOne_GrBlendCoeff);
88 GR_STATIC_ASSERT(2 == kSC_GrBlendCoeff); 88 GR_STATIC_ASSERT(2 == kSC_GrBlendCoeff);
89 GR_STATIC_ASSERT(3 == kISC_GrBlendCoeff); 89 GR_STATIC_ASSERT(3 == kISC_GrBlendCoeff);
90 GR_STATIC_ASSERT(4 == kDC_GrBlendCoeff); 90 GR_STATIC_ASSERT(4 == kDC_GrBlendCoeff);
91 GR_STATIC_ASSERT(5 == kIDC_GrBlendCoeff); 91 GR_STATIC_ASSERT(5 == kIDC_GrBlendCoeff);
92 GR_STATIC_ASSERT(6 == kSA_GrBlendCoeff); 92 GR_STATIC_ASSERT(6 == kSA_GrBlendCoeff);
93 GR_STATIC_ASSERT(7 == kISA_GrBlendCoeff); 93 GR_STATIC_ASSERT(7 == kISA_GrBlendCoeff);
94 GR_STATIC_ASSERT(8 == kDA_GrBlendCoeff); 94 GR_STATIC_ASSERT(8 == kDA_GrBlendCoeff);
95 GR_STATIC_ASSERT(9 == kIDA_GrBlendCoeff); 95 GR_STATIC_ASSERT(9 == kIDA_GrBlendCoeff);
96 GR_STATIC_ASSERT(10 == kConstC_GrBlendCoeff); 96 GR_STATIC_ASSERT(10 == kConstC_GrBlendCoeff);
97 GR_STATIC_ASSERT(11 == kIConstC_GrBlendCoeff); 97 GR_STATIC_ASSERT(11 == kIConstC_GrBlendCoeff);
98 GR_STATIC_ASSERT(12 == kConstA_GrBlendCoeff); 98 GR_STATIC_ASSERT(12 == kConstA_GrBlendCoeff);
99 GR_STATIC_ASSERT(13 == kIConstA_GrBlendCoeff); 99 GR_STATIC_ASSERT(13 == kIConstA_GrBlendCoeff);
100 100
101 GR_STATIC_ASSERT(14 == kS2C_GrBlendCoeff); 101 GR_STATIC_ASSERT(14 == kS2C_GrBlendCoeff);
102 GR_STATIC_ASSERT(15 == kIS2C_GrBlendCoeff); 102 GR_STATIC_ASSERT(15 == kIS2C_GrBlendCoeff);
103 GR_STATIC_ASSERT(16 == kS2A_GrBlendCoeff); 103 GR_STATIC_ASSERT(16 == kS2A_GrBlendCoeff);
104 GR_STATIC_ASSERT(17 == kIS2A_GrBlendCoeff); 104 GR_STATIC_ASSERT(17 == kIS2A_GrBlendCoeff);
105 105
106 // assertion for gXfermodeCoeff2Blend have to be in GrGpu scope 106 // assertion for gXfermodeCoeff2Blend have to be in GrGpu scope
107 GR_STATIC_ASSERT(kTotalGrBlendCoeffCount == 107 GR_STATIC_ASSERT(kTotalGrBlendCoeffCount ==
108 GR_ARRAY_COUNT(gXfermodeCoeff2Blend)); 108 SK_ARRAY_COUNT(gXfermodeCoeff2Blend));
109 } 109 }
110 110
111 /////////////////////////////////////////////////////////////////////////////// 111 ///////////////////////////////////////////////////////////////////////////////
112 112
113 static bool gPrintStartupSpew; 113 static bool gPrintStartupSpew;
114 114
115 GrGpuGL::GrGpuGL(const GrGLContext& ctx, GrContext* context) 115 GrGpuGL::GrGpuGL(const GrGLContext& ctx, GrContext* context)
116 : GrGpu(context) 116 : GrGpu(context)
117 , fGLContext(ctx) { 117 , fGLContext(ctx) {
118 118
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 GrGLRenderTarget::Desc glRTDesc; 872 GrGLRenderTarget::Desc glRTDesc;
873 873
874 // Attempt to catch un- or wrongly initialized sample counts; 874 // Attempt to catch un- or wrongly initialized sample counts;
875 SkASSERT(desc.fSampleCnt >= 0 && desc.fSampleCnt <= 64); 875 SkASSERT(desc.fSampleCnt >= 0 && desc.fSampleCnt <= 64);
876 // We fail if the MSAA was requested and is not available. 876 // We fail if the MSAA was requested and is not available.
877 if (GrGLCaps::kNone_MSFBOType == this->glCaps().msFBOType() && desc.fSampleC nt) { 877 if (GrGLCaps::kNone_MSFBOType == this->glCaps().msFBOType() && desc.fSampleC nt) {
878 //GrPrintf("MSAA RT requested but not supported on this platform."); 878 //GrPrintf("MSAA RT requested but not supported on this platform.");
879 return return_null_texture(); 879 return return_null_texture();
880 } 880 }
881 // If the sample count exceeds the max then we clamp it. 881 // If the sample count exceeds the max then we clamp it.
882 glTexDesc.fSampleCnt = GrMin(desc.fSampleCnt, this->caps()->maxSampleCount() ); 882 glTexDesc.fSampleCnt = SkTMin(desc.fSampleCnt, this->caps()->maxSampleCount( ));
883 883
884 glTexDesc.fFlags = desc.fFlags; 884 glTexDesc.fFlags = desc.fFlags;
885 glTexDesc.fWidth = desc.fWidth; 885 glTexDesc.fWidth = desc.fWidth;
886 glTexDesc.fHeight = desc.fHeight; 886 glTexDesc.fHeight = desc.fHeight;
887 glTexDesc.fConfig = desc.fConfig; 887 glTexDesc.fConfig = desc.fConfig;
888 glTexDesc.fIsWrapped = false; 888 glTexDesc.fIsWrapped = false;
889 889
890 glRTDesc.fMSColorRenderbufferID = 0; 890 glRTDesc.fMSColorRenderbufferID = 0;
891 glRTDesc.fRTFBOID = 0; 891 glRTDesc.fRTFBOID = 0;
892 glRTDesc.fTexFBOID = 0; 892 glRTDesc.fTexFBOID = 0;
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT); 1572 hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
1573 } 1573 }
1574 } 1574 }
1575 #endif 1575 #endif
1576 #endif 1576 #endif
1577 1577
1578 void GrGpuGL::onGpuDraw(const DrawInfo& info) { 1578 void GrGpuGL::onGpuDraw(const DrawInfo& info) {
1579 size_t indexOffsetInBytes; 1579 size_t indexOffsetInBytes;
1580 this->setupGeometry(info, &indexOffsetInBytes); 1580 this->setupGeometry(info, &indexOffsetInBytes);
1581 1581
1582 SkASSERT((size_t)info.primitiveType() < GR_ARRAY_COUNT(gPrimitiveType2GLMode )); 1582 SkASSERT((size_t)info.primitiveType() < SK_ARRAY_COUNT(gPrimitiveType2GLMode ));
1583 1583
1584 if (info.isIndexed()) { 1584 if (info.isIndexed()) {
1585 GrGLvoid* indices = 1585 GrGLvoid* indices =
1586 reinterpret_cast<GrGLvoid*>(indexOffsetInBytes + sizeof(uint16_t) * info.startIndex()); 1586 reinterpret_cast<GrGLvoid*>(indexOffsetInBytes + sizeof(uint16_t) * info.startIndex());
1587 // info.startVertex() was accounted for by setupGeometry. 1587 // info.startVertex() was accounted for by setupGeometry.
1588 GL_CALL(DrawElements(gPrimitiveType2GLMode[info.primitiveType()], 1588 GL_CALL(DrawElements(gPrimitiveType2GLMode[info.primitiveType()],
1589 info.indexCount(), 1589 info.indexCount(),
1590 GR_GL_UNSIGNED_SHORT, 1590 GR_GL_UNSIGNED_SHORT,
1591 indices)); 1591 indices));
1592 } else { 1592 } else {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1833 static const GrGLenum gTable[] = { 1833 static const GrGLenum gTable[] = {
1834 GR_GL_ALWAYS, // kAlways_StencilFunc 1834 GR_GL_ALWAYS, // kAlways_StencilFunc
1835 GR_GL_NEVER, // kNever_StencilFunc 1835 GR_GL_NEVER, // kNever_StencilFunc
1836 GR_GL_GREATER, // kGreater_StencilFunc 1836 GR_GL_GREATER, // kGreater_StencilFunc
1837 GR_GL_GEQUAL, // kGEqual_StencilFunc 1837 GR_GL_GEQUAL, // kGEqual_StencilFunc
1838 GR_GL_LESS, // kLess_StencilFunc 1838 GR_GL_LESS, // kLess_StencilFunc
1839 GR_GL_LEQUAL, // kLEqual_StencilFunc, 1839 GR_GL_LEQUAL, // kLEqual_StencilFunc,
1840 GR_GL_EQUAL, // kEqual_StencilFunc, 1840 GR_GL_EQUAL, // kEqual_StencilFunc,
1841 GR_GL_NOTEQUAL, // kNotEqual_StencilFunc, 1841 GR_GL_NOTEQUAL, // kNotEqual_StencilFunc,
1842 }; 1842 };
1843 GR_STATIC_ASSERT(GR_ARRAY_COUNT(gTable) == kBasicStencilFuncCount); 1843 GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kBasicStencilFuncCount);
1844 GR_STATIC_ASSERT(0 == kAlways_StencilFunc); 1844 GR_STATIC_ASSERT(0 == kAlways_StencilFunc);
1845 GR_STATIC_ASSERT(1 == kNever_StencilFunc); 1845 GR_STATIC_ASSERT(1 == kNever_StencilFunc);
1846 GR_STATIC_ASSERT(2 == kGreater_StencilFunc); 1846 GR_STATIC_ASSERT(2 == kGreater_StencilFunc);
1847 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc); 1847 GR_STATIC_ASSERT(3 == kGEqual_StencilFunc);
1848 GR_STATIC_ASSERT(4 == kLess_StencilFunc); 1848 GR_STATIC_ASSERT(4 == kLess_StencilFunc);
1849 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc); 1849 GR_STATIC_ASSERT(5 == kLEqual_StencilFunc);
1850 GR_STATIC_ASSERT(6 == kEqual_StencilFunc); 1850 GR_STATIC_ASSERT(6 == kEqual_StencilFunc);
1851 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc); 1851 GR_STATIC_ASSERT(7 == kNotEqual_StencilFunc);
1852 SkASSERT((unsigned) basicFunc < kBasicStencilFuncCount); 1852 SkASSERT((unsigned) basicFunc < kBasicStencilFuncCount);
1853 1853
1854 return gTable[basicFunc]; 1854 return gTable[basicFunc];
1855 } 1855 }
1856 1856
1857 GrGLenum gr_to_gl_stencil_op(GrStencilOp op) { 1857 GrGLenum gr_to_gl_stencil_op(GrStencilOp op) {
1858 static const GrGLenum gTable[] = { 1858 static const GrGLenum gTable[] = {
1859 GR_GL_KEEP, // kKeep_StencilOp 1859 GR_GL_KEEP, // kKeep_StencilOp
1860 GR_GL_REPLACE, // kReplace_StencilOp 1860 GR_GL_REPLACE, // kReplace_StencilOp
1861 GR_GL_INCR_WRAP, // kIncWrap_StencilOp 1861 GR_GL_INCR_WRAP, // kIncWrap_StencilOp
1862 GR_GL_INCR, // kIncClamp_StencilOp 1862 GR_GL_INCR, // kIncClamp_StencilOp
1863 GR_GL_DECR_WRAP, // kDecWrap_StencilOp 1863 GR_GL_DECR_WRAP, // kDecWrap_StencilOp
1864 GR_GL_DECR, // kDecClamp_StencilOp 1864 GR_GL_DECR, // kDecClamp_StencilOp
1865 GR_GL_ZERO, // kZero_StencilOp 1865 GR_GL_ZERO, // kZero_StencilOp
1866 GR_GL_INVERT, // kInvert_StencilOp 1866 GR_GL_INVERT, // kInvert_StencilOp
1867 }; 1867 };
1868 GR_STATIC_ASSERT(GR_ARRAY_COUNT(gTable) == kStencilOpCount); 1868 GR_STATIC_ASSERT(SK_ARRAY_COUNT(gTable) == kStencilOpCount);
1869 GR_STATIC_ASSERT(0 == kKeep_StencilOp); 1869 GR_STATIC_ASSERT(0 == kKeep_StencilOp);
1870 GR_STATIC_ASSERT(1 == kReplace_StencilOp); 1870 GR_STATIC_ASSERT(1 == kReplace_StencilOp);
1871 GR_STATIC_ASSERT(2 == kIncWrap_StencilOp); 1871 GR_STATIC_ASSERT(2 == kIncWrap_StencilOp);
1872 GR_STATIC_ASSERT(3 == kIncClamp_StencilOp); 1872 GR_STATIC_ASSERT(3 == kIncClamp_StencilOp);
1873 GR_STATIC_ASSERT(4 == kDecWrap_StencilOp); 1873 GR_STATIC_ASSERT(4 == kDecWrap_StencilOp);
1874 GR_STATIC_ASSERT(5 == kDecClamp_StencilOp); 1874 GR_STATIC_ASSERT(5 == kDecClamp_StencilOp);
1875 GR_STATIC_ASSERT(6 == kZero_StencilOp); 1875 GR_STATIC_ASSERT(6 == kZero_StencilOp);
1876 GR_STATIC_ASSERT(7 == kInvert_StencilOp); 1876 GR_STATIC_ASSERT(7 == kInvert_StencilOp);
1877 SkASSERT((unsigned) op < kStencilOpCount); 1877 SkASSERT((unsigned) op < kStencilOpCount);
1878 return gTable[op]; 1878 return gTable[op];
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
2789 this->setVertexArrayID(gpu, 0); 2789 this->setVertexArrayID(gpu, 0);
2790 } 2790 }
2791 int attrCount = gpu->glCaps().maxVertexAttributes(); 2791 int attrCount = gpu->glCaps().maxVertexAttributes();
2792 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2792 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2793 fDefaultVertexArrayAttribState.resize(attrCount); 2793 fDefaultVertexArrayAttribState.resize(attrCount);
2794 } 2794 }
2795 attribState = &fDefaultVertexArrayAttribState; 2795 attribState = &fDefaultVertexArrayAttribState;
2796 } 2796 }
2797 return attribState; 2797 return attribState;
2798 } 2798 }
OLDNEW
« include/gpu/GrPoint.h ('K') | « src/gpu/gl/GrGLStencilBuffer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698