Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: src/gpu/gl/GrGLAssembleGLESInterface.h

Issue 319043005: Support using OpenGL ES context on desktop (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1
2 /*
3 * Copyright 2014 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9 const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
bsalomon 2014/06/09 13:53:47 W000000000000000000000T!
10 GET_PROC_LOCAL(GetString);
11 const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION)) ;
12 GrGLVersion version = GrGLGetVersionFromString(verStr);
13
14 if (version < GR_GL_VER(2,0)) {
15 return NULL;
16 }
17
18 GET_PROC_LOCAL(GetIntegerv);
19 GET_PROC_LOCAL(GetStringi);
20 GrGLExtensions extensions;
21 if (!extensions.init(kGLES_GrGLStandard, GetString, GetStringi, GetIntegerv) ) {
22 return NULL;
23 }
24
25 GrGLInterface* interface = SkNEW(GrGLInterface);
26 GrGLInterface::Functions* functions = &interface->fFunctions;
27
28 GET_LINKED(ActiveTexture);
29 GET_LINKED(AttachShader);
30 GET_LINKED(BindAttribLocation);
31 GET_LINKED(BindBuffer);
32 GET_LINKED(BindTexture);
33 GET_LINKED(BindVertexArray);
34 GET_LINKED(BlendColor);
35 GET_LINKED(BlendFunc);
36 GET_LINKED(BufferData);
37 GET_LINKED(BufferSubData);
38 GET_LINKED(Clear);
39 GET_LINKED(ClearColor);
40 GET_LINKED(ClearStencil);
41 GET_LINKED(ColorMask);
42 GET_LINKED(CompileShader);
43 GET_LINKED(CompressedTexImage2D);
44 GET_LINKED(CopyTexSubImage2D);
45 GET_LINKED(CreateProgram);
46 GET_LINKED(CreateShader);
47 GET_LINKED(CullFace);
48 GET_LINKED(DeleteBuffers);
49 GET_LINKED(DeleteProgram);
50 GET_LINKED(DeleteShader);
51 GET_LINKED(DeleteTextures);
52 GET_LINKED(DeleteVertexArrays);
53 GET_LINKED(DepthMask);
54 GET_LINKED(Disable);
55 GET_LINKED(DisableVertexAttribArray);
56 GET_LINKED(DrawArrays);
57 GET_LINKED(DrawElements);
58 GET_LINKED(Enable);
59 GET_LINKED(EnableVertexAttribArray);
60 GET_LINKED(Finish);
61 GET_LINKED(Flush);
62 GET_LINKED(FrontFace);
63 GET_LINKED(GenBuffers);
64 GET_LINKED(GenerateMipmap);
65 GET_LINKED(GenTextures);
66 GET_LINKED(GenVertexArrays);
67 GET_LINKED(GetBufferParameteriv);
68 GET_LINKED(GetError);
69 GET_LINKED(GetIntegerv);
70 GET_LINKED(GetProgramInfoLog);
71 GET_LINKED(GetProgramiv);
72 GET_LINKED(GetShaderInfoLog);
73 GET_LINKED(GetShaderiv);
74 GET_LINKED(GetString);
75 #if USE_LINKED && GL_ES_VERSION_3_0
76 GET_LINKED(GetStringi);
77 #else
78 GET_PROC(GetStringi);
79 #endif
80 GET_LINKED(GetUniformLocation);
81 GET_LINKED(LineWidth);
82 GET_LINKED(LinkProgram);
83 GET_LINKED(PixelStorei);
84 GET_LINKED(ReadPixels);
85 GET_LINKED(Scissor);
86 #if GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE
87 functions->fShaderSource = (GrGLShaderSourceProc) glShaderSource;
88 #else
89 GET_LINKED(ShaderSource);
90 #endif
91 GET_LINKED(StencilFunc);
92 GET_LINKED(StencilFuncSeparate);
93 GET_LINKED(StencilMask);
94 GET_LINKED(StencilMaskSeparate);
95 GET_LINKED(StencilOp);
96 GET_LINKED(StencilOpSeparate);
97 GET_LINKED(TexImage2D);
98 GET_LINKED(TexParameteri);
99 GET_LINKED(TexParameteriv);
100 GET_LINKED(TexSubImage2D);
101
102 if (version >= GR_GL_VER(3,0)) {
103 #if USE_LINKED && GL_ES_VERSION_3_0
104 GET_LINKED(TexStorage2D);
105 #else
106 GET_PROC(TexStorage2D);
107 #endif
108 } else {
109 #if USE_LINKED && GL_EXT_texture_storage
110 GET_LINKED_SUFFIX(TexStorage2D, EXT);
111 #else
112 GET_PROC_SUFFIX(TexStorage2D, EXT);
113 #endif
114 }
115
116 #if USE_LINKED && GL_EXT_discard_framebuffer
117 GET_LINKED(DiscardFramebuffer);
118 #endif
119 GET_LINKED(Uniform1f);
120 GET_LINKED(Uniform1i);
121 GET_LINKED(Uniform1fv);
122 GET_LINKED(Uniform1iv);
123 GET_LINKED(Uniform2f);
124 GET_LINKED(Uniform2i);
125 GET_LINKED(Uniform2fv);
126 GET_LINKED(Uniform2iv);
127 GET_LINKED(Uniform3f);
128 GET_LINKED(Uniform3i);
129 GET_LINKED(Uniform3fv);
130 GET_LINKED(Uniform3iv);
131 GET_LINKED(Uniform4f);
132 GET_LINKED(Uniform4i);
133 GET_LINKED(Uniform4fv);
134 GET_LINKED(Uniform4iv);
135 GET_LINKED(UniformMatrix2fv);
136 GET_LINKED(UniformMatrix3fv);
137 GET_LINKED(UniformMatrix4fv);
138 GET_LINKED(UseProgram);
139 GET_LINKED(VertexAttrib4fv);
140 GET_LINKED(VertexAttribPointer);
141 GET_LINKED(Viewport);
142 GET_LINKED(BindFramebuffer);
143 GET_LINKED(BindRenderbuffer);
144 GET_LINKED(CheckFramebufferStatus);
145 GET_LINKED(DeleteFramebuffers);
146 GET_LINKED(DeleteRenderbuffers);
147 GET_LINKED(FramebufferRenderbuffer);
148 GET_LINKED(FramebufferTexture2D);
149
150 if (version >= GR_GL_VER(3,0)) {
151 #if USE_LINKED && GL_ES_VERSION_3_0
152 GET_LINKED(RenderbufferStorageMultisample);
153 GET_LINKED(BlitFramebuffer);
154 #else
155 GET_PROC(RenderbufferStorageMultisample);
156 GET_PROC(BlitFramebuffer);
157 #endif
158 }
159
160 if (extensions.has("GL_EXT_multisampled_render_to_texture")) {
161 #if USE_LINKED && GL_EXT_multisampled_render_to_texture
162 GET_LINKED(FramebufferTexture2DMultisample);
163 GET_LINKED(RenderbufferStorageMultisampleES2EXT);
164 #else
165 GET_PROC_SUFFIX(FramebufferTexture2DMultisample, EXT);
166 functions->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbufferStor ageMultisampleProc) get(ctx, "glRenderbufferStorageMultisampleEXT");
167 #endif
168 } else if (extensions.has("GL_IMG_multisampled_render_to_texture")) {
169 #if USE_LINKED && GL_IMG_multisampled_render_to_texture
170 GET_LINKED(FramebufferTexture2DMultisample);
171 GET_LINKED(RenderbufferStorageMultisampleES2EXT);
172 #else
173 GET_PROC_SUFFIX(FramebufferTexture2DMultisample, IMG);
174 functions->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbufferStor ageMultisampleProc) get(ctx, "glRenderbufferStorageMultisampleIMG");
175 #endif
176 }
177
178 GET_LINKED(GenFramebuffers);
179 GET_LINKED(GenRenderbuffers);
180 GET_LINKED(GetFramebufferAttachmentParameteriv);
181 GET_LINKED(GetRenderbufferParameteriv);
182 GET_LINKED(RenderbufferStorage);
183
184 #if USE_LINKED && GL_OES_mapbuffer
185 GET_LINKED(MapBuffer);
186 GET_LINKED(UnmapBuffer);
187 #else
188 GET_PROC_SUFFIX(MapBuffer, OES);
189 GET_PROC_SUFFIX(UnmapBuffer, OES);
190 #endif
191
192 if (version >= GR_GL_VER(3,0)) {
193 #if USE_LINKED && GL_ES_VERSION_3_0
194 GET_LINKED(MapBufferRange);
195 GET_LINKED(FlushMappedBufferRange);
196 #else
197 GET_PROC(MapBufferRange);
198 GET_PROC(FlushMappedBufferRange);
199 #endif
200 } else if (extensions.has("GL_EXT_map_buffer_range")) {
201 #if USE_LINKED && GL_EXT_map_buffer_range
202 GET_LINKED(MapBufferRange);
203 GET_LINKED(FlushMappedBufferRange);
204 #else
205 GET_PROC(MapBufferRange);
206 GET_PROC(FlushMappedBufferRange);
207 #endif
208 }
209
210 if (extensions.has("GL_EXT_debug_marker")) {
211 GET_PROC(InsertEventMarker);
212 GET_PROC(PushGroupMarker);
213 GET_PROC(PopGroupMarker);
214 // The below check is here because a device has been found that has the extension string but
215 // returns NULL from the eglGetProcAddress for the functions
216 if (NULL == functions->fInsertEventMarker ||
217 NULL == functions->fPushGroupMarker ||
218 NULL == functions->fPopGroupMarker) {
219 extensions.remove("GL_EXT_debug_marker");
220 }
221 }
222
223 #if USE_LINKED && GL_ES_VERSION_3_0
224 GET_LINKED(InvalidateFramebuffer);
225 GET_LINKED(InvalidateSubFramebuffer);
226 #else
227 GET_PROC(InvalidateFramebuffer);
228 GET_PROC(InvalidateSubFramebuffer);
229 #endif
230 GET_LINKED(InvalidateBufferData);
231 GET_LINKED(InvalidateBufferSubData);
232 GET_LINKED(InvalidateTexImage);
233 GET_LINKED(InvalidateTexSubImage);
234
235 interface->fStandard = kGLES_GrGLStandard;
236 interface->fExtensions.swap(&extensions);
237
238 return interface;
239 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698