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 "SkMutex.h"
10 #include "SkString.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 
noOpGLDrawArraysInstanced(GrGLenum mode,GrGLint first,GrGLsizei count,GrGLsizei primcount)143 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawArraysInstanced(GrGLenum mode,
144                                                        GrGLint first,
145                                                        GrGLsizei count,
146                                                        GrGLsizei primcount) {
147 }
148 
noOpGLDrawBuffer(GrGLenum mode)149 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawBuffer(GrGLenum mode) {
150 }
151 
noOpGLDrawBuffers(GrGLsizei n,const GrGLenum * bufs)152 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawBuffers(GrGLsizei n,
153                                                const GrGLenum* bufs) {
154 }
155 
noOpGLDrawElements(GrGLenum mode,GrGLsizei count,GrGLenum type,const GrGLvoid * indices)156 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawElements(GrGLenum mode,
157                                                 GrGLsizei count,
158                                                 GrGLenum type,
159                                                 const GrGLvoid* indices) {
160 }
161 
noOpGLDrawElementsInstanced(GrGLenum mode,GrGLsizei count,GrGLenum type,const GrGLvoid * indices,GrGLsizei primcount)162 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDrawElementsInstanced(GrGLenum mode,
163                                                          GrGLsizei count,
164                                                          GrGLenum type,
165                                                          const GrGLvoid* indices,
166                                                          GrGLsizei primcount) {
167 }
168 
noOpGLEnable(GrGLenum cap)169 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnable(GrGLenum cap) {
170 }
171 
noOpGLEnableVertexAttribArray(GrGLuint index)172 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEnableVertexAttribArray(GrGLuint index) {
173 }
174 
noOpGLEndQuery(GrGLenum target)175 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLEndQuery(GrGLenum target) {
176 }
177 
noOpGLFinish()178 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLFinish() {
179 }
180 
noOpGLFlush()181 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLFlush() {
182 }
183 
noOpGLFrontFace(GrGLenum mode)184 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLFrontFace(GrGLenum mode) {
185 }
186 
noOpGLLineWidth(GrGLfloat width)187 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLLineWidth(GrGLfloat width) {
188 }
189 
noOpGLLinkProgram(GrGLuint program)190 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLLinkProgram(GrGLuint program) {
191 }
192 
noOpGLMatrixLoadf(GrGLenum,const GrGLfloat *)193 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLMatrixLoadf(GrGLenum, const GrGLfloat*) {
194 }
195 
noOpGLMatrixLoadIdentity(GrGLenum)196 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLMatrixLoadIdentity(GrGLenum) {
197 }
198 
noOpGLQueryCounter(GrGLuint id,GrGLenum target)199 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLQueryCounter(GrGLuint id, GrGLenum target) {
200 }
201 
noOpGLReadBuffer(GrGLenum src)202 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLReadBuffer(GrGLenum src) {
203 }
204 
noOpGLScissor(GrGLint x,GrGLint y,GrGLsizei width,GrGLsizei height)205 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLScissor(GrGLint x,
206                                            GrGLint y,
207                                            GrGLsizei width,
208                                            GrGLsizei height) {
209 }
210 
noOpGLShaderSource(GrGLuint shader,GrGLsizei count,const char * const * str,const GrGLint * length)211 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLShaderSource(GrGLuint shader,
212                                                 GrGLsizei count,
213 #if GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE
214                                                 const char* const * str,
215 #else
216                                                 const char** str,
217 #endif
218                                                 const GrGLint* length) {
219 }
220 
noOpGLStencilFunc(GrGLenum func,GrGLint ref,GrGLuint mask)221 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilFunc(GrGLenum func, GrGLint ref, GrGLuint mask) {
222 }
223 
noOpGLStencilFuncSeparate(GrGLenum face,GrGLenum func,GrGLint ref,GrGLuint mask)224 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilFuncSeparate(GrGLenum face,
225                                                        GrGLenum func,
226                                                        GrGLint ref,
227                                                        GrGLuint mask) {
228 }
229 
noOpGLStencilMask(GrGLuint mask)230 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilMask(GrGLuint mask) {
231 }
232 
noOpGLStencilMaskSeparate(GrGLenum face,GrGLuint mask)233 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilMaskSeparate(GrGLenum face, GrGLuint mask) {
234 }
235 
noOpGLStencilOp(GrGLenum fail,GrGLenum zfail,GrGLenum zpass)236 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilOp(GrGLenum fail, GrGLenum zfail, GrGLenum zpass) {
237 }
238 
noOpGLStencilOpSeparate(GrGLenum face,GrGLenum fail,GrGLenum zfail,GrGLenum zpass)239 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLStencilOpSeparate(GrGLenum face,
240                                                      GrGLenum fail,
241                                                      GrGLenum zfail,
242                                                      GrGLenum zpass) {
243 }
244 
noOpGLTexImage2D(GrGLenum target,GrGLint level,GrGLint internalformat,GrGLsizei width,GrGLsizei height,GrGLint border,GrGLenum format,GrGLenum type,const GrGLvoid * pixels)245 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexImage2D(GrGLenum target,
246                                               GrGLint level,
247                                               GrGLint internalformat,
248                                               GrGLsizei width,
249                                               GrGLsizei height,
250                                               GrGLint border,
251                                               GrGLenum format,
252                                               GrGLenum type,
253                                               const GrGLvoid* pixels) {
254 }
255 
noOpGLTexParameteri(GrGLenum target,GrGLenum pname,GrGLint param)256 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexParameteri(GrGLenum target,
257                                                  GrGLenum pname,
258                                                  GrGLint param) {
259 }
260 
noOpGLTexParameteriv(GrGLenum target,GrGLenum pname,const GrGLint * params)261 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexParameteriv(GrGLenum target,
262                                                   GrGLenum pname,
263                                                   const GrGLint* params) {
264 }
265 
noOpGLTexStorage2D(GrGLenum target,GrGLsizei levels,GrGLenum internalformat,GrGLsizei width,GrGLsizei height)266 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexStorage2D(GrGLenum target,
267                                                 GrGLsizei levels,
268                                                 GrGLenum internalformat,
269                                                 GrGLsizei width,
270                                                 GrGLsizei height) {
271 }
272 
noOpGLDiscardFramebuffer(GrGLenum target,GrGLsizei numAttachments,const GrGLenum * attachments)273 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDiscardFramebuffer(GrGLenum target,
274                                                       GrGLsizei numAttachments,
275                                                       const GrGLenum* attachments) {
276 }
277 
noOpGLTexSubImage2D(GrGLenum target,GrGLint level,GrGLint xoffset,GrGLint yoffset,GrGLsizei width,GrGLsizei height,GrGLenum format,GrGLenum type,const GrGLvoid * pixels)278 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLTexSubImage2D(GrGLenum target,
279                                                  GrGLint level,
280                                                  GrGLint xoffset,
281                                                  GrGLint yoffset,
282                                                  GrGLsizei width,
283                                                  GrGLsizei height,
284                                                  GrGLenum format,
285                                                  GrGLenum type,
286                                                  const GrGLvoid* pixels) {
287 }
288 
noOpGLUniform1f(GrGLint location,GrGLfloat v0)289 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform1f(GrGLint location, GrGLfloat v0) {
290 }
291 
noOpGLUniform1i(GrGLint location,GrGLint v0)292 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform1i(GrGLint location, GrGLint v0) {
293 }
294 
noOpGLUniform1fv(GrGLint location,GrGLsizei count,const GrGLfloat * v)295 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform1fv(GrGLint location,
296                                               GrGLsizei count,
297                                               const GrGLfloat* v) {
298 }
299 
noOpGLUniform1iv(GrGLint location,GrGLsizei count,const GrGLint * v)300 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform1iv(GrGLint location,
301                                               GrGLsizei count,
302                                               const GrGLint* v) {
303 }
304 
noOpGLUniform2f(GrGLint location,GrGLfloat v0,GrGLfloat v1)305 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform2f(GrGLint location, GrGLfloat v0, GrGLfloat v1) {
306 }
307 
noOpGLUniform2i(GrGLint location,GrGLint v0,GrGLint v1)308 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform2i(GrGLint location, GrGLint v0, GrGLint v1) {
309 }
310 
noOpGLUniform2fv(GrGLint location,GrGLsizei count,const GrGLfloat * v)311 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform2fv(GrGLint location,
312                                               GrGLsizei count,
313                                               const GrGLfloat* v) {
314 }
315 
noOpGLUniform2iv(GrGLint location,GrGLsizei count,const GrGLint * v)316 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform2iv(GrGLint location,
317                                               GrGLsizei count,
318                                               const GrGLint* v) {
319 }
320 
noOpGLUniform3f(GrGLint location,GrGLfloat v0,GrGLfloat v1,GrGLfloat v2)321 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform3f(GrGLint location,
322                                               GrGLfloat v0,
323                                               GrGLfloat v1,
324                                               GrGLfloat v2) {
325 }
326 
noOpGLUniform3i(GrGLint location,GrGLint v0,GrGLint v1,GrGLint v2)327 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform3i(GrGLint location,
328                                               GrGLint v0,
329                                               GrGLint v1,
330                                               GrGLint v2) {
331 }
332 
noOpGLUniform3fv(GrGLint location,GrGLsizei count,const GrGLfloat * v)333 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform3fv(GrGLint location,
334                                               GrGLsizei count,
335                                               const GrGLfloat* v) {
336 }
337 
noOpGLUniform3iv(GrGLint location,GrGLsizei count,const GrGLint * v)338 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform3iv(GrGLint location,
339                                               GrGLsizei count,
340                                               const GrGLint* v) {
341 }
342 
noOpGLUniform4f(GrGLint location,GrGLfloat v0,GrGLfloat v1,GrGLfloat v2,GrGLfloat v3)343 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform4f(GrGLint location,
344                                               GrGLfloat v0,
345                                               GrGLfloat v1,
346                                               GrGLfloat v2,
347                                               GrGLfloat v3) {
348 }
349 
noOpGLUniform4i(GrGLint location,GrGLint v0,GrGLint v1,GrGLint v2,GrGLint v3)350 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform4i(GrGLint location,
351                                               GrGLint v0,
352                                               GrGLint v1,
353                                               GrGLint v2,
354                                               GrGLint v3) {
355 }
356 
noOpGLUniform4fv(GrGLint location,GrGLsizei count,const GrGLfloat * v)357 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform4fv(GrGLint location,
358                                               GrGLsizei count,
359                                               const GrGLfloat* v) {
360 }
361 
noOpGLUniform4iv(GrGLint location,GrGLsizei count,const GrGLint * v)362 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniform4iv(GrGLint location,
363                                               GrGLsizei count,
364                                               const GrGLint* v) {
365 }
366 
noOpGLUniformMatrix2fv(GrGLint location,GrGLsizei count,GrGLboolean transpose,const GrGLfloat * value)367 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniformMatrix2fv(GrGLint location,
368                                                     GrGLsizei count,
369                                                     GrGLboolean transpose,
370                                                     const GrGLfloat* value) {
371 }
372 
noOpGLUniformMatrix3fv(GrGLint location,GrGLsizei count,GrGLboolean transpose,const GrGLfloat * value)373 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniformMatrix3fv(GrGLint location,
374                                                     GrGLsizei count,
375                                                     GrGLboolean transpose,
376                                                     const GrGLfloat* value) {
377 }
378 
noOpGLUniformMatrix4fv(GrGLint location,GrGLsizei count,GrGLboolean transpose,const GrGLfloat * value)379 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLUniformMatrix4fv(GrGLint location,
380                                                     GrGLsizei count,
381                                                     GrGLboolean transpose,
382                                                     const GrGLfloat* value) {
383 }
384 
noOpGLVertexAttrib1f(GrGLuint indx,const GrGLfloat value)385  GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttrib1f(GrGLuint indx, const GrGLfloat value) {
386 }
387 
noOpGLVertexAttrib2fv(GrGLuint indx,const GrGLfloat * values)388  GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttrib2fv(GrGLuint indx, const GrGLfloat* values) {
389 }
390 
noOpGLVertexAttrib3fv(GrGLuint indx,const GrGLfloat * values)391  GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttrib3fv(GrGLuint indx, const GrGLfloat* values) {
392 }
393 
noOpGLVertexAttrib4fv(GrGLuint indx,const GrGLfloat * values)394  GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttrib4fv(GrGLuint indx, const GrGLfloat* values) {
395 }
396 
noOpGLVertexAttribIPointer(GrGLuint indx,GrGLint size,GrGLenum type,GrGLsizei stride,const GrGLvoid * ptr)397 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttribIPointer(GrGLuint indx,
398                                                         GrGLint size,
399                                                         GrGLenum type,
400                                                         GrGLsizei stride,
401                                                         const GrGLvoid* ptr) {
402 }
403 
noOpGLVertexAttribPointer(GrGLuint indx,GrGLint size,GrGLenum type,GrGLboolean normalized,GrGLsizei stride,const GrGLvoid * ptr)404 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttribPointer(GrGLuint indx,
405                                                        GrGLint size,
406                                                        GrGLenum type,
407                                                        GrGLboolean normalized,
408                                                        GrGLsizei stride,
409                                                        const GrGLvoid* ptr) {
410 }
411 
noOpGLVertexAttribDivisor(GrGLuint index,GrGLuint divisor)412 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLVertexAttribDivisor(GrGLuint index, GrGLuint divisor) {
413 }
414 
noOpGLViewport(GrGLint x,GrGLint y,GrGLsizei width,GrGLsizei height)415 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLViewport(GrGLint x,
416                                             GrGLint y,
417                                             GrGLsizei width,
418                                             GrGLsizei height) {
419 }
420 
noOpGLGetFramebufferAttachmentParameteriv(GrGLenum target,GrGLenum attachment,GrGLenum pname,GrGLint * params)421   GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetFramebufferAttachmentParameteriv(GrGLenum target,
422                                                                          GrGLenum attachment,
423                                                                          GrGLenum pname,
424                                                                          GrGLint* params) {
425 }
426 
noOpGLGetRenderbufferParameteriv(GrGLenum target,GrGLenum pname,GrGLint * params)427 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetRenderbufferParameteriv(GrGLenum target,
428                                                               GrGLenum pname,
429                                                               GrGLint* params) {
430 }
431 
noOpGLRenderbufferStorage(GrGLenum target,GrGLenum internalformat,GrGLsizei width,GrGLsizei height)432 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLRenderbufferStorage(GrGLenum target,
433                                                        GrGLenum internalformat,
434                                                        GrGLsizei width,
435                                                        GrGLsizei height) {
436 }
437 
noOpGLRenderbufferStorageMultisample(GrGLenum target,GrGLsizei samples,GrGLenum internalformat,GrGLsizei width,GrGLsizei height)438 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLRenderbufferStorageMultisample(GrGLenum target,
439                                                                   GrGLsizei samples,
440                                                                   GrGLenum internalformat,
441                                                                   GrGLsizei width,
442                                                                   GrGLsizei height) {
443 }
444 
noOpGLBlitFramebuffer(GrGLint srcX0,GrGLint srcY0,GrGLint srcX1,GrGLint srcY1,GrGLint dstX0,GrGLint dstY0,GrGLint dstX1,GrGLint dstY1,GrGLbitfield mask,GrGLenum filter)445 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBlitFramebuffer(GrGLint srcX0,
446                                                    GrGLint srcY0,
447                                                    GrGLint srcX1,
448                                                    GrGLint srcY1,
449                                                    GrGLint dstX0,
450                                                    GrGLint dstY0,
451                                                    GrGLint dstX1,
452                                                    GrGLint dstY1,
453                                                    GrGLbitfield mask,
454                                                    GrGLenum filter) {
455 }
456 
noOpGLResolveMultisampleFramebuffer()457 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLResolveMultisampleFramebuffer() {
458 }
459 
noOpGLBindFragDataLocationIndexed(GrGLuint program,GrGLuint colorNumber,GrGLuint index,const GrGLchar * name)460 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLBindFragDataLocationIndexed(GrGLuint program,
461                                                                GrGLuint colorNumber,
462                                                                GrGLuint index,
463                                                                const GrGLchar * name) {
464 }
465 
noOpGLCheckFramebufferStatus(GrGLenum target)466 GrGLenum GR_GL_FUNCTION_TYPE noOpGLCheckFramebufferStatus(GrGLenum target) {
467 
468     GrAlwaysAssert(GR_GL_FRAMEBUFFER == target);
469 
470     return GR_GL_FRAMEBUFFER_COMPLETE;
471 }
472 
noOpGLGenIds(GrGLsizei n,GrGLuint * ids)473 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGenIds(GrGLsizei n, GrGLuint* ids) {
474     static int gCurrID = 1;
475     for (int i = 0; i < n; ++i) {
476         ids[i] = ++gCurrID;
477    }
478 }
479 
noOpGLDeleteIds(GrGLsizei n,const GrGLuint * ids)480 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLDeleteIds(GrGLsizei n, const GrGLuint* ids) {
481 }
482 
noOpGLGetError()483 GrGLenum GR_GL_FUNCTION_TYPE noOpGLGetError() {
484     return GR_GL_NO_ERROR;
485 }
486 
noOpGLGetIntegerv(GrGLenum pname,GrGLint * params)487 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetIntegerv(GrGLenum pname, GrGLint* params) {
488     // TODO: remove from Ganesh the #defines for gets we don't use.
489     // We would like to minimize gets overall due to performance issues
490     switch (pname) {
491         case GR_GL_CONTEXT_PROFILE_MASK:
492             *params = GR_GL_CONTEXT_COMPATIBILITY_PROFILE_BIT;
493             break;
494         case GR_GL_STENCIL_BITS:
495             *params = 8;
496             break;
497         case GR_GL_SAMPLES:
498             *params = 1;
499             break;
500         case GR_GL_FRAMEBUFFER_BINDING:
501             *params = 0;
502             break;
503         case GR_GL_VIEWPORT:
504             params[0] = 0;
505             params[1] = 0;
506             params[2] = 800;
507             params[3] = 600;
508             break;
509         case GR_GL_MAX_TEXTURE_IMAGE_UNITS:
510             *params = 8;
511             break;
512         case GR_GL_MAX_TEXTURE_COORDS:
513             *params = 8;
514             break;
515         case GR_GL_MAX_VERTEX_UNIFORM_VECTORS:
516             *params = kDefaultMaxVertexUniformVectors;
517             break;
518         case GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS:
519             *params = kDefaultMaxFragmentUniformVectors;
520             break;
521         case GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
522             *params = 16 * 4;
523             break;
524         case GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS:
525             *params = 0;
526             break;
527         case GR_GL_COMPRESSED_TEXTURE_FORMATS:
528             break;
529         case GR_GL_MAX_TEXTURE_SIZE:
530             *params = 8192;
531             break;
532         case GR_GL_MAX_RENDERBUFFER_SIZE:
533             *params = 8192;
534             break;
535         case GR_GL_MAX_SAMPLES:
536             *params = 32;
537             break;
538         case GR_GL_MAX_VERTEX_ATTRIBS:
539             *params = kDefaultMaxVertexAttribs;
540             break;
541         case GR_GL_MAX_VARYING_VECTORS:
542             *params = kDefaultMaxVaryingVectors;
543             break;
544         case GR_GL_NUM_EXTENSIONS:
545             *params = SK_ARRAY_COUNT(kExtensions);
546             break;
547         default:
548             SkFAIL("Unexpected pname to GetIntegerv");
549    }
550 }
551 
noOpGLGetInfoLog(GrGLuint program,GrGLsizei bufsize,GrGLsizei * length,char * infolog)552 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetInfoLog(GrGLuint program,
553                                               GrGLsizei bufsize,
554                                               GrGLsizei* length,
555                                               char* infolog) {
556     if (length) {
557         *length = 0;
558    }
559     if (bufsize > 0) {
560         *infolog = 0;
561    }
562 }
563 
noOpGLGetShaderOrProgramiv(GrGLuint program,GrGLenum pname,GrGLint * params)564 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetShaderOrProgramiv(GrGLuint program,
565                                                         GrGLenum pname,
566                                                         GrGLint* params) {
567     switch (pname) {
568         case GR_GL_LINK_STATUS:  // fallthru
569         case GR_GL_COMPILE_STATUS:
570             *params = GR_GL_TRUE;
571             break;
572         case GR_GL_INFO_LOG_LENGTH:
573             *params = 0;
574             break;
575         // we don't expect any other pnames
576         default:
577             SkFAIL("Unexpected pname to GetProgramiv");
578             break;
579    }
580 }
581 
582 namespace {
583 template <typename T>
query_result(GrGLenum GLtarget,GrGLenum pname,T * params)584 void query_result(GrGLenum GLtarget, GrGLenum pname, T *params) {
585     switch (pname) {
586         case GR_GL_QUERY_RESULT_AVAILABLE:
587             *params = GR_GL_TRUE;
588             break;
589         case GR_GL_QUERY_RESULT:
590             *params = 0;
591             break;
592         default:
593             SkFAIL("Unexpected pname passed to GetQueryObject.");
594             break;
595    }
596 }
597 }
598 
noOpGLGetQueryiv(GrGLenum GLtarget,GrGLenum pname,GrGLint * params)599 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryiv(GrGLenum GLtarget,
600                                               GrGLenum pname,
601                                               GrGLint *params) {
602     switch (pname) {
603         case GR_GL_CURRENT_QUERY:
604             *params = 0;
605             break;
606         case GR_GL_QUERY_COUNTER_BITS:
607             *params = 32;
608             break;
609         default:
610             SkFAIL("Unexpected pname passed GetQueryiv.");
611    }
612 }
613 
noOpGLGetQueryObjecti64v(GrGLuint id,GrGLenum pname,GrGLint64 * params)614 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryObjecti64v(GrGLuint id,
615                                                       GrGLenum pname,
616                                                       GrGLint64 *params) {
617     query_result(id, pname, params);
618 }
619 
noOpGLGetQueryObjectiv(GrGLuint id,GrGLenum pname,GrGLint * params)620 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryObjectiv(GrGLuint id,
621                                                     GrGLenum pname,
622                                                     GrGLint *params) {
623     query_result(id, pname, params);
624 }
625 
noOpGLGetQueryObjectui64v(GrGLuint id,GrGLenum pname,GrGLuint64 * params)626 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryObjectui64v(GrGLuint id,
627                                                        GrGLenum pname,
628                                                        GrGLuint64 *params) {
629     query_result(id, pname, params);
630 }
631 
noOpGLGetQueryObjectuiv(GrGLuint id,GrGLenum pname,GrGLuint * params)632 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetQueryObjectuiv(GrGLuint id,
633                                                      GrGLenum pname,
634                                                      GrGLuint *params) {
635     query_result(id, pname, params);
636 }
637 
noOpGLGetString(GrGLenum name)638 const GrGLubyte* GR_GL_FUNCTION_TYPE noOpGLGetString(GrGLenum name) {
639     switch (name) {
640         case GR_GL_EXTENSIONS:
641             return combined_extensions_string();
642         case GR_GL_VERSION:
643             return (const GrGLubyte*)"4.0 Debug GL";
644         case GR_GL_SHADING_LANGUAGE_VERSION:
645             return (const GrGLubyte*)"4.20.8 Debug GLSL";
646         case GR_GL_VENDOR:
647             return (const GrGLubyte*)"Debug Vendor";
648         case GR_GL_RENDERER:
649             return (const GrGLubyte*)"The Debug (Non-)Renderer";
650         default:
651             SkFAIL("Unexpected name passed to GetString");
652             return nullptr;
653    }
654 }
655 
noOpGLGetStringi(GrGLenum name,GrGLuint i)656 const GrGLubyte* GR_GL_FUNCTION_TYPE noOpGLGetStringi(GrGLenum name, GrGLuint i) {
657     switch (name) {
658         case GR_GL_EXTENSIONS:
659             if (static_cast<size_t>(i) <= SK_ARRAY_COUNT(kExtensions)) {
660                 return (const GrGLubyte*) kExtensions[i];
661             } else {
662                 return nullptr;
663             }
664         default:
665             SkFAIL("Unexpected name passed to GetStringi");
666             return nullptr;
667     }
668 }
669 
noOpGLGetTexLevelParameteriv(GrGLenum target,GrGLint level,GrGLenum pname,GrGLint * params)670 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLGetTexLevelParameteriv(GrGLenum target,
671                                                           GrGLint level,
672                                                           GrGLenum pname,
673                                                           GrGLint* params) {
674     // we used to use this to query stuff about externally created textures,
675     // now we just require clients to tell us everything about the texture.
676     SkFAIL("Should never query texture parameters.");
677 }
678 
noOpGLGetUniformLocation(GrGLuint program,const char * name)679 GrGLint GR_GL_FUNCTION_TYPE noOpGLGetUniformLocation(GrGLuint program, const char* name) {
680     static int gUniLocation = 0;
681     return ++gUniLocation;
682 }
683 
noOpGLInsertEventMarker(GrGLsizei length,const char * marker)684 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLInsertEventMarker(GrGLsizei length, const char* marker) {
685 }
noOpGLPushGroupMarker(GrGLsizei length,const char * marker)686 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLPushGroupMarker(GrGLsizei length  , const char* marker) {
687 }
noOpGLPopGroupMarker()688 GrGLvoid GR_GL_FUNCTION_TYPE noOpGLPopGroupMarker() {
689 }
690