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 "gl/GrGLInterface.h" | 9 #include "gl/GrGLInterface.h" |
10 #include "gl/GrGLExtensions.h" | 10 #include "gl/GrGLExtensions.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 const GrGLInterface* GrGLInterfaceAddTestDebugMarker(const GrGLInterface* interf
ace, | 21 const GrGLInterface* GrGLInterfaceAddTestDebugMarker(const GrGLInterface* interf
ace, |
22 GrGLInsertEventMarkerProc i
nsertEventMarkerFn, | 22 GrGLInsertEventMarkerProc i
nsertEventMarkerFn, |
23 GrGLPushGroupMarkerProc pus
hGroupMarkerFn, | 23 GrGLPushGroupMarkerProc pus
hGroupMarkerFn, |
24 GrGLPopGroupMarkerProc popG
roupMarkerFn) { | 24 GrGLPopGroupMarkerProc popG
roupMarkerFn) { |
25 GrGLInterface* newInterface = GrGLInterface::NewClone(interface); | 25 GrGLInterface* newInterface = GrGLInterface::NewClone(interface); |
26 | 26 |
27 if (!newInterface->fExtensions.has("GL_EXT_debug_marker")) { | 27 if (!newInterface->fExtensions.has("GL_EXT_debug_marker")) { |
28 newInterface->fExtensions.add("GL_EXT_debug_marker"); | 28 newInterface->fExtensions.add("GL_EXT_debug_marker"); |
29 } | 29 } |
30 | 30 |
31 newInterface->fInsertEventMarker = insertEventMarkerFn; | 31 newInterface->fFunctions.fInsertEventMarker = insertEventMarkerFn; |
32 newInterface->fPushGroupMarker = pushGroupMarkerFn; | 32 newInterface->fFunctions.fPushGroupMarker = pushGroupMarkerFn; |
33 newInterface->fPopGroupMarker = popGroupMarkerFn; | 33 newInterface->fFunctions.fPopGroupMarker = popGroupMarkerFn; |
34 | 34 |
35 return newInterface; | 35 return newInterface; |
36 } | 36 } |
37 | 37 |
38 const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) { | 38 const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) { |
39 GrGLInterface* newInterface = GrGLInterface::NewClone(interface); | 39 GrGLInterface* newInterface = GrGLInterface::NewClone(interface); |
40 | 40 |
41 newInterface->fExtensions.remove("GL_NV_path_rendering"); | 41 newInterface->fExtensions.remove("GL_NV_path_rendering"); |
42 | 42 |
43 newInterface->fPathCommands = NULL; | 43 newInterface->fFunctions.fPathCommands = NULL; |
44 newInterface->fPathCoords = NULL; | 44 newInterface->fFunctions.fPathCoords = NULL; |
45 newInterface->fPathSubCommands = NULL; | 45 newInterface->fFunctions.fPathSubCommands = NULL; |
46 newInterface->fPathSubCoords = NULL; | 46 newInterface->fFunctions.fPathSubCoords = NULL; |
47 newInterface->fPathString = NULL; | 47 newInterface->fFunctions.fPathString = NULL; |
48 newInterface->fPathGlyphs = NULL; | 48 newInterface->fFunctions.fPathGlyphs = NULL; |
49 newInterface->fPathGlyphRange = NULL; | 49 newInterface->fFunctions.fPathGlyphRange = NULL; |
50 newInterface->fWeightPaths = NULL; | 50 newInterface->fFunctions.fWeightPaths = NULL; |
51 newInterface->fCopyPath = NULL; | 51 newInterface->fFunctions.fCopyPath = NULL; |
52 newInterface->fInterpolatePaths = NULL; | 52 newInterface->fFunctions.fInterpolatePaths = NULL; |
53 newInterface->fTransformPath = NULL; | 53 newInterface->fFunctions.fTransformPath = NULL; |
54 newInterface->fPathParameteriv = NULL; | 54 newInterface->fFunctions.fPathParameteriv = NULL; |
55 newInterface->fPathParameteri = NULL; | 55 newInterface->fFunctions.fPathParameteri = NULL; |
56 newInterface->fPathParameterfv = NULL; | 56 newInterface->fFunctions.fPathParameterfv = NULL; |
57 newInterface->fPathParameterf = NULL; | 57 newInterface->fFunctions.fPathParameterf = NULL; |
58 newInterface->fPathDashArray = NULL; | 58 newInterface->fFunctions.fPathDashArray = NULL; |
59 newInterface->fGenPaths = NULL; | 59 newInterface->fFunctions.fGenPaths = NULL; |
60 newInterface->fDeletePaths = NULL; | 60 newInterface->fFunctions.fDeletePaths = NULL; |
61 newInterface->fIsPath = NULL; | 61 newInterface->fFunctions.fIsPath = NULL; |
62 newInterface->fPathStencilFunc = NULL; | 62 newInterface->fFunctions.fPathStencilFunc = NULL; |
63 newInterface->fPathStencilDepthOffset = NULL; | 63 newInterface->fFunctions.fPathStencilDepthOffset = NULL; |
64 newInterface->fStencilFillPath = NULL; | 64 newInterface->fFunctions.fStencilFillPath = NULL; |
65 newInterface->fStencilStrokePath = NULL; | 65 newInterface->fFunctions.fStencilStrokePath = NULL; |
66 newInterface->fStencilFillPathInstanced = NULL; | 66 newInterface->fFunctions.fStencilFillPathInstanced = NULL; |
67 newInterface->fStencilStrokePathInstanced = NULL; | 67 newInterface->fFunctions.fStencilStrokePathInstanced = NULL; |
68 newInterface->fPathCoverDepthFunc = NULL; | 68 newInterface->fFunctions.fPathCoverDepthFunc = NULL; |
69 newInterface->fPathColorGen = NULL; | 69 newInterface->fFunctions.fPathColorGen = NULL; |
70 newInterface->fPathTexGen = NULL; | 70 newInterface->fFunctions.fPathTexGen = NULL; |
71 newInterface->fPathFogGen = NULL; | 71 newInterface->fFunctions.fPathFogGen = NULL; |
72 newInterface->fCoverFillPath = NULL; | 72 newInterface->fFunctions.fCoverFillPath = NULL; |
73 newInterface->fCoverStrokePath = NULL; | 73 newInterface->fFunctions.fCoverStrokePath = NULL; |
74 newInterface->fCoverFillPathInstanced = NULL; | 74 newInterface->fFunctions.fCoverFillPathInstanced = NULL; |
75 newInterface->fCoverStrokePathInstanced = NULL; | 75 newInterface->fFunctions.fCoverStrokePathInstanced = NULL; |
76 newInterface->fGetPathParameteriv = NULL; | 76 newInterface->fFunctions.fGetPathParameteriv = NULL; |
77 newInterface->fGetPathParameterfv = NULL; | 77 newInterface->fFunctions.fGetPathParameterfv = NULL; |
78 newInterface->fGetPathCommands = NULL; | 78 newInterface->fFunctions.fGetPathCommands = NULL; |
79 newInterface->fGetPathCoords = NULL; | 79 newInterface->fFunctions.fGetPathCoords = NULL; |
80 newInterface->fGetPathDashArray = NULL; | 80 newInterface->fFunctions.fGetPathDashArray = NULL; |
81 newInterface->fGetPathMetrics = NULL; | 81 newInterface->fFunctions.fGetPathMetrics = NULL; |
82 newInterface->fGetPathMetricRange = NULL; | 82 newInterface->fFunctions.fGetPathMetricRange = NULL; |
83 newInterface->fGetPathSpacing = NULL; | 83 newInterface->fFunctions.fGetPathSpacing = NULL; |
84 newInterface->fGetPathColorGeniv = NULL; | 84 newInterface->fFunctions.fGetPathColorGeniv = NULL; |
85 newInterface->fGetPathColorGenfv = NULL; | 85 newInterface->fFunctions.fGetPathColorGenfv = NULL; |
86 newInterface->fGetPathTexGeniv = NULL; | 86 newInterface->fFunctions.fGetPathTexGeniv = NULL; |
87 newInterface->fGetPathTexGenfv = NULL; | 87 newInterface->fFunctions.fGetPathTexGenfv = NULL; |
88 newInterface->fIsPointInFillPath = NULL; | 88 newInterface->fFunctions.fIsPointInFillPath = NULL; |
89 newInterface->fIsPointInStrokePath = NULL; | 89 newInterface->fFunctions.fIsPointInStrokePath = NULL; |
90 newInterface->fGetPathLength = NULL; | 90 newInterface->fFunctions.fGetPathLength = NULL; |
91 newInterface->fPointAlongPath = NULL; | 91 newInterface->fFunctions.fPointAlongPath = NULL; |
92 | 92 |
93 return newInterface; | 93 return newInterface; |
94 } | 94 } |
95 | 95 |
96 GrGLInterface::GrGLInterface() | 96 GrGLInterface::GrGLInterface() { |
97 // TODO: Remove this madness ASAP. | |
98 : fActiveTexture(&fFunctions.fActiveTexture) | |
99 , fAttachShader(&fFunctions.fAttachShader) | |
100 , fBeginQuery(&fFunctions.fBeginQuery) | |
101 , fBindAttribLocation(&fFunctions.fBindAttribLocation) | |
102 , fBindBuffer(&fFunctions.fBindBuffer) | |
103 , fBindFragDataLocation(&fFunctions.fBindFragDataLocation) | |
104 , fBindFragDataLocationIndexed(&fFunctions.fBindFragDataLocationIndexed) | |
105 , fBindFramebuffer(&fFunctions.fBindFramebuffer) | |
106 , fBindRenderbuffer(&fFunctions.fBindRenderbuffer) | |
107 , fBindTexture(&fFunctions.fBindTexture) | |
108 , fBindVertexArray(&fFunctions.fBindVertexArray) | |
109 , fBlendColor(&fFunctions.fBlendColor) | |
110 , fBlendFunc(&fFunctions.fBlendFunc) | |
111 , fBlitFramebuffer(&fFunctions.fBlitFramebuffer) | |
112 , fBufferData(&fFunctions.fBufferData) | |
113 , fBufferSubData(&fFunctions.fBufferSubData) | |
114 , fCheckFramebufferStatus(&fFunctions.fCheckFramebufferStatus) | |
115 , fClear(&fFunctions.fClear) | |
116 , fClearColor(&fFunctions.fClearColor) | |
117 , fClearStencil(&fFunctions.fClearStencil) | |
118 , fColorMask(&fFunctions.fColorMask) | |
119 , fCompileShader(&fFunctions.fCompileShader) | |
120 , fCompressedTexImage2D(&fFunctions.fCompressedTexImage2D) | |
121 , fCopyTexSubImage2D(&fFunctions.fCopyTexSubImage2D) | |
122 , fCreateProgram(&fFunctions.fCreateProgram) | |
123 , fCreateShader(&fFunctions.fCreateShader) | |
124 , fCullFace(&fFunctions.fCullFace) | |
125 , fDeleteBuffers(&fFunctions.fDeleteBuffers) | |
126 , fDeleteFramebuffers(&fFunctions.fDeleteFramebuffers) | |
127 , fDeleteProgram(&fFunctions.fDeleteProgram) | |
128 , fDeleteQueries(&fFunctions.fDeleteQueries) | |
129 , fDeleteRenderbuffers(&fFunctions.fDeleteRenderbuffers) | |
130 , fDeleteShader(&fFunctions.fDeleteShader) | |
131 , fDeleteTextures(&fFunctions.fDeleteTextures) | |
132 , fDeleteVertexArrays(&fFunctions.fDeleteVertexArrays) | |
133 , fDepthMask(&fFunctions.fDepthMask) | |
134 , fDisable(&fFunctions.fDisable) | |
135 , fDisableVertexAttribArray(&fFunctions.fDisableVertexAttribArray) | |
136 , fDrawArrays(&fFunctions.fDrawArrays) | |
137 , fDrawBuffer(&fFunctions.fDrawBuffer) | |
138 , fDrawBuffers(&fFunctions.fDrawBuffers) | |
139 , fDrawElements(&fFunctions.fDrawElements) | |
140 , fEnable(&fFunctions.fEnable) | |
141 , fEnableVertexAttribArray(&fFunctions.fEnableVertexAttribArray) | |
142 , fEndQuery(&fFunctions.fEndQuery) | |
143 , fFinish(&fFunctions.fFinish) | |
144 , fFlush(&fFunctions.fFlush) | |
145 , fFramebufferRenderbuffer(&fFunctions.fFramebufferRenderbuffer) | |
146 , fFramebufferTexture2D(&fFunctions.fFramebufferTexture2D) | |
147 , fFramebufferTexture2DMultisample(&fFunctions.fFramebufferTexture2DMultisam
ple) | |
148 , fFrontFace(&fFunctions.fFrontFace) | |
149 , fGenBuffers(&fFunctions.fGenBuffers) | |
150 , fGenFramebuffers(&fFunctions.fGenFramebuffers) | |
151 , fGenerateMipmap(&fFunctions.fGenerateMipmap) | |
152 , fGenQueries(&fFunctions.fGenQueries) | |
153 , fGenRenderbuffers(&fFunctions.fGenRenderbuffers) | |
154 , fGenTextures(&fFunctions.fGenTextures) | |
155 , fGenVertexArrays(&fFunctions.fGenVertexArrays) | |
156 , fGetBufferParameteriv(&fFunctions.fGetBufferParameteriv) | |
157 , fGetError(&fFunctions.fGetError) | |
158 , fGetFramebufferAttachmentParameteriv(&fFunctions.fGetFramebufferAttachment
Parameteriv) | |
159 , fGetIntegerv(&fFunctions.fGetIntegerv) | |
160 , fGetQueryObjecti64v(&fFunctions.fGetQueryObjecti64v) | |
161 , fGetQueryObjectiv(&fFunctions.fGetQueryObjectiv) | |
162 , fGetQueryObjectui64v(&fFunctions.fGetQueryObjectui64v) | |
163 , fGetQueryObjectuiv(&fFunctions.fGetQueryObjectuiv) | |
164 , fGetQueryiv(&fFunctions.fGetQueryiv) | |
165 , fGetProgramInfoLog(&fFunctions.fGetProgramInfoLog) | |
166 , fGetProgramiv(&fFunctions.fGetProgramiv) | |
167 , fGetRenderbufferParameteriv(&fFunctions.fGetRenderbufferParameteriv) | |
168 , fGetShaderInfoLog(&fFunctions.fGetShaderInfoLog) | |
169 , fGetShaderiv(&fFunctions.fGetShaderiv) | |
170 , fGetString(&fFunctions.fGetString) | |
171 , fGetStringi(&fFunctions.fGetStringi) | |
172 , fGetTexLevelParameteriv(&fFunctions.fGetTexLevelParameteriv) | |
173 , fGetUniformLocation(&fFunctions.fGetUniformLocation) | |
174 , fInsertEventMarker(&fFunctions.fInsertEventMarker) | |
175 , fLineWidth(&fFunctions.fLineWidth) | |
176 , fLinkProgram(&fFunctions.fLinkProgram) | |
177 , fLoadIdentity(&fFunctions.fLoadIdentity) | |
178 , fLoadMatrixf(&fFunctions.fLoadMatrixf) | |
179 , fMapBuffer(&fFunctions.fMapBuffer) | |
180 , fMatrixMode(&fFunctions.fMatrixMode) | |
181 , fPixelStorei(&fFunctions.fPixelStorei) | |
182 , fPopGroupMarker(&fFunctions.fPopGroupMarker) | |
183 , fPushGroupMarker(&fFunctions.fPushGroupMarker) | |
184 , fQueryCounter(&fFunctions.fQueryCounter) | |
185 , fReadBuffer(&fFunctions.fReadBuffer) | |
186 , fReadPixels(&fFunctions.fReadPixels) | |
187 , fRenderbufferStorage(&fFunctions.fRenderbufferStorage) | |
188 , fRenderbufferStorageMultisampleES2EXT(&fFunctions.fRenderbufferStorageMult
isampleES2EXT) | |
189 , fRenderbufferStorageMultisampleES2APPLE(&fFunctions.fRenderbufferStorageMu
ltisampleES2APPLE) | |
190 , fRenderbufferStorageMultisample(&fFunctions.fRenderbufferStorageMultisampl
e) | |
191 , fBindUniformLocation(&fFunctions.fBindUniformLocation) | |
192 , fResolveMultisampleFramebuffer(&fFunctions.fResolveMultisampleFramebuffer) | |
193 , fScissor(&fFunctions.fScissor) | |
194 , fShaderSource(&fFunctions.fShaderSource) | |
195 , fStencilFunc(&fFunctions.fStencilFunc) | |
196 , fStencilFuncSeparate(&fFunctions.fStencilFuncSeparate) | |
197 , fStencilMask(&fFunctions.fStencilMask) | |
198 , fStencilMaskSeparate(&fFunctions.fStencilMaskSeparate) | |
199 , fStencilOp(&fFunctions.fStencilOp) | |
200 , fStencilOpSeparate(&fFunctions.fStencilOpSeparate) | |
201 , fTexGenfv(&fFunctions.fTexGenfv) | |
202 , fTexGeni(&fFunctions.fTexGeni) | |
203 , fTexImage2D(&fFunctions.fTexImage2D) | |
204 , fTexParameteri(&fFunctions.fTexParameteri) | |
205 , fTexParameteriv(&fFunctions.fTexParameteriv) | |
206 , fTexSubImage2D(&fFunctions.fTexSubImage2D) | |
207 , fTexStorage2D(&fFunctions.fTexStorage2D) | |
208 , fDiscardFramebuffer(&fFunctions.fDiscardFramebuffer) | |
209 , fUniform1f(&fFunctions.fUniform1f) | |
210 , fUniform1i(&fFunctions.fUniform1i) | |
211 , fUniform1fv(&fFunctions.fUniform1fv) | |
212 , fUniform1iv(&fFunctions.fUniform1iv) | |
213 , fUniform2f(&fFunctions.fUniform2f) | |
214 , fUniform2i(&fFunctions.fUniform2i) | |
215 , fUniform2fv(&fFunctions.fUniform2fv) | |
216 , fUniform2iv(&fFunctions.fUniform2iv) | |
217 , fUniform3f(&fFunctions.fUniform3f) | |
218 , fUniform3i(&fFunctions.fUniform3i) | |
219 , fUniform3fv(&fFunctions.fUniform3fv) | |
220 , fUniform3iv(&fFunctions.fUniform3iv) | |
221 , fUniform4f(&fFunctions.fUniform4f) | |
222 , fUniform4i(&fFunctions.fUniform4i) | |
223 , fUniform4fv(&fFunctions.fUniform4fv) | |
224 , fUniform4iv(&fFunctions.fUniform4iv) | |
225 , fUniformMatrix2fv(&fFunctions.fUniformMatrix2fv) | |
226 , fUniformMatrix3fv(&fFunctions.fUniformMatrix3fv) | |
227 , fUniformMatrix4fv(&fFunctions.fUniformMatrix4fv) | |
228 , fUnmapBuffer(&fFunctions.fUnmapBuffer) | |
229 , fUseProgram(&fFunctions.fUseProgram) | |
230 , fVertexAttrib4fv(&fFunctions.fVertexAttrib4fv) | |
231 , fVertexAttribPointer(&fFunctions.fVertexAttribPointer) | |
232 , fViewport(&fFunctions.fViewport) | |
233 , fPathCommands(&fFunctions.fPathCommands) | |
234 , fPathCoords(&fFunctions.fPathCoords) | |
235 , fPathSubCommands(&fFunctions.fPathSubCommands) | |
236 , fPathSubCoords(&fFunctions.fPathSubCoords) | |
237 , fPathString(&fFunctions.fPathString) | |
238 , fPathGlyphs(&fFunctions.fPathGlyphs) | |
239 , fPathGlyphRange(&fFunctions.fPathGlyphRange) | |
240 , fWeightPaths(&fFunctions.fWeightPaths) | |
241 , fCopyPath(&fFunctions.fCopyPath) | |
242 , fInterpolatePaths(&fFunctions.fInterpolatePaths) | |
243 , fTransformPath(&fFunctions.fTransformPath) | |
244 , fPathParameteriv(&fFunctions.fPathParameteriv) | |
245 , fPathParameteri(&fFunctions.fPathParameteri) | |
246 , fPathParameterfv(&fFunctions.fPathParameterfv) | |
247 , fPathParameterf(&fFunctions.fPathParameterf) | |
248 , fPathDashArray(&fFunctions.fPathDashArray) | |
249 , fGenPaths(&fFunctions.fGenPaths) | |
250 , fDeletePaths(&fFunctions.fDeletePaths) | |
251 , fIsPath(&fFunctions.fIsPath) | |
252 , fPathStencilFunc(&fFunctions.fPathStencilFunc) | |
253 , fPathStencilDepthOffset(&fFunctions.fPathStencilDepthOffset) | |
254 , fStencilFillPath(&fFunctions.fStencilFillPath) | |
255 , fStencilStrokePath(&fFunctions.fStencilStrokePath) | |
256 , fStencilFillPathInstanced(&fFunctions.fStencilFillPathInstanced) | |
257 , fStencilStrokePathInstanced(&fFunctions.fStencilStrokePathInstanced) | |
258 , fPathCoverDepthFunc(&fFunctions.fPathCoverDepthFunc) | |
259 , fPathColorGen(&fFunctions.fPathColorGen) | |
260 , fPathTexGen(&fFunctions.fPathTexGen) | |
261 , fPathFogGen(&fFunctions.fPathFogGen) | |
262 , fCoverFillPath(&fFunctions.fCoverFillPath) | |
263 , fCoverStrokePath(&fFunctions.fCoverStrokePath) | |
264 , fCoverFillPathInstanced(&fFunctions.fCoverFillPathInstanced) | |
265 , fCoverStrokePathInstanced(&fFunctions.fCoverStrokePathInstanced) | |
266 , fGetPathParameteriv(&fFunctions.fGetPathParameteriv) | |
267 , fGetPathParameterfv(&fFunctions.fGetPathParameterfv) | |
268 , fGetPathCommands(&fFunctions.fGetPathCommands) | |
269 , fGetPathCoords(&fFunctions.fGetPathCoords) | |
270 , fGetPathDashArray(&fFunctions.fGetPathDashArray) | |
271 , fGetPathMetrics(&fFunctions.fGetPathMetrics) | |
272 , fGetPathMetricRange(&fFunctions.fGetPathMetricRange) | |
273 , fGetPathSpacing(&fFunctions.fGetPathSpacing) | |
274 , fGetPathColorGeniv(&fFunctions.fGetPathColorGeniv) | |
275 , fGetPathColorGenfv(&fFunctions.fGetPathColorGenfv) | |
276 , fGetPathTexGeniv(&fFunctions.fGetPathTexGeniv) | |
277 , fGetPathTexGenfv(&fFunctions.fGetPathTexGenfv) | |
278 , fIsPointInFillPath(&fFunctions.fIsPointInFillPath) | |
279 , fIsPointInStrokePath(&fFunctions.fIsPointInStrokePath) | |
280 , fGetPathLength(&fFunctions.fGetPathLength) | |
281 , fPointAlongPath(&fFunctions.fPointAlongPath) { | |
282 fStandard = kNone_GrGLStandard; | 97 fStandard = kNone_GrGLStandard; |
283 | 98 |
284 #if GR_GL_PER_GL_FUNC_CALLBACK | 99 #if GR_GL_PER_GL_FUNC_CALLBACK |
285 fCallback = GrGLDefaultInterfaceCallback; | 100 fCallback = GrGLDefaultInterfaceCallback; |
286 fCallbackData = 0; | 101 fCallbackData = 0; |
287 #endif | 102 #endif |
288 } | 103 } |
289 | 104 |
290 GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) { | 105 GrGLInterface* GrGLInterface::NewClone(const GrGLInterface* interface) { |
291 SkASSERT(NULL != interface); | 106 SkASSERT(NULL != interface); |
292 | 107 |
293 GrGLInterface* clone = SkNEW(GrGLInterface); | 108 GrGLInterface* clone = SkNEW(GrGLInterface); |
294 clone->fStandard = interface->fStandard; | 109 clone->fStandard = interface->fStandard; |
295 clone->fExtensions = interface->fExtensions; | 110 clone->fExtensions = interface->fExtensions; |
296 clone->fFunctions = interface->fFunctions; | 111 clone->fFunctions = interface->fFunctions; |
297 #if GR_GL_PER_GL_FUNC_CALLBACK | 112 #if GR_GL_PER_GL_FUNC_CALLBACK |
298 clone->fCallback = interface->fCallback; | 113 clone->fCallback = interface->fCallback; |
299 clone->fCallbackData = interface->fCallbackData; | 114 clone->fCallbackData = interface->fCallbackData; |
300 #endif | 115 #endif |
301 return clone; | 116 return clone; |
302 } | 117 } |
303 | 118 |
304 bool GrGLInterface::validate() const { | 119 bool GrGLInterface::validate() const { |
305 | 120 |
306 if (kNone_GrGLStandard == fStandard) { | 121 if (kNone_GrGLStandard == fStandard) { |
307 return false; | 122 return false; |
308 } | 123 } |
309 | 124 |
310 // This const hackery is necessary because the factories in Chromium do not
yet initialize | |
311 // fExtensions. | |
312 if (!fExtensions.isInitialized()) { | 125 if (!fExtensions.isInitialized()) { |
313 GrGLExtensions* extensions = const_cast<GrGLExtensions*>(&fExtensions); | 126 return false; |
314 if (!extensions->init(fStandard, fFunctions.fGetString, fFunctions.fGetS
tringi, | |
315 fFunctions.fGetIntegerv)) { | |
316 return false; | |
317 } | |
318 } | 127 } |
319 | 128 |
320 // functions that are always required | 129 // functions that are always required |
321 if (NULL == fFunctions.fActiveTexture || | 130 if (NULL == fFunctions.fActiveTexture || |
322 NULL == fFunctions.fAttachShader || | 131 NULL == fFunctions.fAttachShader || |
323 NULL == fFunctions.fBindAttribLocation || | 132 NULL == fFunctions.fBindAttribLocation || |
324 NULL == fFunctions.fBindBuffer || | 133 NULL == fFunctions.fBindBuffer || |
325 NULL == fFunctions.fBindTexture || | 134 NULL == fFunctions.fBindTexture || |
326 NULL == fFunctions.fBlendFunc || | 135 NULL == fFunctions.fBlendFunc || |
327 NULL == fFunctions.fBlendColor || // -> GL >= 1.4, ES >= 2.0 or ext
ension | 136 NULL == fFunctions.fBlendColor || // -> GL >= 1.4, ES >= 2.0 or ext
ension |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 if (fExtensions.has("GL_EXT_debug_marker")) { | 479 if (fExtensions.has("GL_EXT_debug_marker")) { |
671 if (NULL == fFunctions.fInsertEventMarker || | 480 if (NULL == fFunctions.fInsertEventMarker || |
672 NULL == fFunctions.fPushGroupMarker || | 481 NULL == fFunctions.fPushGroupMarker || |
673 NULL == fFunctions.fPopGroupMarker) { | 482 NULL == fFunctions.fPopGroupMarker) { |
674 return false; | 483 return false; |
675 } | 484 } |
676 } | 485 } |
677 #endif | 486 #endif |
678 return true; | 487 return true; |
679 } | 488 } |
OLD | NEW |