Chromium Code Reviews| Index: gpu/command_buffer_gles2/command_buffer_egl.cc |
| diff --git a/gpu/command_buffer_gles2/command_buffer_egl.cc b/gpu/command_buffer_gles2/command_buffer_egl.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c6529b61c7c2ffc40d524f9d38245aadc8d92c11 |
| --- /dev/null |
| +++ b/gpu/command_buffer_gles2/command_buffer_egl.cc |
| @@ -0,0 +1,102 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
no sievers
2015/08/27 19:21:28
nit: 'Copyright 2015'
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include <EGL/egl.h> |
| + |
| +#include "base/at_exit.h" |
| +#include "base/lazy_instance.h" |
| +#include "gpu/command_buffer_gles2/command_buffer_gles2_export.h" |
| +#include "ui/gl/gl_implementation.h" |
| + |
| +base::LazyInstance<base::AtExitManager> exit_manager = |
|
no sievers
2015/08/27 19:21:28
That's interesting. Doesn't LazyInstance register
hendrikw
2015/08/27 20:34:44
Huh, yeah, don't know why I didn't think of that :
no sievers
2015/08/27 22:02:25
Does it work if you just allocate and free it from
hendrikw
2015/08/28 16:01:51
Not really, the pair of functions are called once
no sievers
2015/08/28 17:59:31
How about making your main shell/test setup functi
hendrikw
2015/08/28 18:10:24
You mean Skia's testing framework? It doesn't hav
|
| + LAZY_INSTANCE_INITIALIZER; |
| + |
| +extern "C" { |
| + |
| +EGLDisplay GPU_COMMAND_BUFER_EGL_EXPORT |
|
no sievers
2015/08/27 19:21:28
nit: GPU_COMMAND_BUFER_EGL_EXPORT -> GPU_COMMAND_B
hendrikw
2015/08/27 20:34:44
ew, bad. Done, Thanks!
|
| +CommandBuffer_GetDisplay(EGLNativeDisplayType display_id) { |
| + return eglGetDisplay(display_id); |
| +} |
| + |
| +EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT |
| +CommandBuffer_Initialize(EGLDisplay dpy, EGLint* major, EGLint* minor) { |
| + exit_manager.Get(); |
| + EGLBoolean result = eglInitialize(dpy, major, minor); |
| + DCHECK(gfx::GetGLImplementation() != gfx::kGLImplementationNone); |
| + return result; |
| +} |
| + |
| +EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT |
| +CommandBuffer_Terminate(EGLDisplay dpy) { |
| + return eglTerminate(dpy); |
| +} |
| + |
| +EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT |
| +CommandBuffer_ChooseConfig(EGLDisplay dpy, |
| + const EGLint* attrib_list, |
| + EGLConfig* configs, |
| + EGLint config_size, |
| + EGLint* num_config) { |
| + return eglChooseConfig(dpy, attrib_list, configs, config_size, num_config); |
| +} |
| + |
| +EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT |
| +CommandBuffer_GetConfigAttrib(EGLDisplay dpy, |
| + EGLConfig config, |
| + EGLint attribute, |
| + EGLint* value) { |
| + return eglGetConfigAttrib(dpy, config, attribute, value); |
| +} |
| + |
| +EGLSurface GPU_COMMAND_BUFER_EGL_EXPORT |
| +CommandBuffer_CreateWindowSurface(EGLDisplay dpy, |
| + EGLConfig config, |
| + EGLNativeWindowType win, |
| + const EGLint* attrib_list) { |
| + return eglCreateWindowSurface(dpy, config, win, attrib_list); |
| +} |
| + |
| +EGLSurface GPU_COMMAND_BUFER_EGL_EXPORT |
| +CommandBuffer_CreatePbufferSurface(EGLDisplay dpy, |
| + EGLConfig config, |
| + const EGLint* attrib_list) { |
| + return eglCreatePbufferSurface(dpy, config, attrib_list); |
| +} |
| + |
| +EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT |
| +CommandBuffer_DestroySurface(EGLDisplay dpy, EGLSurface surface) { |
| + return eglDestroySurface(dpy, surface); |
| +} |
| + |
| +EGLContext GPU_COMMAND_BUFER_EGL_EXPORT |
| +CommandBuffer_CreateContext(EGLDisplay dpy, |
| + EGLConfig config, |
| + EGLContext share_context, |
| + const EGLint* attrib_list) { |
| + return eglCreateContext(dpy, config, share_context, attrib_list); |
| +} |
| + |
| +EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT |
| +CommandBuffer_DestroyContext(EGLDisplay dpy, EGLContext ctx) { |
| + return eglDestroyContext(dpy, ctx); |
| +} |
| + |
| +EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT |
| +CommandBuffer_MakeCurrent(EGLDisplay dpy, |
| + EGLSurface draw, |
| + EGLSurface read, |
| + EGLContext ctx) { |
| + return eglMakeCurrent(dpy, draw, read, ctx); |
| +} |
| + |
| +EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT |
| +CommandBuffer_SwapBuffers(EGLDisplay dpy, EGLSurface surface) { |
| + return eglSwapBuffers(dpy, surface); |
| +} |
| + |
| +__eglMustCastToProperFunctionPointerType GPU_COMMAND_BUFER_EGL_EXPORT |
| +CommandBuffer_GetProcAddress(const char* procname) { |
| + return eglGetProcAddress(procname); |
| +} |
| +} // extern "C" |