Add more components tests to GN build.
[chromium-blink-merge.git] / ui / gl / gl_bindings_skia_in_process.cc
blobd76bd7aba160845feac916ba5c51cb2694aee5e9
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 #include "ui/gl/gl_bindings_skia_in_process.h"
8 #include "base/logging.h"
9 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
10 #include "ui/gl/gl_bindings.h"
11 #include "ui/gl/gl_implementation.h"
13 namespace {
15 extern "C" {
16 // The following stub functions are required because the glXXX routines exported
17 // via gl_bindings.h use call-type GL_BINDING_CALL, which on Windows is stdcall.
18 // Skia has been built such that its GrGLInterface GL pointers are __cdecl.
20 GLvoid GR_GL_FUNCTION_TYPE StubGLActiveTexture(GLenum texture) {
21 glActiveTexture(texture);
24 GLvoid GR_GL_FUNCTION_TYPE StubGLAttachShader(GLuint program, GLuint shader) {
25 glAttachShader(program, shader);
28 GLvoid GR_GL_FUNCTION_TYPE StubGLBeginQuery(GLenum target, GLuint id) {
29 glBeginQuery(target, id);
32 GLvoid GR_GL_FUNCTION_TYPE StubGLBindAttribLocation(GLuint program,
33 GLuint index,
34 const char* name) {
35 glBindAttribLocation(program, index, name);
38 GLvoid GR_GL_FUNCTION_TYPE StubGLBindBuffer(GLenum target, GLuint buffer) {
39 glBindBuffer(target, buffer);
42 GLvoid GR_GL_FUNCTION_TYPE StubGLBindFragDataLocation(GLuint program,
43 GLuint colorNumber,
44 const GLchar* name) {
45 glBindFragDataLocation(program, colorNumber, name);
48 GLvoid GR_GL_FUNCTION_TYPE
49 StubGLBindFragDataLocationIndexed(GLuint program,
50 GLuint colorNumber,
51 GLuint index,
52 const GLchar* name) {
53 glBindFragDataLocationIndexed(program, colorNumber, index, name);
56 GLvoid GR_GL_FUNCTION_TYPE StubGLBindFramebuffer(GLenum target,
57 GLuint framebuffer) {
58 glBindFramebufferEXT(target, framebuffer);
61 GLvoid GR_GL_FUNCTION_TYPE StubGLBindRenderbuffer(GLenum target,
62 GLuint renderbuffer) {
63 glBindRenderbufferEXT(target, renderbuffer);
66 GLvoid GR_GL_FUNCTION_TYPE StubGLBindTexture(GLenum target, GLuint texture) {
67 glBindTexture(target, texture);
70 GLvoid GR_GL_FUNCTION_TYPE StubGLBindVertexArray(GLuint array) {
71 glBindVertexArrayOES(array);
74 GLvoid GR_GL_FUNCTION_TYPE StubGLBlendBarrier() {
75 glBlendBarrierKHR();
78 GLvoid GR_GL_FUNCTION_TYPE StubGLBlendColor(GLclampf red,
79 GLclampf green,
80 GLclampf blue,
81 GLclampf alpha) {
82 glBlendColor(red, green, blue, alpha);
85 GLvoid GR_GL_FUNCTION_TYPE StubGLBlendEquation(GLenum mode) {
86 glBlendEquation(mode);
89 GLvoid GR_GL_FUNCTION_TYPE StubGLBlendFunc(GLenum sfactor, GLenum dfactor) {
90 glBlendFunc(sfactor, dfactor);
93 GLvoid GR_GL_FUNCTION_TYPE StubGLBlitFramebuffer(GLint srcX0,
94 GLint srcY0,
95 GLint srcX1,
96 GLint srcY1,
97 GLint dstX0,
98 GLint dstY0,
99 GLint dstX1,
100 GLint dstY1,
101 GLbitfield mask,
102 GLenum filter) {
103 glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
104 mask, filter);
107 GLvoid GR_GL_FUNCTION_TYPE StubGLBufferData(GLenum target,
108 GLsizeiptr size,
109 const void* data,
110 GLenum usage) {
111 glBufferData(target, size, data, usage);
114 GLvoid GR_GL_FUNCTION_TYPE StubGLBufferSubData(GLenum target,
115 GLintptr offset,
116 GLsizeiptr size,
117 const void* data) {
118 glBufferSubData(target, offset, size, data);
121 GLenum GR_GL_FUNCTION_TYPE StubGLCheckFramebufferStatus(GLenum target) {
122 return glCheckFramebufferStatusEXT(target);
125 GLvoid GR_GL_FUNCTION_TYPE StubGLClear(GLbitfield mask) {
126 glClear(mask);
129 GLvoid GR_GL_FUNCTION_TYPE StubGLClearColor(GLclampf red,
130 GLclampf green,
131 GLclampf blue,
132 GLclampf alpha) {
133 glClearColor(red, green, blue, alpha);
136 GLvoid GR_GL_FUNCTION_TYPE StubGLClearStencil(GLint s) {
137 glClearStencil(s);
140 GLvoid GR_GL_FUNCTION_TYPE StubGLColorMask(GLboolean red,
141 GLboolean green,
142 GLboolean blue,
143 GLboolean alpha) {
144 glColorMask(red, green, blue, alpha);
147 GLvoid GR_GL_FUNCTION_TYPE StubGLCompileShader(GLuint shader) {
148 glCompileShader(shader);
151 GLvoid GR_GL_FUNCTION_TYPE StubGLCompressedTexImage2D(GLenum target,
152 GLint level,
153 GLenum internalformat,
154 GLsizei width,
155 GLsizei height,
156 GLint border,
157 GLsizei imageSize,
158 const void* data) {
159 glCompressedTexImage2D(target, level, internalformat, width, height, border,
160 imageSize, data);
163 GLvoid GR_GL_FUNCTION_TYPE StubGLCopyTexSubImage2D(GLenum target,
164 GLint level,
165 GLint xoffset,
166 GLint yoffset,
167 GLint x,
168 GLint y,
169 GLsizei width,
170 GLsizei height) {
171 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
174 GLuint GR_GL_FUNCTION_TYPE StubGLCreateProgram(void) {
175 return glCreateProgram();
178 GLuint GR_GL_FUNCTION_TYPE StubGLCreateShader(GLenum type) {
179 return glCreateShader(type);
182 GLvoid GR_GL_FUNCTION_TYPE StubGLCullFace(GLenum mode) {
183 glCullFace(mode);
186 GLvoid GR_GL_FUNCTION_TYPE StubGLDeleteBuffers(GLsizei n,
187 const GLuint* buffers) {
188 glDeleteBuffersARB(n, buffers);
191 GLvoid GR_GL_FUNCTION_TYPE
192 StubGLDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) {
193 glDeleteFramebuffersEXT(n, framebuffers);
196 GLvoid GR_GL_FUNCTION_TYPE StubGLDeleteQueries(GLsizei n, const GLuint* ids) {
197 glDeleteQueries(n, ids);
200 GLvoid GR_GL_FUNCTION_TYPE StubGLDeleteProgram(GLuint program) {
201 glDeleteProgram(program);
204 GLvoid GR_GL_FUNCTION_TYPE
205 StubGLDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) {
206 glDeleteRenderbuffersEXT(n, renderbuffers);
209 GLvoid GR_GL_FUNCTION_TYPE StubGLDeleteShader(GLuint shader) {
210 glDeleteShader(shader);
213 GLvoid GR_GL_FUNCTION_TYPE StubGLDeleteTextures(GLsizei n,
214 const GLuint* textures) {
215 glDeleteTextures(n, textures);
218 GLvoid GR_GL_FUNCTION_TYPE StubGLDeleteVertexArrays(GLsizei n,
219 const GLuint* arrays) {
220 glDeleteVertexArraysOES(n, arrays);
223 GLvoid GR_GL_FUNCTION_TYPE StubGLDepthMask(GLboolean flag) {
224 glDepthMask(flag);
227 GLvoid GR_GL_FUNCTION_TYPE StubGLDisable(GLenum cap) {
228 glDisable(cap);
231 GLvoid GR_GL_FUNCTION_TYPE StubGLDisableVertexAttribArray(GLuint index) {
232 glDisableVertexAttribArray(index);
235 GLvoid GR_GL_FUNCTION_TYPE StubGLDiscardFramebuffer(GLenum target,
236 GLsizei numAttachments,
237 const GLenum* attachments) {
238 glDiscardFramebufferEXT(target, numAttachments, attachments);
241 GLvoid GR_GL_FUNCTION_TYPE StubGLDrawArrays(GLenum mode,
242 GLint first,
243 GLsizei count) {
244 glDrawArrays(mode, first, count);
247 GLvoid GR_GL_FUNCTION_TYPE StubGLDrawBuffer(GLenum mode) {
248 glDrawBuffer(mode);
251 GLvoid GR_GL_FUNCTION_TYPE StubGLDrawBuffers(GLsizei n, const GLenum* bufs) {
252 glDrawBuffersARB(n, bufs);
255 GLvoid GR_GL_FUNCTION_TYPE StubGLDrawElements(GLenum mode,
256 GLsizei count,
257 GLenum type,
258 const void* indices) {
259 glDrawElements(mode, count, type, indices);
262 GLvoid GR_GL_FUNCTION_TYPE StubGLEnable(GLenum cap) {
263 glEnable(cap);
266 GLvoid GR_GL_FUNCTION_TYPE StubGLEnableVertexAttribArray(GLuint index) {
267 glEnableVertexAttribArray(index);
270 GLvoid GR_GL_FUNCTION_TYPE StubGLEndQuery(GLenum target) {
271 glEndQuery(target);
274 GLvoid GR_GL_FUNCTION_TYPE StubGLFinish() {
275 glFinish();
278 GLvoid GR_GL_FUNCTION_TYPE StubGLFlush() {
279 glFlush();
282 GLvoid GR_GL_FUNCTION_TYPE StubGLFlushMappedBufferRange(GLenum target,
283 GLintptr offset,
284 GLsizeiptr length) {
285 glFlushMappedBufferRange(target, offset, length);
288 GLvoid GR_GL_FUNCTION_TYPE
289 StubGLFramebufferRenderbuffer(GLenum target,
290 GLenum attachment,
291 GLenum renderbuffertarget,
292 GLuint renderbuffer) {
293 glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget,
294 renderbuffer);
297 GLvoid GR_GL_FUNCTION_TYPE StubGLFramebufferTexture2D(GLenum target,
298 GLenum attachment,
299 GLenum textarget,
300 GLuint texture,
301 GLint level) {
302 glFramebufferTexture2DEXT(target, attachment, textarget, texture, level);
305 GLvoid GR_GL_FUNCTION_TYPE
306 StubGLFramebufferTexture2DMultisample(GLenum target,
307 GLenum attachment,
308 GLenum textarget,
309 GLuint texture,
310 GLint level,
311 GLsizei samples) {
312 glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, texture,
313 level, samples);
316 GLvoid GR_GL_FUNCTION_TYPE StubGLFrontFace(GLenum mode) {
317 glFrontFace(mode);
320 GLvoid GR_GL_FUNCTION_TYPE StubGLGenBuffers(GLsizei n, GLuint* buffers) {
321 glGenBuffersARB(n, buffers);
324 GLvoid GR_GL_FUNCTION_TYPE StubGLGenFramebuffers(GLsizei n,
325 GLuint* framebuffers) {
326 glGenFramebuffersEXT(n, framebuffers);
329 GLvoid GR_GL_FUNCTION_TYPE StubGLGenQueries(GLsizei n, GLuint* ids) {
330 glGenQueries(n, ids);
333 GLvoid GR_GL_FUNCTION_TYPE StubGLGenRenderbuffers(GLsizei n,
334 GLuint* renderbuffers) {
335 glGenRenderbuffersEXT(n, renderbuffers);
338 GLvoid GR_GL_FUNCTION_TYPE StubGLGenTextures(GLsizei n, GLuint* textures) {
339 glGenTextures(n, textures);
342 GLvoid GR_GL_FUNCTION_TYPE StubGLGenVertexArrays(GLsizei n, GLuint* arrays) {
343 glGenVertexArraysOES(n, arrays);
346 GLvoid GR_GL_FUNCTION_TYPE StubGLGenerateMipmap(GLenum target) {
347 glGenerateMipmapEXT(target);
350 GLvoid GR_GL_FUNCTION_TYPE StubGLGetBufferParameteriv(GLenum target,
351 GLenum pname,
352 GLint* params) {
353 glGetBufferParameteriv(target, pname, params);
356 GLvoid GR_GL_FUNCTION_TYPE
357 StubGLGetFramebufferAttachmentParameteriv(GLenum target,
358 GLenum attachment,
359 GLenum pname,
360 GLint* params) {
361 glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params);
364 GLenum GR_GL_FUNCTION_TYPE StubGLGetError() {
365 return glGetError();
368 GLvoid GR_GL_FUNCTION_TYPE StubGLGetIntegerv(GLenum pname, GLint* params) {
369 glGetIntegerv(pname, params);
372 GLvoid GR_GL_FUNCTION_TYPE StubGLGetProgramInfoLog(GLuint program,
373 GLsizei bufsize,
374 GLsizei* length,
375 char* infolog) {
376 glGetProgramInfoLog(program, bufsize, length, infolog);
379 GLvoid GR_GL_FUNCTION_TYPE StubGLGetProgramiv(GLuint program,
380 GLenum pname,
381 GLint* params) {
382 glGetProgramiv(program, pname, params);
385 GLvoid GR_GL_FUNCTION_TYPE StubGLGetRenderbufferParameteriv(GLenum target,
386 GLenum pname,
387 GLint* params) {
388 glGetRenderbufferParameterivEXT(target, pname, params);
391 GLvoid GR_GL_FUNCTION_TYPE StubGLGetShaderInfoLog(GLuint shader,
392 GLsizei bufsize,
393 GLsizei* length,
394 char* infolog) {
395 glGetShaderInfoLog(shader, bufsize, length, infolog);
398 GLvoid GR_GL_FUNCTION_TYPE StubGLGetShaderiv(GLuint shader,
399 GLenum pname,
400 GLint* params) {
401 glGetShaderiv(shader, pname, params);
404 GLvoid GR_GL_FUNCTION_TYPE StubGLGetShaderPrecisionFormat(GLenum shadertype,
405 GLenum precisiontype,
406 GLint* range,
407 GLint* precision) {
408 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
411 const GLubyte* GR_GL_FUNCTION_TYPE StubGLGetString(GLenum name) {
412 return glGetString(name);
415 const GLubyte* GR_GL_FUNCTION_TYPE StubGLGetStringi(GLenum name, GLuint index) {
416 return glGetStringi(name, index);
419 GLvoid GR_GL_FUNCTION_TYPE StubGLGetQueryiv(GLenum target,
420 GLenum pname,
421 GLint* params) {
422 glGetQueryiv(target, pname, params);
425 GLvoid GR_GL_FUNCTION_TYPE StubGLGetQueryObjecti64v(GLuint id,
426 GLenum pname,
427 GLint64* params) {
428 glGetQueryObjecti64v(id, pname, params);
431 GLvoid GR_GL_FUNCTION_TYPE StubGLGetQueryObjectiv(GLuint id,
432 GLenum pname,
433 GLint* params) {
434 glGetQueryObjectiv(id, pname, params);
437 GLvoid GR_GL_FUNCTION_TYPE StubGLGetQueryObjectui64v(GLuint id,
438 GLenum pname,
439 GLuint64* params) {
440 glGetQueryObjectui64v(id, pname, params);
443 GLvoid GR_GL_FUNCTION_TYPE StubGLGetQueryObjectuiv(GLuint id,
444 GLenum pname,
445 GLuint* params) {
446 glGetQueryObjectuiv(id, pname, params);
449 GLvoid GR_GL_FUNCTION_TYPE StubGLGetTexLevelParameteriv(GLenum target,
450 GLint level,
451 GLenum pname,
452 GLint* params) {
453 glGetTexLevelParameteriv(target, level, pname, params);
456 GLint GR_GL_FUNCTION_TYPE StubGLGetUniformLocation(GLuint program,
457 const char* name) {
458 return glGetUniformLocation(program, name);
461 GLvoid GR_GL_FUNCTION_TYPE StubGLInsertEventMarker(GLsizei length,
462 const char* marker) {
463 glInsertEventMarkerEXT(length, marker);
466 GLvoid GR_GL_FUNCTION_TYPE
467 StubGLInvalidateFramebuffer(GLenum target,
468 GLsizei numAttachments,
469 const GLenum* attachments) {
470 glInvalidateFramebuffer(target, numAttachments, attachments);
473 GLvoid GR_GL_FUNCTION_TYPE
474 StubGLInvalidateSubFramebuffer(GLenum target,
475 GLsizei numAttachments,
476 const GLenum* attachments,
477 GLint x,
478 GLint y,
479 GLsizei width,
480 GLsizei height) {
481 glInvalidateSubFramebuffer(target, numAttachments, attachments,
482 x, y, width, height);
485 GLvoid GR_GL_FUNCTION_TYPE StubGLLineWidth(GLfloat width) {
486 glLineWidth(width);
489 GLvoid GR_GL_FUNCTION_TYPE StubGLLinkProgram(GLuint program) {
490 glLinkProgram(program);
493 void* GR_GL_FUNCTION_TYPE StubGLMapBuffer(GLenum target, GLenum access) {
494 return glMapBuffer(target, access);
497 void* GR_GL_FUNCTION_TYPE StubGLMapBufferRange(GLenum target,
498 GLintptr offset,
499 GLsizeiptr length,
500 GLbitfield access) {
501 return glMapBufferRange(target, offset, length, access);
504 GLvoid GR_GL_FUNCTION_TYPE StubGLPixelStorei(GLenum pname, GLint param) {
505 glPixelStorei(pname, param);
508 GLvoid GR_GL_FUNCTION_TYPE StubGLPopGroupMarker() {
509 glPopGroupMarkerEXT();
512 GLvoid GR_GL_FUNCTION_TYPE StubGLPushGroupMarker(GLsizei length,
513 const char* marker) {
514 glPushGroupMarkerEXT(length, marker);
517 GLvoid GR_GL_FUNCTION_TYPE StubGLQueryCounter(GLuint id, GLenum target) {
518 glQueryCounter(id, target);
521 GLvoid GR_GL_FUNCTION_TYPE StubGLReadBuffer(GLenum src) {
522 glReadBuffer(src);
525 GLvoid GR_GL_FUNCTION_TYPE StubGLReadPixels(GLint x,
526 GLint y,
527 GLsizei width,
528 GLsizei height,
529 GLenum format,
530 GLenum type,
531 void* pixels) {
532 glReadPixels(x, y, width, height, format, type, pixels);
535 GLvoid GR_GL_FUNCTION_TYPE StubGLRenderbufferStorage(GLenum target,
536 GLenum internalformat,
537 GLsizei width,
538 GLsizei height) {
539 glRenderbufferStorageEXT(target, internalformat, width, height);
542 GLvoid GR_GL_FUNCTION_TYPE
543 StubGLRenderbufferStorageMultisample(GLenum target,
544 GLsizei samples,
545 GLenum internalformat,
546 GLsizei width,
547 GLsizei height) {
548 glRenderbufferStorageMultisampleEXT(target, samples, internalformat, width,
549 height);
552 GLvoid GR_GL_FUNCTION_TYPE StubGLScissor(GLint x,
553 GLint y,
554 GLsizei width,
555 GLsizei height) {
556 glScissor(x, y, width, height);
559 GLvoid GR_GL_FUNCTION_TYPE StubGLShaderSource(GLuint shader,
560 GLsizei count,
561 const char* const* str,
562 const GLint* length) {
563 glShaderSource(shader, count, str, length);
566 GLvoid GR_GL_FUNCTION_TYPE StubGLStencilFunc(GLenum func,
567 GLint ref,
568 GLuint mask) {
569 glStencilFunc(func, ref, mask);
572 GLvoid GR_GL_FUNCTION_TYPE StubGLStencilFuncSeparate(GLenum face,
573 GLenum func,
574 GLint ref,
575 GLuint mask) {
576 glStencilFuncSeparate(face, func, ref, mask);
579 GLvoid GR_GL_FUNCTION_TYPE StubGLStencilMask(GLuint mask) {
580 glStencilMask(mask);
583 GLvoid GR_GL_FUNCTION_TYPE StubGLStencilMaskSeparate(GLenum face, GLuint mask) {
584 glStencilMaskSeparate(face, mask);
587 GLvoid GR_GL_FUNCTION_TYPE StubGLStencilOp(GLenum fail,
588 GLenum zfail,
589 GLenum zpass) {
590 glStencilOp(fail, zfail, zpass);
593 GLvoid GR_GL_FUNCTION_TYPE StubGLStencilOpSeparate(GLenum face,
594 GLenum fail,
595 GLenum zfail,
596 GLenum zpass) {
597 glStencilOpSeparate(face, fail, zfail, zpass);
600 GLvoid GR_GL_FUNCTION_TYPE StubGLTexImage2D(GLenum target,
601 GLint level,
602 GLint internalformat,
603 GLsizei width,
604 GLsizei height,
605 GLint border,
606 GLenum format,
607 GLenum type,
608 const void* pixels) {
609 glTexImage2D(target, level, internalformat, width, height, border, format,
610 type, pixels);
613 GLvoid GR_GL_FUNCTION_TYPE StubGLTexParameteri(GLenum target,
614 GLenum pname,
615 GLint param) {
616 glTexParameteri(target, pname, param);
619 GLvoid GR_GL_FUNCTION_TYPE StubGLTexParameteriv(GLenum target,
620 GLenum pname,
621 const GLint* params) {
622 glTexParameteriv(target, pname, params);
625 GLvoid GR_GL_FUNCTION_TYPE StubGLTexStorage2D(GLenum target,
626 GLsizei levels,
627 GLenum internalFormat,
628 GLsizei width,
629 GLsizei height) {
630 glTexStorage2DEXT(target, levels, internalFormat, width, height);
633 GLvoid GR_GL_FUNCTION_TYPE StubGLTexSubImage2D(GLenum target,
634 GLint level,
635 GLint xoffset,
636 GLint yoffset,
637 GLsizei width,
638 GLsizei height,
639 GLenum format,
640 GLenum type,
641 const void* pixels) {
642 glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
643 pixels);
646 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform1f(GLint location, GLfloat v) {
647 glUniform1f(location, v);
650 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform1i(GLint location, GLint v) {
651 glUniform1i(location, v);
654 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform1fv(GLint location,
655 GLsizei count,
656 const GLfloat* v) {
657 glUniform1fv(location, count, v);
660 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform1iv(GLint location,
661 GLsizei count,
662 const GLint* v) {
663 glUniform1iv(location, count, v);
666 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform2f(GLint location,
667 GLfloat v0,
668 GLfloat v1) {
669 glUniform2f(location, v0, v1);
672 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform2i(GLint location, GLint v0, GLint v1) {
673 glUniform2i(location, v0, v1);
676 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform2fv(GLint location,
677 GLsizei count,
678 const GLfloat* v) {
679 glUniform2fv(location, count, v);
682 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform2iv(GLint location,
683 GLsizei count,
684 const GLint* v) {
685 glUniform2iv(location, count, v);
688 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform3f(GLint location,
689 GLfloat v0,
690 GLfloat v1,
691 GLfloat v2) {
692 glUniform3f(location, v0, v1, v2);
695 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform3i(GLint location,
696 GLint v0,
697 GLint v1,
698 GLint v2) {
699 glUniform3i(location, v0, v1, v2);
702 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform3fv(GLint location,
703 GLsizei count,
704 const GLfloat* v) {
705 glUniform3fv(location, count, v);
708 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform3iv(GLint location,
709 GLsizei count,
710 const GLint* v) {
711 glUniform3iv(location, count, v);
714 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform4f(GLint location,
715 GLfloat v0,
716 GLfloat v1,
717 GLfloat v2,
718 GLfloat v3) {
719 glUniform4f(location, v0, v1, v2, v3);
722 GLvoid GR_GL_FUNCTION_TYPE
723 StubGLUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) {
724 glUniform4i(location, v0, v1, v2, v3);
727 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform4fv(GLint location,
728 GLsizei count,
729 const GLfloat* v) {
730 glUniform4fv(location, count, v);
733 GLvoid GR_GL_FUNCTION_TYPE StubGLUniform4iv(GLint location,
734 GLsizei count,
735 const GLint* v) {
736 glUniform4iv(location, count, v);
739 GLvoid GR_GL_FUNCTION_TYPE StubGLUniformMatrix2fv(GLint location,
740 GLsizei count,
741 GLboolean transpose,
742 const GLfloat* value) {
743 glUniformMatrix2fv(location, count, transpose, value);
746 GLvoid GR_GL_FUNCTION_TYPE StubGLUniformMatrix3fv(GLint location,
747 GLsizei count,
748 GLboolean transpose,
749 const GLfloat* value) {
750 glUniformMatrix3fv(location, count, transpose, value);
753 GLvoid GR_GL_FUNCTION_TYPE StubGLUniformMatrix4fv(GLint location,
754 GLsizei count,
755 GLboolean transpose,
756 const GLfloat* value) {
757 glUniformMatrix4fv(location, count, transpose, value);
760 GLboolean GR_GL_FUNCTION_TYPE StubGLUnmapBuffer(GLenum target) {
761 return glUnmapBuffer(target);
764 GLvoid GR_GL_FUNCTION_TYPE StubGLUseProgram(GLuint program) {
765 glUseProgram(program);
768 GLvoid GR_GL_FUNCTION_TYPE StubGLVertexAttrib1f(GLuint indx,
769 const GLfloat value) {
770 glVertexAttrib1f(indx, value);
773 GLvoid GR_GL_FUNCTION_TYPE StubGLVertexAttrib2fv(GLuint indx,
774 const GLfloat* values) {
775 glVertexAttrib2fv(indx, values);
778 GLvoid GR_GL_FUNCTION_TYPE StubGLVertexAttrib3fv(GLuint indx,
779 const GLfloat* values) {
780 glVertexAttrib3fv(indx, values);
783 GLvoid GR_GL_FUNCTION_TYPE StubGLVertexAttrib4fv(GLuint indx,
784 const GLfloat* values) {
785 glVertexAttrib4fv(indx, values);
788 GLvoid GR_GL_FUNCTION_TYPE StubGLVertexAttribPointer(GLuint indx,
789 GLint size,
790 GLenum type,
791 GLboolean normalized,
792 GLsizei stride,
793 const void* ptr) {
794 glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
797 GLvoid GR_GL_FUNCTION_TYPE StubGLViewport(GLint x,
798 GLint y,
799 GLsizei width,
800 GLsizei height) {
801 glViewport(x, y, width, height);
804 GLint GR_GL_FUNCTION_TYPE
805 StubGLGetProgramResourceLocation(GLuint program,
806 GLenum programInterface,
807 const char* name) {
808 return glGetProgramResourceLocation(program, programInterface, name);
811 } // extern "C"
812 } // namespace
814 namespace gfx {
816 GrGLInterface* CreateInProcessSkiaGLBinding() {
817 GrGLStandard standard;
818 switch (gfx::GetGLImplementation()) {
819 case gfx::kGLImplementationNone:
820 NOTREACHED();
821 return NULL;
822 case gfx::kGLImplementationDesktopGL:
823 case gfx::kGLImplementationAppleGL:
824 standard = kGL_GrGLStandard;
825 break;
826 case gfx::kGLImplementationOSMesaGL:
827 standard = kGL_GrGLStandard;
828 break;
829 case gfx::kGLImplementationEGLGLES2:
830 standard = kGLES_GrGLStandard;
831 break;
832 case gfx::kGLImplementationMockGL:
833 NOTREACHED();
834 return NULL;
835 default:
836 NOTREACHED();
837 return NULL;
840 GrGLInterface* interface = new GrGLInterface;
841 interface->fStandard = standard;
842 interface->fExtensions.init(standard,
843 StubGLGetString,
844 StubGLGetStringi,
845 StubGLGetIntegerv);
847 GrGLInterface::Functions* functions = &interface->fFunctions;
848 functions->fActiveTexture = StubGLActiveTexture;
849 functions->fAttachShader = StubGLAttachShader;
850 functions->fBeginQuery = StubGLBeginQuery;
851 functions->fBindAttribLocation = StubGLBindAttribLocation;
852 functions->fBindBuffer = StubGLBindBuffer;
853 functions->fBindFragDataLocation = StubGLBindFragDataLocation;
854 functions->fBindTexture = StubGLBindTexture;
855 functions->fBindVertexArray = StubGLBindVertexArray;
856 functions->fBlendBarrier = StubGLBlendBarrier;
857 functions->fBlendColor = StubGLBlendColor;
858 functions->fBlendEquation = StubGLBlendEquation;
859 functions->fBlendFunc = StubGLBlendFunc;
860 functions->fBufferData = StubGLBufferData;
861 functions->fBufferSubData = StubGLBufferSubData;
862 functions->fClear = StubGLClear;
863 functions->fClearColor = StubGLClearColor;
864 functions->fClearStencil = StubGLClearStencil;
865 functions->fColorMask = StubGLColorMask;
866 functions->fCompileShader = StubGLCompileShader;
867 functions->fCompressedTexImage2D = StubGLCompressedTexImage2D;
868 functions->fCopyTexSubImage2D = StubGLCopyTexSubImage2D;
869 functions->fCreateProgram = StubGLCreateProgram;
870 functions->fCreateShader = StubGLCreateShader;
871 functions->fCullFace = StubGLCullFace;
872 functions->fDeleteBuffers = StubGLDeleteBuffers;
873 functions->fDeleteProgram = StubGLDeleteProgram;
874 functions->fDeleteQueries = StubGLDeleteQueries;
875 functions->fDeleteShader = StubGLDeleteShader;
876 functions->fDeleteTextures = StubGLDeleteTextures;
877 functions->fDeleteVertexArrays = StubGLDeleteVertexArrays;
878 functions->fDepthMask = StubGLDepthMask;
879 functions->fDisable = StubGLDisable;
880 functions->fDisableVertexAttribArray = StubGLDisableVertexAttribArray;
881 functions->fDiscardFramebuffer = StubGLDiscardFramebuffer;
882 functions->fDrawArrays = StubGLDrawArrays;
883 functions->fDrawBuffer = StubGLDrawBuffer;
884 functions->fDrawBuffers = StubGLDrawBuffers;
885 functions->fDrawElements = StubGLDrawElements;
886 functions->fEnable = StubGLEnable;
887 functions->fEnableVertexAttribArray = StubGLEnableVertexAttribArray;
888 functions->fEndQuery = StubGLEndQuery;
889 functions->fFinish = StubGLFinish;
890 functions->fFlush = StubGLFlush;
891 functions->fFlushMappedBufferRange = StubGLFlushMappedBufferRange;
892 functions->fFrontFace = StubGLFrontFace;
893 functions->fGenBuffers = StubGLGenBuffers;
894 functions->fGenQueries = StubGLGenQueries;
895 functions->fGenTextures = StubGLGenTextures;
896 functions->fGenVertexArrays = StubGLGenVertexArrays;
897 functions->fGenerateMipmap = StubGLGenerateMipmap;
898 functions->fGetBufferParameteriv = StubGLGetBufferParameteriv;
899 functions->fGetError = StubGLGetError;
900 functions->fGetIntegerv = StubGLGetIntegerv;
901 functions->fGetQueryiv = StubGLGetQueryiv;
902 functions->fGetQueryObjecti64v = StubGLGetQueryObjecti64v;
903 functions->fGetQueryObjectiv = StubGLGetQueryObjectiv;
904 functions->fGetQueryObjectui64v = StubGLGetQueryObjectui64v;
905 functions->fGetQueryObjectuiv = StubGLGetQueryObjectuiv;
906 functions->fGetProgramInfoLog = StubGLGetProgramInfoLog;
907 functions->fGetProgramiv = StubGLGetProgramiv;
908 functions->fGetShaderInfoLog = StubGLGetShaderInfoLog;
909 functions->fGetShaderiv = StubGLGetShaderiv;
910 functions->fGetShaderPrecisionFormat = StubGLGetShaderPrecisionFormat;
911 functions->fGetString = StubGLGetString;
912 functions->fGetStringi = StubGLGetStringi;
913 functions->fGetTexLevelParameteriv = StubGLGetTexLevelParameteriv;
914 functions->fGetUniformLocation = StubGLGetUniformLocation;
915 functions->fInsertEventMarker = StubGLInsertEventMarker;
916 functions->fInvalidateFramebuffer = StubGLInvalidateFramebuffer;
917 functions->fInvalidateSubFramebuffer = StubGLInvalidateSubFramebuffer;
918 functions->fLineWidth = StubGLLineWidth;
919 functions->fLinkProgram = StubGLLinkProgram;
920 functions->fMapBufferRange = StubGLMapBufferRange;
921 functions->fPixelStorei = StubGLPixelStorei;
922 functions->fPopGroupMarker = StubGLPopGroupMarker;
923 functions->fPushGroupMarker = StubGLPushGroupMarker;
924 functions->fQueryCounter = StubGLQueryCounter;
925 functions->fReadBuffer = StubGLReadBuffer;
926 functions->fReadPixels = StubGLReadPixels;
927 functions->fScissor = StubGLScissor;
928 functions->fShaderSource = StubGLShaderSource;
929 functions->fStencilFunc = StubGLStencilFunc;
930 functions->fStencilFuncSeparate = StubGLStencilFuncSeparate;
931 functions->fStencilMask = StubGLStencilMask;
932 functions->fStencilMaskSeparate = StubGLStencilMaskSeparate;
933 functions->fStencilOp = StubGLStencilOp;
934 functions->fStencilOpSeparate = StubGLStencilOpSeparate;
935 functions->fTexImage2D = StubGLTexImage2D;
936 functions->fTexParameteri = StubGLTexParameteri;
937 functions->fTexParameteriv = StubGLTexParameteriv;
938 functions->fTexSubImage2D = StubGLTexSubImage2D;
939 functions->fTexStorage2D = StubGLTexStorage2D;
940 functions->fUniform1f = StubGLUniform1f;
941 functions->fUniform1i = StubGLUniform1i;
942 functions->fUniform1fv = StubGLUniform1fv;
943 functions->fUniform1iv = StubGLUniform1iv;
944 functions->fUniform2f = StubGLUniform2f;
945 functions->fUniform2i = StubGLUniform2i;
946 functions->fUniform2fv = StubGLUniform2fv;
947 functions->fUniform2iv = StubGLUniform2iv;
948 functions->fUniform3f = StubGLUniform3f;
949 functions->fUniform3i = StubGLUniform3i;
950 functions->fUniform3fv = StubGLUniform3fv;
951 functions->fUniform3iv = StubGLUniform3iv;
952 functions->fUniform4f = StubGLUniform4f;
953 functions->fUniform4i = StubGLUniform4i;
954 functions->fUniform4fv = StubGLUniform4fv;
955 functions->fUniform4iv = StubGLUniform4iv;
956 functions->fUniformMatrix2fv = StubGLUniformMatrix2fv;
957 functions->fUniformMatrix3fv = StubGLUniformMatrix3fv;
958 functions->fUniformMatrix4fv = StubGLUniformMatrix4fv;
959 functions->fUseProgram = StubGLUseProgram;
960 functions->fVertexAttrib1f = StubGLVertexAttrib1f;
961 functions->fVertexAttrib2fv = StubGLVertexAttrib2fv;
962 functions->fVertexAttrib3fv = StubGLVertexAttrib3fv;
963 functions->fVertexAttrib4fv = StubGLVertexAttrib4fv;
964 functions->fVertexAttribPointer = StubGLVertexAttribPointer;
965 functions->fViewport = StubGLViewport;
966 functions->fBindFramebuffer = StubGLBindFramebuffer;
967 functions->fBindRenderbuffer = StubGLBindRenderbuffer;
968 functions->fCheckFramebufferStatus = StubGLCheckFramebufferStatus;
969 functions->fDeleteFramebuffers = StubGLDeleteFramebuffers;
970 functions->fDeleteRenderbuffers = StubGLDeleteRenderbuffers;
971 functions->fFramebufferRenderbuffer = StubGLFramebufferRenderbuffer;
972 functions->fFramebufferTexture2D = StubGLFramebufferTexture2D;
973 functions->fFramebufferTexture2DMultisample =
974 StubGLFramebufferTexture2DMultisample;
975 functions->fGenFramebuffers = StubGLGenFramebuffers;
976 functions->fGenRenderbuffers = StubGLGenRenderbuffers;
977 functions->fGetFramebufferAttachmentParameteriv =
978 StubGLGetFramebufferAttachmentParameteriv;
979 functions->fGetRenderbufferParameteriv = StubGLGetRenderbufferParameteriv;
980 functions->fRenderbufferStorage = StubGLRenderbufferStorage;
981 functions->fRenderbufferStorageMultisample =
982 StubGLRenderbufferStorageMultisample;
983 functions->fRenderbufferStorageMultisampleES2EXT =
984 StubGLRenderbufferStorageMultisample;
985 functions->fBlitFramebuffer = StubGLBlitFramebuffer;
986 functions->fMapBuffer = StubGLMapBuffer;
987 functions->fUnmapBuffer = StubGLUnmapBuffer;
988 functions->fBindFragDataLocationIndexed =
989 StubGLBindFragDataLocationIndexed;
990 functions->fGetProgramResourceLocation = StubGLGetProgramResourceLocation;
992 return interface;
995 } // namespace gfx