OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <EGL/egl.h> | 5 #include <EGL/egl.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "gpu/command_buffer/client/gles2_lib.h" | 8 #include "gpu/command_buffer/client/gles2_lib.h" |
9 #include "gpu/gles2_conform_support/egl/display.h" | 9 #include "gpu/gles2_conform_support/egl/display.h" |
10 #include "ui/gl/gl_context.h" | 10 #include "ui/gl/gl_context.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 egl::Display* display = static_cast<egl::Display*>(dpy); | 79 egl::Display* display = static_cast<egl::Display*>(dpy); |
80 if (!display->IsValidContext(context)) | 80 if (!display->IsValidContext(context)) |
81 return EGL_BAD_CONTEXT; | 81 return EGL_BAD_CONTEXT; |
82 | 82 |
83 return EGL_SUCCESS; | 83 return EGL_SUCCESS; |
84 } | 84 } |
85 } // namespace | 85 } // namespace |
86 | 86 |
87 extern "C" { | 87 extern "C" { |
88 EGLint eglGetError() { | 88 EGLAPI EGLint EGLAPIENTRY eglGetError() { |
89 // TODO(alokp): Fix me. | 89 // TODO(alokp): Fix me. |
90 return EGL_SUCCESS; | 90 return EGL_SUCCESS; |
91 } | 91 } |
92 | 92 |
93 EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id) { | 93 EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id) { |
94 return new egl::Display(display_id); | 94 return new egl::Display(display_id); |
95 } | 95 } |
96 | 96 |
97 EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) { | 97 EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, |
| 98 EGLint* major, |
| 99 EGLint* minor) { |
98 if (dpy == EGL_NO_DISPLAY) | 100 if (dpy == EGL_NO_DISPLAY) |
99 return EglError(EGL_BAD_DISPLAY, EGL_FALSE); | 101 return EglError(EGL_BAD_DISPLAY, EGL_FALSE); |
100 | 102 |
101 egl::Display* display = static_cast<egl::Display*>(dpy); | 103 egl::Display* display = static_cast<egl::Display*>(dpy); |
102 if (!display->Initialize()) | 104 if (!display->Initialize()) |
103 return EglError(EGL_NOT_INITIALIZED, EGL_FALSE); | 105 return EglError(EGL_NOT_INITIALIZED, EGL_FALSE); |
104 | 106 |
105 int argc = 1; | 107 // eglInitialize can be called multiple times, prevent InitializeOneOff from |
106 const char* const argv[] = { | 108 // being called multiple times. |
107 "dummy" | 109 if (gfx::GetGLImplementation() == gfx::kGLImplementationNone) { |
108 }; | 110 int argc = 1; |
109 base::CommandLine::Init(argc, argv); | 111 const char* const argv[] = {"dummy"}; |
110 gfx::GLSurface::InitializeOneOff(); | 112 base::CommandLine::Init(argc, argv); |
| 113 gfx::GLSurface::InitializeOneOff(); |
| 114 } |
111 | 115 |
112 *major = 1; | 116 *major = 1; |
113 *minor = 4; | 117 *minor = 4; |
114 return EglSuccess(EGL_TRUE); | 118 return EglSuccess(EGL_TRUE); |
115 } | 119 } |
116 | 120 |
117 EGLBoolean eglTerminate(EGLDisplay dpy) { | 121 EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy) { |
118 EGLint error_code = ValidateDisplay(dpy); | 122 EGLint error_code = ValidateDisplay(dpy); |
119 if (error_code != EGL_SUCCESS) | 123 if (error_code != EGL_SUCCESS) |
120 return EglError(error_code, EGL_FALSE); | 124 return EglError(error_code, EGL_FALSE); |
121 | 125 |
122 egl::Display* display = static_cast<egl::Display*>(dpy); | 126 egl::Display* display = static_cast<egl::Display*>(dpy); |
123 delete display; | 127 delete display; |
124 | 128 |
125 return EglSuccess(EGL_TRUE); | 129 return EglSuccess(EGL_TRUE); |
126 } | 130 } |
127 | 131 |
128 const char* eglQueryString(EGLDisplay dpy, EGLint name) { | 132 EGLAPI const char* EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name) { |
129 EGLint error_code = ValidateDisplay(dpy); | 133 EGLint error_code = ValidateDisplay(dpy); |
130 if (error_code != EGL_SUCCESS) | 134 if (error_code != EGL_SUCCESS) |
131 return EglError(error_code, static_cast<const char*>(NULL)); | 135 return EglError(error_code, static_cast<const char*>(NULL)); |
132 | 136 |
133 switch (name) { | 137 switch (name) { |
134 case EGL_CLIENT_APIS: | 138 case EGL_CLIENT_APIS: |
135 return EglSuccess("OpenGL_ES"); | 139 return EglSuccess("OpenGL_ES"); |
136 case EGL_EXTENSIONS: | 140 case EGL_EXTENSIONS: |
137 return EglSuccess(""); | 141 return EglSuccess(""); |
138 case EGL_VENDOR: | 142 case EGL_VENDOR: |
139 return EglSuccess("Google Inc."); | 143 return EglSuccess("Google Inc."); |
140 case EGL_VERSION: | 144 case EGL_VERSION: |
141 return EglSuccess("1.4"); | 145 return EglSuccess("1.4"); |
142 default: | 146 default: |
143 return EglError(EGL_BAD_PARAMETER, static_cast<const char*>(NULL)); | 147 return EglError(EGL_BAD_PARAMETER, static_cast<const char*>(NULL)); |
144 } | 148 } |
145 } | 149 } |
146 | 150 |
147 EGLBoolean eglChooseConfig(EGLDisplay dpy, | 151 EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, |
148 const EGLint* attrib_list, | 152 const EGLint* attrib_list, |
149 EGLConfig* configs, | 153 EGLConfig* configs, |
150 EGLint config_size, | 154 EGLint config_size, |
151 EGLint* num_config) { | 155 EGLint* num_config) { |
152 EGLint error_code = ValidateDisplay(dpy); | 156 EGLint error_code = ValidateDisplay(dpy); |
153 if (error_code != EGL_SUCCESS) | 157 if (error_code != EGL_SUCCESS) |
154 return EglError(error_code, EGL_FALSE); | 158 return EglError(error_code, EGL_FALSE); |
155 | 159 |
156 if (num_config == NULL) | 160 if (num_config == NULL) |
157 return EglError(EGL_BAD_PARAMETER, EGL_FALSE); | 161 return EglError(EGL_BAD_PARAMETER, EGL_FALSE); |
158 | 162 |
159 egl::Display* display = static_cast<egl::Display*>(dpy); | 163 egl::Display* display = static_cast<egl::Display*>(dpy); |
160 if (!display->ChooseConfigs(configs, config_size, num_config)) | 164 if (!display->ChooseConfigs(configs, config_size, num_config)) |
161 return EglError(EGL_BAD_ATTRIBUTE, EGL_FALSE); | 165 return EglError(EGL_BAD_ATTRIBUTE, EGL_FALSE); |
162 | 166 |
163 return EglSuccess(EGL_TRUE); | 167 return EglSuccess(EGL_TRUE); |
164 } | 168 } |
165 | 169 |
166 EGLBoolean eglGetConfigs(EGLDisplay dpy, | 170 EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, |
167 EGLConfig* configs, | 171 EGLConfig* configs, |
168 EGLint config_size, | 172 EGLint config_size, |
169 EGLint* num_config) { | 173 EGLint* num_config) { |
170 EGLint error_code = ValidateDisplay(dpy); | 174 EGLint error_code = ValidateDisplay(dpy); |
171 if (error_code != EGL_SUCCESS) | 175 if (error_code != EGL_SUCCESS) |
172 return EglError(error_code, EGL_FALSE); | 176 return EglError(error_code, EGL_FALSE); |
173 | 177 |
174 if (num_config == NULL) | 178 if (num_config == NULL) |
175 return EglError(EGL_BAD_PARAMETER, EGL_FALSE); | 179 return EglError(EGL_BAD_PARAMETER, EGL_FALSE); |
176 | 180 |
177 egl::Display* display = static_cast<egl::Display*>(dpy); | 181 egl::Display* display = static_cast<egl::Display*>(dpy); |
178 if (!display->GetConfigs(configs, config_size, num_config)) | 182 if (!display->GetConfigs(configs, config_size, num_config)) |
179 return EglError(EGL_BAD_ATTRIBUTE, EGL_FALSE); | 183 return EglError(EGL_BAD_ATTRIBUTE, EGL_FALSE); |
180 | 184 |
181 return EglSuccess(EGL_TRUE); | 185 return EglSuccess(EGL_TRUE); |
182 } | 186 } |
183 | 187 |
184 EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, | 188 EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, |
185 EGLConfig config, | 189 EGLConfig config, |
186 EGLint attribute, | 190 EGLint attribute, |
187 EGLint* value) { | 191 EGLint* value) { |
188 EGLint error_code = ValidateDisplayConfig(dpy, config); | 192 EGLint error_code = ValidateDisplayConfig(dpy, config); |
189 if (error_code != EGL_SUCCESS) | 193 if (error_code != EGL_SUCCESS) |
190 return EglError(error_code, EGL_FALSE); | 194 return EglError(error_code, EGL_FALSE); |
191 | 195 |
192 egl::Display* display = static_cast<egl::Display*>(dpy); | 196 egl::Display* display = static_cast<egl::Display*>(dpy); |
193 if (!display->GetConfigAttrib(config, attribute, value)) | 197 if (!display->GetConfigAttrib(config, attribute, value)) |
194 return EglError(EGL_BAD_ATTRIBUTE, EGL_FALSE); | 198 return EglError(EGL_BAD_ATTRIBUTE, EGL_FALSE); |
195 | 199 |
196 return EglSuccess(EGL_TRUE); | 200 return EglSuccess(EGL_TRUE); |
197 } | 201 } |
198 | 202 |
199 EGLSurface eglCreateWindowSurface(EGLDisplay dpy, | 203 EGLAPI EGLSurface EGLAPIENTRY |
200 EGLConfig config, | 204 eglCreateWindowSurface(EGLDisplay dpy, |
201 EGLNativeWindowType win, | 205 EGLConfig config, |
202 const EGLint* attrib_list) { | 206 EGLNativeWindowType win, |
| 207 const EGLint* attrib_list) { |
203 EGLint error_code = ValidateDisplayConfig(dpy, config); | 208 EGLint error_code = ValidateDisplayConfig(dpy, config); |
204 if (error_code != EGL_SUCCESS) | 209 if (error_code != EGL_SUCCESS) |
205 return EglError(error_code, EGL_NO_SURFACE); | 210 return EglError(error_code, EGL_NO_SURFACE); |
206 | 211 |
207 egl::Display* display = static_cast<egl::Display*>(dpy); | 212 egl::Display* display = static_cast<egl::Display*>(dpy); |
208 if (!display->IsValidNativeWindow(win)) | 213 if (!display->IsValidNativeWindow(win)) |
209 return EglError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); | 214 return EglError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); |
210 | 215 |
211 EGLSurface surface = display->CreateWindowSurface(config, win, attrib_list); | 216 EGLSurface surface = display->CreateWindowSurface(config, win, attrib_list); |
212 if (surface == EGL_NO_SURFACE) | 217 if (surface == EGL_NO_SURFACE) |
213 return EglError(EGL_BAD_ALLOC, EGL_NO_SURFACE); | 218 return EglError(EGL_BAD_ALLOC, EGL_NO_SURFACE); |
214 | 219 |
215 return EglSuccess(surface); | 220 return EglSuccess(surface); |
216 } | 221 } |
217 | 222 |
218 EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, | 223 EGLAPI EGLSurface EGLAPIENTRY |
219 EGLConfig config, | 224 eglCreatePbufferSurface(EGLDisplay dpy, |
220 const EGLint* attrib_list) { | 225 EGLConfig config, |
| 226 const EGLint* attrib_list) { |
221 EGLint error_code = ValidateDisplayConfig(dpy, config); | 227 EGLint error_code = ValidateDisplayConfig(dpy, config); |
222 if (error_code != EGL_SUCCESS) | 228 if (error_code != EGL_SUCCESS) |
223 return EglError(error_code, EGL_NO_SURFACE); | 229 return EglError(error_code, EGL_NO_SURFACE); |
224 | 230 |
225 egl::Display* display = static_cast<egl::Display*>(dpy); | 231 egl::Display* display = static_cast<egl::Display*>(dpy); |
226 int width = 1; | 232 int width = 1; |
227 int height = 1; | 233 int height = 1; |
228 if (attrib_list) { | 234 if (attrib_list) { |
229 for (const int32_t* attr = attrib_list; attr[0] != EGL_NONE; attr += 2) { | 235 for (const int32_t* attr = attrib_list; attr[0] != EGL_NONE; attr += 2) { |
230 switch (attr[0]) { | 236 switch (attr[0]) { |
231 case EGL_WIDTH: | 237 case EGL_WIDTH: |
232 width = attr[1]; | 238 width = attr[1]; |
233 break; | 239 break; |
234 case EGL_HEIGHT: | 240 case EGL_HEIGHT: |
235 height = attr[1]; | 241 height = attr[1]; |
236 break; | 242 break; |
237 } | 243 } |
238 } | 244 } |
239 } | 245 } |
240 display->SetCreateOffscreen(width, height); | 246 display->SetCreateOffscreen(width, height); |
241 | 247 |
242 EGLSurface surface = display->CreateWindowSurface(config, 0, attrib_list); | 248 EGLSurface surface = display->CreateWindowSurface(config, 0, attrib_list); |
243 if (surface == EGL_NO_SURFACE) | 249 if (surface == EGL_NO_SURFACE) |
244 return EglError(EGL_BAD_ALLOC, EGL_NO_SURFACE); | 250 return EglError(EGL_BAD_ALLOC, EGL_NO_SURFACE); |
245 | 251 |
246 return EglSuccess(surface); | 252 return EglSuccess(surface); |
247 } | 253 } |
248 | 254 |
249 EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, | 255 EGLAPI EGLSurface EGLAPIENTRY |
250 EGLConfig config, | 256 eglCreatePixmapSurface(EGLDisplay dpy, |
251 EGLNativePixmapType pixmap, | 257 EGLConfig config, |
252 const EGLint* attrib_list) { | 258 EGLNativePixmapType pixmap, |
| 259 const EGLint* attrib_list) { |
253 return EGL_NO_SURFACE; | 260 return EGL_NO_SURFACE; |
254 } | 261 } |
255 | 262 |
256 EGLBoolean eglDestroySurface(EGLDisplay dpy, | 263 EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, |
257 EGLSurface surface) { | 264 EGLSurface surface) { |
258 EGLint error_code = ValidateDisplaySurface(dpy, surface); | 265 EGLint error_code = ValidateDisplaySurface(dpy, surface); |
259 if (error_code != EGL_SUCCESS) | 266 if (error_code != EGL_SUCCESS) |
260 return EglError(error_code, EGL_FALSE); | 267 return EglError(error_code, EGL_FALSE); |
261 | 268 |
262 egl::Display* display = static_cast<egl::Display*>(dpy); | 269 egl::Display* display = static_cast<egl::Display*>(dpy); |
263 display->DestroySurface(surface); | 270 display->DestroySurface(surface); |
264 return EglSuccess(EGL_TRUE); | 271 return EglSuccess(EGL_TRUE); |
265 } | 272 } |
266 | 273 |
267 EGLBoolean eglQuerySurface(EGLDisplay dpy, | 274 EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, |
268 EGLSurface surface, | 275 EGLSurface surface, |
269 EGLint attribute, | 276 EGLint attribute, |
270 EGLint* value) { | 277 EGLint* value) { |
271 return EGL_FALSE; | 278 return EGL_FALSE; |
272 } | 279 } |
273 | 280 |
274 EGLBoolean eglBindAPI(EGLenum api) { | 281 EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api) { |
275 return EGL_FALSE; | 282 return EGL_FALSE; |
276 } | 283 } |
277 | 284 |
278 EGLenum eglQueryAPI() { | 285 EGLAPI EGLenum EGLAPIENTRY eglQueryAPI() { |
279 return EGL_OPENGL_ES_API; | 286 return EGL_OPENGL_ES_API; |
280 } | 287 } |
281 | 288 |
282 EGLBoolean eglWaitClient(void) { | 289 EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void) { |
283 return EGL_FALSE; | 290 return EGL_FALSE; |
284 } | 291 } |
285 | 292 |
286 EGLBoolean eglReleaseThread(void) { | 293 EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void) { |
287 return EGL_FALSE; | 294 return EGL_FALSE; |
288 } | 295 } |
289 | 296 |
290 EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, | 297 EGLAPI EGLSurface EGLAPIENTRY |
291 EGLenum buftype, | 298 eglCreatePbufferFromClientBuffer(EGLDisplay dpy, |
292 EGLClientBuffer buffer, | 299 EGLenum buftype, |
293 EGLConfig config, | 300 EGLClientBuffer buffer, |
294 const EGLint* attrib_list) { | 301 EGLConfig config, |
| 302 const EGLint* attrib_list) { |
295 return EGL_NO_SURFACE; | 303 return EGL_NO_SURFACE; |
296 } | 304 } |
297 | 305 |
298 EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, | 306 EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, |
299 EGLSurface surface, | 307 EGLSurface surface, |
300 EGLint attribute, | 308 EGLint attribute, |
301 EGLint value) { | 309 EGLint value) { |
302 return EGL_FALSE; | 310 return EGL_FALSE; |
303 } | 311 } |
304 | 312 |
305 EGLBoolean eglBindTexImage(EGLDisplay dpy, | 313 EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, |
306 EGLSurface surface, | 314 EGLSurface surface, |
307 EGLint buffer) { | 315 EGLint buffer) { |
308 return EGL_FALSE; | 316 return EGL_FALSE; |
309 } | 317 } |
310 | 318 |
311 EGLBoolean eglReleaseTexImage(EGLDisplay dpy, | 319 EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, |
312 EGLSurface surface, | 320 EGLSurface surface, |
313 EGLint buffer) { | 321 EGLint buffer) { |
314 return EGL_FALSE; | 322 return EGL_FALSE; |
315 } | 323 } |
316 | 324 |
317 EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) { | 325 EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval) { |
318 return EGL_FALSE; | 326 return EGL_FALSE; |
319 } | 327 } |
320 | 328 |
321 EGLContext eglCreateContext(EGLDisplay dpy, | 329 EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, |
322 EGLConfig config, | 330 EGLConfig config, |
323 EGLContext share_context, | 331 EGLContext share_context, |
324 const EGLint* attrib_list) { | 332 const EGLint* attrib_list) { |
325 EGLint error_code = ValidateDisplayConfig(dpy, config); | 333 EGLint error_code = ValidateDisplayConfig(dpy, config); |
326 if (error_code != EGL_SUCCESS) | 334 if (error_code != EGL_SUCCESS) |
327 return EglError(error_code, EGL_NO_CONTEXT); | 335 return EglError(error_code, EGL_NO_CONTEXT); |
328 | 336 |
329 if (share_context != EGL_NO_CONTEXT) { | 337 if (share_context != EGL_NO_CONTEXT) { |
330 error_code = ValidateDisplayContext(dpy, share_context); | 338 error_code = ValidateDisplayContext(dpy, share_context); |
331 if (error_code != EGL_SUCCESS) | 339 if (error_code != EGL_SUCCESS) |
332 return EglError(error_code, EGL_NO_CONTEXT); | 340 return EglError(error_code, EGL_NO_CONTEXT); |
333 } | 341 } |
334 | 342 |
335 egl::Display* display = static_cast<egl::Display*>(dpy); | 343 egl::Display* display = static_cast<egl::Display*>(dpy); |
336 EGLContext context = display->CreateContext( | 344 EGLContext context = display->CreateContext( |
337 config, share_context, attrib_list); | 345 config, share_context, attrib_list); |
338 if (context == EGL_NO_CONTEXT) | 346 if (context == EGL_NO_CONTEXT) |
339 return EglError(EGL_BAD_ALLOC, EGL_NO_CONTEXT); | 347 return EglError(EGL_BAD_ALLOC, EGL_NO_CONTEXT); |
340 | 348 |
341 return EglSuccess(context); | 349 return EglSuccess(context); |
342 } | 350 } |
343 | 351 |
344 EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) { | 352 EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, |
| 353 EGLContext ctx) { |
345 EGLint error_code = ValidateDisplayContext(dpy, ctx); | 354 EGLint error_code = ValidateDisplayContext(dpy, ctx); |
346 if (error_code != EGL_SUCCESS) | 355 if (error_code != EGL_SUCCESS) |
347 return EglError(error_code, EGL_FALSE); | 356 return EglError(error_code, EGL_FALSE); |
348 | 357 |
349 egl::Display* display = static_cast<egl::Display*>(dpy); | 358 egl::Display* display = static_cast<egl::Display*>(dpy); |
350 display->DestroyContext(ctx); | 359 display->DestroyContext(ctx); |
351 return EGL_TRUE; | 360 return EGL_TRUE; |
352 } | 361 } |
353 | 362 |
354 EGLBoolean eglMakeCurrent(EGLDisplay dpy, | 363 EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, |
355 EGLSurface draw, | 364 EGLSurface draw, |
356 EGLSurface read, | 365 EGLSurface read, |
357 EGLContext ctx) { | 366 EGLContext ctx) { |
358 if (ctx != EGL_NO_CONTEXT) { | 367 if (ctx != EGL_NO_CONTEXT) { |
359 EGLint error_code = ValidateDisplaySurface(dpy, draw); | 368 EGLint error_code = ValidateDisplaySurface(dpy, draw); |
360 if (error_code != EGL_SUCCESS) | 369 if (error_code != EGL_SUCCESS) |
361 return EglError(error_code, EGL_FALSE); | 370 return EglError(error_code, EGL_FALSE); |
362 error_code = ValidateDisplaySurface(dpy, read); | 371 error_code = ValidateDisplaySurface(dpy, read); |
363 if (error_code != EGL_SUCCESS) | 372 if (error_code != EGL_SUCCESS) |
364 return EglError(error_code, EGL_FALSE); | 373 return EglError(error_code, EGL_FALSE); |
365 error_code = ValidateDisplayContext(dpy, ctx); | 374 error_code = ValidateDisplayContext(dpy, ctx); |
366 if (error_code != EGL_SUCCESS) | 375 if (error_code != EGL_SUCCESS) |
367 return EglError(error_code, EGL_FALSE); | 376 return EglError(error_code, EGL_FALSE); |
368 } | 377 } |
369 | 378 |
370 egl::Display* display = static_cast<egl::Display*>(dpy); | 379 egl::Display* display = static_cast<egl::Display*>(dpy); |
371 if (!display->MakeCurrent(draw, read, ctx)) | 380 if (!display->MakeCurrent(draw, read, ctx)) |
372 return EglError(EGL_CONTEXT_LOST, EGL_FALSE); | 381 return EglError(EGL_CONTEXT_LOST, EGL_FALSE); |
373 | 382 |
374 #if REGAL_STATIC_EGL | 383 #if REGAL_STATIC_EGL |
375 RegalMakeCurrent(ctx); | 384 RegalMakeCurrent(ctx); |
376 #endif | 385 #endif |
377 | 386 |
378 return EGL_TRUE; | 387 return EGL_TRUE; |
379 } | 388 } |
380 | 389 |
381 EGLContext eglGetCurrentContext() { | 390 EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext() { |
382 return EGL_NO_CONTEXT; | 391 return EGL_NO_CONTEXT; |
383 } | 392 } |
384 | 393 |
385 EGLSurface eglGetCurrentSurface(EGLint readdraw) { | 394 EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw) { |
386 return EGL_NO_SURFACE; | 395 return EGL_NO_SURFACE; |
387 } | 396 } |
388 | 397 |
389 EGLDisplay eglGetCurrentDisplay() { | 398 EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay() { |
390 return EGL_NO_DISPLAY; | 399 return EGL_NO_DISPLAY; |
391 } | 400 } |
392 | 401 |
393 EGLBoolean eglQueryContext(EGLDisplay dpy, | 402 EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, |
394 EGLContext ctx, | 403 EGLContext ctx, |
395 EGLint attribute, | 404 EGLint attribute, |
396 EGLint* value) { | 405 EGLint* value) { |
397 return EGL_FALSE; | 406 return EGL_FALSE; |
398 } | 407 } |
399 | 408 |
400 EGLBoolean eglWaitGL() { | 409 EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL() { |
401 return EGL_FALSE; | 410 return EGL_FALSE; |
402 } | 411 } |
403 | 412 |
404 EGLBoolean eglWaitNative(EGLint engine) { | 413 EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine) { |
405 return EGL_FALSE; | 414 return EGL_FALSE; |
406 } | 415 } |
407 | 416 |
408 EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) { | 417 EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, |
| 418 EGLSurface surface) { |
409 EGLint error_code = ValidateDisplaySurface(dpy, surface); | 419 EGLint error_code = ValidateDisplaySurface(dpy, surface); |
410 if (error_code != EGL_SUCCESS) | 420 if (error_code != EGL_SUCCESS) |
411 return EglError(error_code, EGL_FALSE); | 421 return EglError(error_code, EGL_FALSE); |
412 | 422 |
413 egl::Display* display = static_cast<egl::Display*>(dpy); | 423 egl::Display* display = static_cast<egl::Display*>(dpy); |
414 display->SwapBuffers(surface); | 424 display->SwapBuffers(surface); |
415 return EglSuccess(EGL_TRUE); | 425 return EglSuccess(EGL_TRUE); |
416 } | 426 } |
417 | 427 |
418 EGLBoolean eglCopyBuffers(EGLDisplay dpy, | 428 EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, |
419 EGLSurface surface, | 429 EGLSurface surface, |
420 EGLNativePixmapType target) { | 430 EGLNativePixmapType target) { |
421 return EGL_FALSE; | 431 return EGL_FALSE; |
422 } | 432 } |
423 | 433 |
424 /* Now, define eglGetProcAddress using the generic function ptr. type */ | 434 /* Now, define eglGetProcAddress using the generic function ptr. type */ |
425 __eglMustCastToProperFunctionPointerType | 435 EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY |
426 eglGetProcAddress(const char* procname) { | 436 eglGetProcAddress(const char* procname) { |
427 return reinterpret_cast<__eglMustCastToProperFunctionPointerType>( | 437 return reinterpret_cast<__eglMustCastToProperFunctionPointerType>( |
428 gles2::GetGLFunctionPointer(procname)); | 438 gles2::GetGLFunctionPointer(procname)); |
429 } | 439 } |
430 } // extern "C" | 440 } // extern "C" |
OLD | NEW |