Elim cr-checkbox
[chromium-blink-merge.git] / gpu / skia_bindings / gl_bindings_skia_cmd_buffer.cc
blob024c9ccf4e2236c181880c815ff58cc770715470
1 // Copyright 2013 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.
5 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h"
7 #ifndef GL_GLEXT_PROTOTYPES
8 #define GL_GLEXT_PROTOTYPES
9 #endif
10 #include "gpu/GLES2/gl2extchromium.h"
11 #include "third_party/khronos/GLES2/gl2.h"
12 #include "third_party/khronos/GLES2/gl2ext.h"
13 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
15 namespace skia_bindings {
17 GrGLInterface* CreateCommandBufferSkiaGLBinding() {
18 GrGLInterface* interface = new GrGLInterface;
19 interface->fStandard = kGLES_GrGLStandard;
20 interface->fExtensions.init(kGLES_GrGLStandard,
21 glGetString,
22 NULL,
23 glGetIntegerv);
25 GrGLInterface::Functions* functions = &interface->fFunctions;
26 functions->fActiveTexture = glActiveTexture;
27 functions->fAttachShader = glAttachShader;
28 functions->fBindAttribLocation = glBindAttribLocation;
29 functions->fBindBuffer = glBindBuffer;
30 functions->fBindTexture = glBindTexture;
31 functions->fBindVertexArray = glBindVertexArrayOES;
32 functions->fBlendBarrier = glBlendBarrierKHR;
33 functions->fBlendColor = glBlendColor;
34 functions->fBlendEquation = glBlendEquation;
35 functions->fBlendFunc = glBlendFunc;
36 functions->fBufferData = glBufferData;
37 functions->fBufferSubData = glBufferSubData;
38 functions->fClear = glClear;
39 functions->fClearColor = glClearColor;
40 functions->fClearStencil = glClearStencil;
41 functions->fColorMask = glColorMask;
42 functions->fCompileShader = glCompileShader;
43 functions->fCompressedTexImage2D = glCompressedTexImage2D;
44 functions->fCopyTexSubImage2D = glCopyTexSubImage2D;
45 functions->fCreateProgram = glCreateProgram;
46 functions->fCreateShader = glCreateShader;
47 functions->fCullFace = glCullFace;
48 functions->fDeleteBuffers = glDeleteBuffers;
49 functions->fDeleteProgram = glDeleteProgram;
50 functions->fDeleteShader = glDeleteShader;
51 functions->fDeleteTextures = glDeleteTextures;
52 functions->fDeleteVertexArrays = glDeleteVertexArraysOES;
53 functions->fDepthMask = glDepthMask;
54 functions->fDisable = glDisable;
55 functions->fDisableVertexAttribArray = glDisableVertexAttribArray;
56 functions->fDiscardFramebuffer = glDiscardFramebufferEXT;
57 functions->fDrawArrays = glDrawArrays;
58 functions->fDrawElements = glDrawElements;
59 functions->fEnable = glEnable;
60 functions->fEnableVertexAttribArray = glEnableVertexAttribArray;
61 functions->fFinish = glFinish;
62 functions->fFlush = glFlush;
63 functions->fFrontFace = glFrontFace;
64 functions->fGenBuffers = glGenBuffers;
65 functions->fGenTextures = glGenTextures;
66 functions->fGenVertexArrays = glGenVertexArraysOES;
67 functions->fGetBufferParameteriv = glGetBufferParameteriv;
68 functions->fGetError = glGetError;
69 functions->fGetIntegerv = glGetIntegerv;
70 functions->fGetProgramInfoLog = glGetProgramInfoLog;
71 functions->fGetProgramiv = glGetProgramiv;
72 functions->fGetShaderInfoLog = glGetShaderInfoLog;
73 functions->fGetShaderiv = glGetShaderiv;
74 functions->fGetShaderPrecisionFormat = glGetShaderPrecisionFormat;
75 functions->fGetString = glGetString;
76 functions->fGetUniformLocation = glGetUniformLocation;
77 functions->fInsertEventMarker = glInsertEventMarkerEXT;
78 functions->fLineWidth = glLineWidth;
79 functions->fLinkProgram = glLinkProgram;
80 functions->fMapBufferSubData = glMapBufferSubDataCHROMIUM;
81 functions->fMapTexSubImage2D = glMapTexSubImage2DCHROMIUM;
82 functions->fPixelStorei = glPixelStorei;
83 functions->fPopGroupMarker = glPopGroupMarkerEXT;
84 functions->fPushGroupMarker = glPushGroupMarkerEXT;
85 functions->fReadPixels = glReadPixels;
86 functions->fScissor = glScissor;
87 functions->fShaderSource = glShaderSource;
88 functions->fStencilFunc = glStencilFunc;
89 functions->fStencilFuncSeparate = glStencilFuncSeparate;
90 functions->fStencilMask = glStencilMask;
91 functions->fStencilMaskSeparate = glStencilMaskSeparate;
92 functions->fStencilOp = glStencilOp;
93 functions->fStencilOpSeparate = glStencilOpSeparate;
94 functions->fTexImage2D = glTexImage2D;
95 functions->fTexParameteri = glTexParameteri;
96 functions->fTexParameteriv = glTexParameteriv;
97 functions->fTexStorage2D = glTexStorage2DEXT;
98 functions->fTexSubImage2D = glTexSubImage2D;
99 functions->fUniform1f = glUniform1f;
100 functions->fUniform1i = glUniform1i;
101 functions->fUniform1fv = glUniform1fv;
102 functions->fUniform1iv = glUniform1iv;
103 functions->fUniform2f = glUniform2f;
104 functions->fUniform2i = glUniform2i;
105 functions->fUniform2fv = glUniform2fv;
106 functions->fUniform2iv = glUniform2iv;
107 functions->fUniform3f = glUniform3f;
108 functions->fUniform3i = glUniform3i;
109 functions->fUniform3fv = glUniform3fv;
110 functions->fUniform3iv = glUniform3iv;
111 functions->fUniform4f = glUniform4f;
112 functions->fUniform4i = glUniform4i;
113 functions->fUniform4fv = glUniform4fv;
114 functions->fUniform4iv = glUniform4iv;
115 functions->fUniformMatrix2fv = glUniformMatrix2fv;
116 functions->fUniformMatrix3fv = glUniformMatrix3fv;
117 functions->fUniformMatrix4fv = glUniformMatrix4fv;
118 functions->fUnmapBufferSubData = glUnmapBufferSubDataCHROMIUM;
119 functions->fUnmapTexSubImage2D = glUnmapTexSubImage2DCHROMIUM;
120 functions->fUseProgram = glUseProgram;
121 functions->fVertexAttrib1f = glVertexAttrib1f;
122 functions->fVertexAttrib2fv = glVertexAttrib2fv;
123 functions->fVertexAttrib3fv = glVertexAttrib3fv;
124 functions->fVertexAttrib4fv = glVertexAttrib4fv;
125 functions->fVertexAttribPointer = glVertexAttribPointer;
126 functions->fViewport = glViewport;
127 functions->fBindFramebuffer = glBindFramebuffer;
128 functions->fBindRenderbuffer = glBindRenderbuffer;
129 functions->fCheckFramebufferStatus = glCheckFramebufferStatus;
130 functions->fDeleteFramebuffers = glDeleteFramebuffers;
131 functions->fDeleteRenderbuffers = glDeleteRenderbuffers;
132 functions->fFramebufferRenderbuffer = glFramebufferRenderbuffer;
133 functions->fFramebufferTexture2D = glFramebufferTexture2D;
134 functions->fFramebufferTexture2DMultisample =
135 glFramebufferTexture2DMultisampleEXT;
136 functions->fGenFramebuffers = glGenFramebuffers;
137 functions->fGenRenderbuffers = glGenRenderbuffers;
138 functions->fGetFramebufferAttachmentParameteriv =
139 glGetFramebufferAttachmentParameteriv;
140 functions->fGetRenderbufferParameteriv = glGetRenderbufferParameteriv;
141 functions->fRenderbufferStorage = glRenderbufferStorage;
142 functions->fRenderbufferStorageMultisample =
143 glRenderbufferStorageMultisampleCHROMIUM;
144 functions->fRenderbufferStorageMultisampleES2EXT =
145 glRenderbufferStorageMultisampleEXT;
146 functions->fBindUniformLocation = glBindUniformLocationCHROMIUM;
147 functions->fBlitFramebuffer = glBlitFramebufferCHROMIUM;
148 functions->fGenerateMipmap = glGenerateMipmap;
149 if (false) {
150 // These are disabled until the full extension is implemented.
151 // Otherwise the interface fails validation and the context can not
152 // be created.
153 functions->fMatrixLoadf = glMatrixLoadfCHROMIUM;
154 functions->fMatrixLoadIdentity = glMatrixLoadIdentityCHROMIUM;
155 functions->fPathCommands = glPathCommandsCHROMIUM;
156 functions->fPathParameteri = glPathParameteriCHROMIUM;
157 functions->fPathParameterf = glPathParameterfCHROMIUM;
158 functions->fGenPaths = glGenPathsCHROMIUM;
159 functions->fIsPath = glIsPathCHROMIUM;
160 functions->fDeletePaths = glDeletePathsCHROMIUM;
161 functions->fPathStencilFunc = glPathStencilFuncCHROMIUM;
162 functions->fStencilFillPath = glStencilFillPathCHROMIUM;
163 functions->fStencilStrokePath = glStencilStrokePathCHROMIUM;
164 functions->fCoverFillPath = glCoverFillPathCHROMIUM;
165 functions->fCoverStrokePath = glCoverStrokePathCHROMIUM;
166 functions->fStencilThenCoverFillPath = glStencilThenCoverFillPathCHROMIUM;
167 functions->fStencilThenCoverStrokePath =
168 glStencilThenCoverStrokePathCHROMIUM;
171 return interface;
174 } // namespace skia