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