summaryrefslogtreecommitdiffstats
path: root/webkit/glue/gl_bindings_skia_cmd_buffer.cc
blob: 39653e2b3be8645b9622fd94126191bb0136405a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.


#include "webkit/glue/gl_bindings_skia_cmd_buffer.h"

#ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES
#endif
#include "gpu/GLES2/gl2.h"
#include "gpu/GLES2/gl2ext.h"

#include "third_party/skia/gpu/include/GrGLInterface.h"

namespace webkit_glue {

void BindSkiaToCommandBufferGL() {
  static GrGLInterface cmd_buffer_interface = {
    kES2_GrGLBinding,

    glActiveTexture,
    glAttachShader,
    glBindAttribLocation,
    glBindBuffer,
    glBindTexture,
    glBlendColor,
    glBlendFunc,
    glBufferData,
    glBufferSubData,
    glClear,
    glClearColor,
    glClearStencil,
    NULL,  // glClientActiveTexture
    NULL,  // glColor4ub
    glColorMask,
    NULL,  // glColorPointer
    glCompileShader,
    glCompressedTexImage2D,
    glCreateProgram,
    glCreateShader,
    glCullFace,
    glDeleteBuffers,
    glDeleteProgram,
    glDeleteShader,
    glDeleteTextures,
    glDepthMask,
    glDisable,
    NULL,  // glDisableClientState
    glDisableVertexAttribArray,
    glDrawArrays,
    glDrawElements,
    glEnable,
    NULL,  // glEnableClientState
    glEnableVertexAttribArray,
    glFrontFace,
    glGenBuffers,
    glGenTextures,
    glGetBufferParameteriv,
    glGetError,
    glGetIntegerv,
    glGetProgramInfoLog,
    glGetProgramiv,
    glGetShaderInfoLog,
    glGetShaderiv,
    glGetString,
    glGetUniformLocation,
    glLineWidth,
    glLinkProgram,
    NULL,  // glLoadMatrixf
    NULL,  // glMatrixMode
    glPixelStorei,
    NULL,  // glPointSize
    glReadPixels,
    glScissor,
    NULL,  // glShadeModel
    glShaderSource,
    glStencilFunc,
    glStencilFuncSeparate,
    glStencilMask,
    glStencilMaskSeparate,
    glStencilOp,
    glStencilOpSeparate,
    NULL,  // glTexCoordPointer
    NULL,  // glTexEnvi
    glTexImage2D,
    glTexParameteri,
    glTexSubImage2D,
    glUniform1f,
    glUniform1i,
    glUniform1fv,
    glUniform1iv,
    glUniform2f,
    glUniform2i,
    glUniform2fv,
    glUniform2iv,
    glUniform3f,
    glUniform3i,
    glUniform3fv,
    glUniform3iv,
    glUniform4f,
    glUniform4i,
    glUniform4fv,
    glUniform4iv,
    glUniformMatrix2fv,
    glUniformMatrix3fv,
    glUniformMatrix4fv,
    glUseProgram,
    glVertexAttrib4fv,
    glVertexAttribPointer,
    NULL,  // glVertexPointer
    glViewport,
    glBindFramebuffer,
    glBindRenderbuffer,
    glCheckFramebufferStatus,
    glDeleteFramebuffers,
    glDeleteRenderbuffers,
    glFramebufferRenderbuffer,
    glFramebufferTexture2D,
    glGenFramebuffers,
    glGenRenderbuffers,
    glRenderbufferStorage,
    glRenderbufferStorageMultisampleEXT,
    glBlitFramebufferEXT,
    NULL,  // glResolveMultisampleFramebuffer
    NULL,  // glMapBuffer
    NULL,  // glUnmapBuffer

    GrGLInterface::kStaticInitEndGuard
  };
  static bool host_StubGL_initialized = false;
  if (!host_StubGL_initialized) {
    GrGLSetGLInterface(&cmd_buffer_interface);
    host_StubGL_initialized = true;
  }
}

}  // namespace webkit_glue