1 /*
2  * Copyright 2013 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "GrGLNoOpInterface.h"
9 #include "SkString.h"
10 #include "SkThread.h"
11 
12 // the OpenGLES 2.0 spec says this must be >= 128
13 static const GrGLint kDefaultMaxVertexUniformVectors = 128;
14 
15 // the OpenGLES 2.0 spec says this must be >=16
16 static const GrGLint kDefaultMaxFragmentUniformVectors = 16;
17 
18 // the OpenGLES 2.0 spec says this must be >= 8
19 static const GrGLint kDefaultMaxVertexAttribs = 8;
20 
21 // the OpenGLES 2.0 spec says this must be >= 8
22 static const GrGLint kDefaultMaxVaryingVectors = 8;
23 
24 static const char* kExtensions[] = {
25     "GL_ARB_framebuffer_object",
26     "GL_ARB_blend_func_extended",
27     "GL_ARB_timer_query",
28     "GL_ARB_draw_buffers",
29     "GL_ARB_occlusion_query",
30     "GL_EXT_stencil_wrap"
31 };
32 
33 namespace {
combined_extensions_string()34 const GrGLubyte* combined_extensions_string() {
35     static SkString gExtString;
36     static SkMutex gMutex;
37     gMutex.acquire();
38     if (0 == gExtString.size()) {
39         for (size_t i = 0; i < SK_ARRAY_COUNT(kExtensions) - 1; ++i) {
40             gExtString.append(kExtensions[i]);
41             gExtString.append(" ");
42         }
43         gExtString.append(kExtensions[SK_ARRAY_COUNT(kExtensions) - 1]);
44     }
45     gMutex.release();
46     return (const GrGLubyte*) gExtString.c_str();
47 }
48 }
49 
noOpGLBindFragDataLocation(GrGLuint program,GrGLuint colorNumber,const GrGLchar * name)50 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBindFragDataLocation(GrGLuint program,
51                                                         GrGLuint colorNumber,
52                                                         const GrGLchar* name) {
53 }
54 
noOpGLBlendColor(GrGLclampf red,GrGLclampf green,GrGLclampf blue,GrGLclampf alpha)55 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlendColor(GrGLclampf red,
56                                               GrGLclampf green,
57                                               GrGLclampf blue,
58                                               GrGLclampf alpha) {
59 }
60 
noOpGLBlendEquation(GrGLenum mode)61 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlendEquation(GrGLenum mode) {
62 }
63 
noOpGLBlendFunc(GrGLenum sfactor,GrGLenum dfactor)64 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlendFunc(GrGLenum sfactor,
65                                               GrGLenum dfactor) {
66 }
67 
noOpGLBufferSubData(GrGLenum target,GrGLintptr offset,GrGLsizeiptr size,const GrGLvoid * data)68 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBufferSubData(GrGLenum target,
69                                                  GrGLintptr offset,
70                                                  GrGLsizeiptr size,
71                                                  const GrGLvoid* data) {
72 }
73 
noOpGLClear(GrGLbitfield mask)74 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLClear(GrGLbitfield mask) {
75 }
76 
noOpGLClearColor(GrGLclampf red,GrGLclampf green,GrGLclampf blue,GrGLclampf alpha)77 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLClearColor(GrGLclampf red,
78                                               GrGLclampf green,
79                                               GrGLclampf blue,
80                                               GrGLclampf alpha) {
81 }
82 
noOpGLClearStencil(GrGLint s)83 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLClearStencil(GrGLint s) {
84 }
85 
noOpGLColorMask(GrGLboolean red,GrGLboolean green,GrGLboolean blue,GrGLboolean alpha)86 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLColorMask(GrGLboolean red,
87                                              GrGLboolean green,
88                                              GrGLboolean blue,
89                                              GrGLboolean alpha) {
90 }
91 
noOpGLCompileShader(GrGLuint shader)92 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCompileShader(GrGLuint shader) {
93 }
94 
noOpGLCompressedTexImage2D(GrGLenum target,GrGLint level,GrGLenum internalformat,GrGLsizei width,GrGLsizei height,GrGLint border,GrGLsizei imageSize,const GrGLvoid * data)95 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCompressedTexImage2D(GrGLenum target,
96                                                         GrGLint level,
97                                                         GrGLenum internalformat,
98                                                         GrGLsizei width,
99                                                         GrGLsizei height,
100                                                         GrGLint border,
101                                                         GrGLsizei imageSize,
102                                                         const GrGLvoid* data) {
103 }
104 
noOpGLCompressedTexSubImage2D(GrGLenum target,GrGLint level,GrGLint xoffset,GrGLint yoffset,GrGLsizei width,GrGLsizei height,GrGLenum format,GrGLsizei imageSize,const GrGLvoid * data)105 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCompressedTexSubImage2D(GrGLenum target,
106                                                            GrGLint level,
107                                                            GrGLint xoffset,
108                                                            GrGLint yoffset,
109                                                            GrGLsizei width,
110                                                            GrGLsizei height,
111                                                            GrGLenum format,
112                                                            GrGLsizei imageSize,
113                                                            const GrGLvoid* data) {
114 }
115 
noOpGLCopyTexSubImage2D(GrGLenum target,GrGLint level,GrGLint xoffset,GrGLint yoffset,GrGLint x,GrGLint y,GrGLsizei width,GrGLsizei height)116 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCopyTexSubImage2D(GrGLenum target,
117                                                      GrGLint level,
118                                                      GrGLint xoffset,
119                                                      GrGLint yoffset,
120                                                      GrGLint x,
121                                                      GrGLint y,
122                                                      GrGLsizei width,
123                                                      GrGLsizei height) {
124 }
125 
noOpGLCullFace(GrGLenum mode)126 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLCullFace(GrGLenum mode) {
127 }
128 
noOpGLDepthMask(GrGLboolean flag)129 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDepthMask(GrGLboolean flag) {
130 }
131 
noOpGLDisable(GrGLenum cap)132 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDisable(GrGLenum cap) {
133 }
134 
noOpGLDisableVertexAttribArray(GrGLuint index)135 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDisableVertexAttribArray(GrGLuint index) {
136 }
137 
noOpGLDrawArrays(GrGLenum mode,GrGLint first,GrGLsizei count)138 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawArrays(GrGLenum mode,
139                                               GrGLint first,
140                                               GrGLsizei count) {
141 }
142 
noOpGLDrawBuffer(GrGLenum mode)143 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawBuffer(GrGLenum mode) {
144 }
145 
noOpGLDrawBuffers(GrGLsizei n,const GrGLenum * bufs)146 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawBuffers(GrGLsizei n,
147                                                const GrGLenum* bufs) {
148 }
149 
noOpGLDrawElements(GrGLenum mode,GrGLsizei count,GrGLenum type,const GrGLvoid * indices)150 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawElements(GrGLenum mode,
151                                                 GrGLsizei count,
152                                                 GrGLenum type,
153                                                 const GrGLvoid* indices) {
154 }
155 
noOpGLEnable(GrGLenum cap)156 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnable(GrGLenum cap) {
157 }
158 
noOpGLEnableVertexAttribArray(GrGLuint index)159 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnableVertexAttribArray(GrGLuint index) {
160 }
161 
noOpGLEndQuery(GrGLenum target)162 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEndQuery(GrGLenum target) {
163 }
164 
noOpGLFinish()165 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLFinish() {
166 }
167 
noOpGLFlush()168 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLFlush() {
169 }
170 
noOpGLFrontFace(GrGLenum mode)171 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLFrontFace(GrGLenum mode) {
172 }
173 
noOpGLLineWidth(GrGLfloat width)174 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLLineWidth(GrGLfloat width) {
175 }
176 
noOpGLLinkProgram(GrGLuint program)177 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLLinkProgram(GrGLuint program) {
178 }
179 
noOpGLMatrixLoadf(GrGLenum,const GrGLfloat *)180 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLMatrixLoadf(GrGLenum, const GrGLfloat*) {
181 }
182 
noOpGLMatrixLoadIdentity(GrGLenum)183 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLMatrixLoadIdentity(GrGLenum) {
184 }
185 
noOpGLQueryCounter(GrGLuint id,GrGLenum target)186 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLQueryCounter(GrGLuint id, GrGLenum target) {
187 }
188 
noOpGLReadBuffer(GrGLenum src)189 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLReadBuffer(GrGLenum src) {
190 }
191 
noOpGLScissor(GrGLint x,GrGLint y,GrGLsizei width,GrGLsizei height)192 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLScissor(GrGLint x,
193                                            GrGLint y,
194                                            GrGLsizei width,
195                                            GrGLsizei height) {
196 }
197 
noOpGLShaderSource(GrGLuint shader,GrGLsizei count,const char * const * str,const GrGLint * length)198 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLShaderSource(GrGLuint shader,
199                                                 GrGLsizei count,
200 #if GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE
201                                                 const char* const * str,
202 #else
203                                                 const char** str,
204 #endif
205                                                 const GrGLint* length) {
206 }
207 
noOpGLStencilFunc(GrGLenum func,GrGLint ref,GrGLuint mask)208 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilFunc(GrGLenum func, GrGLint ref, GrGLuint mask) {
209 }
210 
noOpGLStencilFuncSeparate(GrGLenum face,GrGLenum func,GrGLint ref,GrGLuint mask)211 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilFuncSeparate(GrGLenum face,
212                                                        GrGLenum func,
213                                                        GrGLint ref,
214                                                        GrGLuint mask) {
215 }
216 
noOpGLStencilMask(GrGLuint mask)217 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilMask(GrGLuint mask) {
218 }
219 
noOpGLStencilMaskSeparate(GrGLenum face,GrGLuint mask)220 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilMaskSeparate(GrGLenum face, GrGLuint mask) {
221 }
222 
noOpGLStencilOp(GrGLenum fail,GrGLenum zfail,GrGLenum zpass)223 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilOp(GrGLenum fail, GrGLenum zfail, GrGLenum zpass) {
224 }
225 
noOpGLStencilOpSeparate(GrGLenum face,GrGLenum fail,GrGLenum zfail,GrGLenum zpass)226 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilOpSeparate(GrGLenum face,
227                                                      GrGLenum fail,
228                                                      GrGLenum zfail,
229                                                      GrGLenum zpass) {
230 }
231 
noOpGLTexImage2D(GrGLenum target,GrGLint level,GrGLint internalformat,GrGLsizei width,GrGLsizei height,GrGLint border,GrGLenum format,GrGLenum type,const GrGLvoid * pixels)232 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexImage2D(GrGLenum target,
233                                               GrGLint level,
234                                               GrGLint internalformat,
235                                               GrGLsizei width,
236                                               GrGLsizei height,
237                                               GrGLint border,
238                                               GrGLenum format,
239                                               GrGLenum type,
240                                               const GrGLvoid* pixels) {
241 }
242 
noOpGLTexParameteri(GrGLenum target,GrGLenum pname,GrGLint param)243 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexParameteri(GrGLenum target,
244                                                  GrGLenum pname,
245                                                  GrGLint param) {
246 }
247 
noOpGLTexParameteriv(GrGLenum target,GrGLenum pname,const GrGLint * params)248 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexParameteriv(GrGLenum target,
249                                                   GrGLenum pname,
250                                                   const GrGLint* params) {
251 }
252 
noOpGLTexStorage2D(GrGLenum target,GrGLsizei levels,GrGLenum internalformat,GrGLsizei width,GrGLsizei height)253 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexStorage2D(GrGLenum target,
254                                                 GrGLsizei levels,
255                                                 GrGLenum internalformat,
256                                                 GrGLsizei width,
257                                                 GrGLsizei height) {
258 }
259 
noOpGLDiscardFramebuffer(GrGLenum target,GrGLsizei numAttachments,const GrGLenum * attachments)260 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDiscardFramebuffer(GrGLenum target,
261                                                       GrGLsizei numAttachments,
262                                                       const GrGLenum* attachments) {
263 }
264 
noOpGLTexSubImage2D(GrGLenum target,GrGLint level,GrGLint xoffset,GrGLint yoffset,GrGLsizei width,GrGLsizei height,GrGLenum format,GrGLenum type,const GrGLvoid * pixels)265 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexSubImage2D(GrGLenum target,
266                                                  GrGLint level,
267                                                  GrGLint xoffset,
268                                                  GrGLint yoffset,
269                                                  GrGLsizei width,
270                                                  GrGLsizei height,
271                                                  GrGLenum format,
272                                                  GrGLenum type,
273                                                  const GrGLvoid* pixels) {
274 }
275 
noOpGLUniform1f(GrGLint location,GrGLfloat v0)276 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform1f(GrGLint location, GrGLfloat v0) {
277 }
278 
noOpGLUniform1i(GrGLint location,GrGLint v0)279 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform1i(GrGLint location, GrGLint v0) {
280 }
281 
noOpGLUniform1fv(GrGLint location,GrGLsizei count,const GrGLfloat * v)282 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform1fv(GrGLint location,
283                                               GrGLsizei count,
284                                               const GrGLfloat* v) {
285 }
286 
noOpGLUniform1iv(GrGLint location,GrGLsizei count,const GrGLint * v)287 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform1iv(GrGLint location,
288                                               GrGLsizei count,
289                                               const GrGLint* v) {
290 }
291 
noOpGLUniform2f(GrGLint location,GrGLfloat v0,GrGLfloat v1)292 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform2f(GrGLint location, GrGLfloat v0, GrGLfloat v1) {
293 }
294 
noOpGLUniform2i(GrGLint location,GrGLint v0,GrGLint v1)295 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform2i(GrGLint location, GrGLint v0, GrGLint v1) {
296 }
297 
noOpGLUniform2fv(GrGLint location,GrGLsizei count,const GrGLfloat * v)298 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform2fv(GrGLint location,
299                                               GrGLsizei count,
300                                               const GrGLfloat* v) {
301 }
302 
noOpGLUniform2iv(GrGLint location,GrGLsizei count,const GrGLint * v)303 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform2iv(GrGLint location,
304                                               GrGLsizei count,
305                                               const GrGLint* v) {
306 }
307 
noOpGLUniform3f(GrGLint location,GrGLfloat v0,GrGLfloat v1,GrGLfloat v2)308 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform3f(GrGLint location,
309                                               GrGLfloat v0,
310                                               GrGLfloat v1,
311                                               GrGLfloat v2) {
312 }
313 
noOpGLUniform3i(GrGLint location,GrGLint v0,GrGLint v1,GrGLint v2)314 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform3i(GrGLint location,
315                                               GrGLint v0,
316                                               GrGLint v1,
317                                               GrGLint v2) {
318 }
319 
noOpGLUniform3fv(GrGLint location,GrGLsizei count,const GrGLfloat * v)320 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform3fv(GrGLint location,
321                                               GrGLsizei count,
322                                               const GrGLfloat* v) {
323 }
324 
noOpGLUniform3iv(GrGLint location,GrGLsizei count,const GrGLint * v)325 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform3iv(GrGLint location,
326                                               GrGLsizei count,
327                                               const GrGLint* v) {
328 }
329 
noOpGLUniform4f(GrGLint location,GrGLfloat v0,GrGLfloat v1,GrGLfloat v2,GrGLfloat v3)330 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform4f(GrGLint location,
331                                               GrGLfloat v0,
332                                               GrGLfloat v1,
333                                               GrGLfloat v2,
334                                               GrGLfloat v3) {
335 }
336 
noOpGLUniform4i(GrGLint location,GrGLint v0,GrGLint v1,GrGLint v2,GrGLint v3)337 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform4i(GrGLint location,
338                                               GrGLint v0,
339                                               GrGLint v1,
340                                               GrGLint v2,
341                                               GrGLint v3) {
342 }
343 
noOpGLUniform4fv(GrGLint location,GrGLsizei count,const GrGLfloat * v)344 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform4fv(GrGLint location,
345                                               GrGLsizei count,
346                                               const GrGLfloat* v) {
347 }
348 
noOpGLUniform4iv(GrGLint location,GrGLsizei count,const GrGLint * v)349 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform4iv(GrGLint location,
350                                               GrGLsizei count,
351                                               const GrGLint* v) {
352 }
353 
noOpGLUniformMatrix2fv(GrGLint location,GrGLsizei count,GrGLboolean transpose,const GrGLfloat * value)354 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniformMatrix2fv(GrGLint location,
355                                                     GrGLsizei count,
356                                                     GrGLboolean transpose,
357                                                     const GrGLfloat* value) {
358 }
359 
noOpGLUniformMatrix3fv(GrGLint location,GrGLsizei count,GrGLboolean transpose,const GrGLfloat * value)360 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniformMatrix3fv(GrGLint location,
361                                                     GrGLsizei count,
362                                                     GrGLboolean transpose,
363                                                     const GrGLfloat* value) {
364 }
365 
noOpGLUniformMatrix4fv(GrGLint location,GrGLsizei count,GrGLboolean transpose,const GrGLfloat * value)366 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniformMatrix4fv(GrGLint location,
367                                                     GrGLsizei count,
368                                                     GrGLboolean transpose,
369                                                     const GrGLfloat* value) {
370 }
371 
noOpGLVertexAttrib1f(GrGLuint indx,const GrGLfloat value)372  GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttrib1f(GrGLuint indx, const GrGLfloat value) {
373 }
374 
noOpGLVertexAttrib2fv(GrGLuint indx,const GrGLfloat * values)375  GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttrib2fv(GrGLuint indx, const GrGLfloat* values) {
376 }
377 
noOpGLVertexAttrib3fv(GrGLuint indx,const GrGLfloat * values)378  GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttrib3fv(GrGLuint indx, const GrGLfloat* values) {
379 }
380 
noOpGLVertexAttrib4fv(GrGLuint indx,const GrGLfloat * values)381  GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttrib4fv(GrGLuint indx, const GrGLfloat* values) {
382 }
383 
noOpGLVertexAttribPointer(GrGLuint indx,GrGLint size,GrGLenum type,GrGLboolean normalized,GrGLsizei stride,const GrGLvoid * ptr)384 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttribPointer(GrGLuint indx,
385                                                        GrGLint size,
386                                                        GrGLenum type,
387                                                        GrGLboolean normalized,
388                                                        GrGLsizei stride,
389                                                        const GrGLvoid* ptr) {
390 }
391 
noOpGLViewport(GrGLint x,GrGLint y,GrGLsizei width,GrGLsizei height)392 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLViewport(GrGLint x,
393                                             GrGLint y,
394                                             GrGLsizei width,
395                                             GrGLsizei height) {
396 }
397 
noOpGLGetFramebufferAttachmentParameteriv(GrGLenum target,GrGLenum attachment,GrGLenum pname,GrGLint * params)398   GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetFramebufferAttachmentParameteriv(GrGLenum target,
399                                                                          GrGLenum attachment,
400                                                                          GrGLenum pname,
401                                                                          GrGLint* params) {
402 }
403 
noOpGLGetRenderbufferParameteriv(GrGLenum target,GrGLenum pname,GrGLint * params)404 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetRenderbufferParameteriv(GrGLenum target,
405                                                               GrGLenum pname,
406                                                               GrGLint* params) {
407 }
408 
noOpGLRenderbufferStorage(GrGLenum target,GrGLenum internalformat,GrGLsizei width,GrGLsizei height)409 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLRenderbufferStorage(GrGLenum target,
410                                                        GrGLenum internalformat,
411                                                        GrGLsizei width,
412                                                        GrGLsizei height) {
413 }
414 
noOpGLRenderbufferStorageMultisample(GrGLenum target,GrGLsizei samples,GrGLenum internalformat,GrGLsizei width,GrGLsizei height)415 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLRenderbufferStorageMultisample(GrGLenum target,
416                                                                   GrGLsizei samples,
417                                                                   GrGLenum internalformat,
418                                                                   GrGLsizei width,
419                                                                   GrGLsizei height) {
420 }
421 
noOpGLBlitFramebuffer(GrGLint srcX0,GrGLint srcY0,GrGLint srcX1,GrGLint srcY1,GrGLint dstX0,GrGLint dstY0,GrGLint dstX1,GrGLint dstY1,GrGLbitfield mask,GrGLenum filter)422 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlitFramebuffer(GrGLint srcX0,
423                                                    GrGLint srcY0,
424                                                    GrGLint srcX1,
425                                                    GrGLint srcY1,
426                                                    GrGLint dstX0,
427                                                    GrGLint dstY0,
428                                                    GrGLint dstX1,
429                                                    GrGLint dstY1,
430                                                    GrGLbitfield mask,
431                                                    GrGLenum filter) {
432 }
433 
noOpGLResolveMultisampleFramebuffer()434 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLResolveMultisampleFramebuffer() {
435 }
436 
noOpGLBindFragDataLocationIndexed(GrGLuint program,GrGLuint colorNumber,GrGLuint index,const GrGLchar * name)437 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBindFragDataLocationIndexed(GrGLuint program,
438                                                                GrGLuint colorNumber,
439                                                                GrGLuint index,
440                                                                const GrGLchar * name) {
441 }
442 
noOpGLCheckFramebufferStatus(GrGLenum target)443 GrGLenum GR_GL_FUNCTION_TYPE noOpGLCheckFramebufferStatus(GrGLenum target) {
444 
445     GrAlwaysAssert(GR_GL_FRAMEBUFFER == target);
446 
447     return GR_GL_FRAMEBUFFER_COMPLETE;
448 }
449 
noOpGLGenIds(GrGLsizei n,GrGLuint * ids)450 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGenIds(GrGLsizei n, GrGLuint* ids) {
451     static int gCurrID = 1;
452     for (int i = 0; i < n; ++i) {
453         ids[i] = ++gCurrID;
454    }
455 }
456 
noOpGLDeleteIds(GrGLsizei n,const GrGLuint * ids)457 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDeleteIds(GrGLsizei n, const GrGLuint* ids) {
458 }
459 
noOpGLGetError()460 GrGLenum GR_GL_FUNCTION_TYPE noOpGLGetError() {
461     return GR_GL_NO_ERROR;
462 }
463 
noOpGLGetIntegerv(GrGLenum pname,GrGLint * params)464 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetIntegerv(GrGLenum pname, GrGLint* params) {
465     // TODO: remove from Ganesh the #defines for gets we don't use.
466     // We would like to minimize gets overall due to performance issues
467     switch (pname) {
468         case GR_GL_CONTEXT_PROFILE_MASK:
469             *params = GR_GL_CONTEXT_COMPATIBILITY_PROFILE_BIT;
470             break;
471         case GR_GL_STENCIL_BITS:
472             *params = 8;
473             break;
474         case GR_GL_SAMPLES:
475             *params = 1;
476             break;
477         case GR_GL_FRAMEBUFFER_BINDING:
478             *params = 0;
479             break;
480         case GR_GL_VIEWPORT:
481             params[0] = 0;
482             params[1] = 0;
483             params[2] = 800;
484             params[3] = 600;
485             break;
486         case GR_GL_MAX_TEXTURE_IMAGE_UNITS:
487             *params = 8;
488             break;
489         case GR_GL_MAX_TEXTURE_COORDS:
490             *params = 8;
491             break;
492         case GR_GL_MAX_VERTEX_UNIFORM_VECTORS:
493             *params = kDefaultMaxVertexUniformVectors;
494             break;
495         case GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS:
496             *params = kDefaultMaxFragmentUniformVectors;
497             break;
498         case GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
499             *params = 16 * 4;
500             break;
501         case GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS:
502             *params = 0;
503             break;
504         case GR_GL_COMPRESSED_TEXTURE_FORMATS:
505             break;
506         case GR_GL_MAX_TEXTURE_SIZE:
507             *params = 8192;
508             break;
509         case GR_GL_MAX_RENDERBUFFER_SIZE:
510             *params = 8192;
511             break;
512         case GR_GL_MAX_SAMPLES:
513             *params = 32;
514             break;
515         case GR_GL_MAX_VERTEX_ATTRIBS:
516             *params = kDefaultMaxVertexAttribs;
517             break;
518         case GR_GL_MAX_VARYING_VECTORS:
519             *params = kDefaultMaxVaryingVectors;
520             break;
521         case GR_GL_NUM_EXTENSIONS:
522             *params = SK_ARRAY_COUNT(kExtensions);
523             break;
524         default:
525             SkFAIL("Unexpected pname to GetIntegerv");
526    }
527 }
528 
noOpGLGetInfoLog(GrGLuint program,GrGLsizei bufsize,GrGLsizei * length,char * infolog)529 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetInfoLog(GrGLuint program,
530                                               GrGLsizei bufsize,
531                                               GrGLsizei* length,
532                                               char* infolog) {
533     if (length) {
534         *length = 0;
535    }
536     if (bufsize > 0) {
537         *infolog = 0;
538    }
539 }
540 
noOpGLGetShaderOrProgramiv(GrGLuint program,GrGLenum pname,GrGLint * params)541 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetShaderOrProgramiv(GrGLuint program,
542                                                         GrGLenum pname,
543                                                         GrGLint* params) {
544     switch (pname) {
545         case GR_GL_LINK_STATUS:  // fallthru
546         case GR_GL_COMPILE_STATUS:
547             *params = GR_GL_TRUE;
548             break;
549         case GR_GL_INFO_LOG_LENGTH:
550             *params = 0;
551             break;
552         // we don't expect any other pnames
553         default:
554             SkFAIL("Unexpected pname to GetProgramiv");
555             break;
556    }
557 }
558 
559 namespace {
560 template <typename T>
query_result(GrGLenum GLtarget,GrGLenum pname,T * params)561 void query_result(GrGLenum GLtarget, GrGLenum pname, T *params) {
562     switch (pname) {
563         case GR_GL_QUERY_RESULT_AVAILABLE:
564             *params = GR_GL_TRUE;
565             break;
566         case GR_GL_QUERY_RESULT:
567             *params = 0;
568             break;
569         default:
570             SkFAIL("Unexpected pname passed to GetQueryObject.");
571             break;
572    }
573 }
574 }
575 
noOpGLGetQueryiv(GrGLenum GLtarget,GrGLenum pname,GrGLint * params)576 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryiv(GrGLenum GLtarget,
577                                               GrGLenum pname,
578                                               GrGLint *params) {
579     switch (pname) {
580         case GR_GL_CURRENT_QUERY:
581             *params = 0;
582             break;
583         case GR_GL_QUERY_COUNTER_BITS:
584             *params = 32;
585             break;
586         default:
587             SkFAIL("Unexpected pname passed GetQueryiv.");
588    }
589 }
590 
noOpGLGetQueryObjecti64v(GrGLuint id,GrGLenum pname,GrGLint64 * params)591 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryObjecti64v(GrGLuint id,
592                                                       GrGLenum pname,
593                                                       GrGLint64 *params) {
594     query_result(id, pname, params);
595 }
596 
noOpGLGetQueryObjectiv(GrGLuint id,GrGLenum pname,GrGLint * params)597 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryObjectiv(GrGLuint id,
598                                                     GrGLenum pname,
599                                                     GrGLint *params) {
600     query_result(id, pname, params);
601 }
602 
noOpGLGetQueryObjectui64v(GrGLuint id,GrGLenum pname,GrGLuint64 * params)603 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryObjectui64v(GrGLuint id,
604                                                        GrGLenum pname,
605                                                        GrGLuint64 *params) {
606     query_result(id, pname, params);
607 }
608 
noOpGLGetQueryObjectuiv(GrGLuint id,GrGLenum pname,GrGLuint * params)609 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryObjectuiv(GrGLuint id,
610                                                      GrGLenum pname,
611                                                      GrGLuint *params) {
612     query_result(id, pname, params);
613 }
614 
noOpGLGetString(GrGLenum name)615 const GrGLubyte* GR_GL_FUNCTION_TYPE noOpGLGetString(GrGLenum name) {
616     switch (name) {
617         case GR_GL_EXTENSIONS:
618             return combined_extensions_string();
619         case GR_GL_VERSION:
620             return (const GrGLubyte*)"4.0 Debug GL";
621         case GR_GL_SHADING_LANGUAGE_VERSION:
622             return (const GrGLubyte*)"4.20.8 Debug GLSL";
623         case GR_GL_VENDOR:
624             return (const GrGLubyte*)"Debug Vendor";
625         case GR_GL_RENDERER:
626             return (const GrGLubyte*)"The Debug (Non-)Renderer";
627         default:
628             SkFAIL("Unexpected name passed to GetString");
629             return NULL;
630    }
631 }
632 
noOpGLGetStringi(GrGLenum name,GrGLuint i)633 const GrGLubyte* GR_GL_FUNCTION_TYPE noOpGLGetStringi(GrGLenum name, GrGLuint i) {
634     switch (name) {
635         case GR_GL_EXTENSIONS:
636             if (static_cast<size_t>(i) <= SK_ARRAY_COUNT(kExtensions)) {
637                 return (const GrGLubyte*) kExtensions[i];
638             } else {
639                 return NULL;
640             }
641         default:
642             SkFAIL("Unexpected name passed to GetStringi");
643             return NULL;
644     }
645 }
646 
noOpGLGetTexLevelParameteriv(GrGLenum target,GrGLint level,GrGLenum pname,GrGLint * params)647 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetTexLevelParameteriv(GrGLenum target,
648                                                           GrGLint level,
649                                                           GrGLenum pname,
650                                                           GrGLint* params) {
651     // we used to use this to query stuff about externally created textures,
652     // now we just require clients to tell us everything about the texture.
653     SkFAIL("Should never query texture parameters.");
654 }
655 
noOpGLGetUniformLocation(GrGLuint program,const char * name)656 GrGLint GR_GL_FUNCTION_TYPE noOpGLGetUniformLocation(GrGLuint program, const char* name) {
657     static int gUniLocation = 0;
658     return ++gUniLocation;
659 }
660 
noOpGLInsertEventMarker(GrGLsizei length,const char * marker)661 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLInsertEventMarker(GrGLsizei length, const char* marker) {
662 }
noOpGLPushGroupMarker(GrGLsizei length,const char * marker)663 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLPushGroupMarker(GrGLsizei length  , const char* marker) {
664 }
noOpGLPopGroupMarker()665 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLPopGroupMarker() {
666 }
667