Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
|
no sievers
2015/08/27 19:21:28
nit: 'Copyright 2015'
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <EGL/egl.h> | |
| 6 | |
| 7 #include "base/at_exit.h" | |
| 8 #include "base/lazy_instance.h" | |
| 9 #include "gpu/command_buffer_gles2/command_buffer_gles2_export.h" | |
| 10 #include "ui/gl/gl_implementation.h" | |
| 11 | |
| 12 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
| |
| 13 LAZY_INSTANCE_INITIALIZER; | |
| 14 | |
| 15 extern "C" { | |
| 16 | |
| 17 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!
| |
| 18 CommandBuffer_GetDisplay(EGLNativeDisplayType display_id) { | |
| 19 return eglGetDisplay(display_id); | |
| 20 } | |
| 21 | |
| 22 EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT | |
| 23 CommandBuffer_Initialize(EGLDisplay dpy, EGLint* major, EGLint* minor) { | |
| 24 exit_manager.Get(); | |
| 25 EGLBoolean result = eglInitialize(dpy, major, minor); | |
| 26 DCHECK(gfx::GetGLImplementation() != gfx::kGLImplementationNone); | |
| 27 return result; | |
| 28 } | |
| 29 | |
| 30 EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT | |
| 31 CommandBuffer_Terminate(EGLDisplay dpy) { | |
| 32 return eglTerminate(dpy); | |
| 33 } | |
| 34 | |
| 35 EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT | |
| 36 CommandBuffer_ChooseConfig(EGLDisplay dpy, | |
| 37 const EGLint* attrib_list, | |
| 38 EGLConfig* configs, | |
| 39 EGLint config_size, | |
| 40 EGLint* num_config) { | |
| 41 return eglChooseConfig(dpy, attrib_list, configs, config_size, num_config); | |
| 42 } | |
| 43 | |
| 44 EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT | |
| 45 CommandBuffer_GetConfigAttrib(EGLDisplay dpy, | |
| 46 EGLConfig config, | |
| 47 EGLint attribute, | |
| 48 EGLint* value) { | |
| 49 return eglGetConfigAttrib(dpy, config, attribute, value); | |
| 50 } | |
| 51 | |
| 52 EGLSurface GPU_COMMAND_BUFER_EGL_EXPORT | |
| 53 CommandBuffer_CreateWindowSurface(EGLDisplay dpy, | |
| 54 EGLConfig config, | |
| 55 EGLNativeWindowType win, | |
| 56 const EGLint* attrib_list) { | |
| 57 return eglCreateWindowSurface(dpy, config, win, attrib_list); | |
| 58 } | |
| 59 | |
| 60 EGLSurface GPU_COMMAND_BUFER_EGL_EXPORT | |
| 61 CommandBuffer_CreatePbufferSurface(EGLDisplay dpy, | |
| 62 EGLConfig config, | |
| 63 const EGLint* attrib_list) { | |
| 64 return eglCreatePbufferSurface(dpy, config, attrib_list); | |
| 65 } | |
| 66 | |
| 67 EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT | |
| 68 CommandBuffer_DestroySurface(EGLDisplay dpy, EGLSurface surface) { | |
| 69 return eglDestroySurface(dpy, surface); | |
| 70 } | |
| 71 | |
| 72 EGLContext GPU_COMMAND_BUFER_EGL_EXPORT | |
| 73 CommandBuffer_CreateContext(EGLDisplay dpy, | |
| 74 EGLConfig config, | |
| 75 EGLContext share_context, | |
| 76 const EGLint* attrib_list) { | |
| 77 return eglCreateContext(dpy, config, share_context, attrib_list); | |
| 78 } | |
| 79 | |
| 80 EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT | |
| 81 CommandBuffer_DestroyContext(EGLDisplay dpy, EGLContext ctx) { | |
| 82 return eglDestroyContext(dpy, ctx); | |
| 83 } | |
| 84 | |
| 85 EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT | |
| 86 CommandBuffer_MakeCurrent(EGLDisplay dpy, | |
| 87 EGLSurface draw, | |
| 88 EGLSurface read, | |
| 89 EGLContext ctx) { | |
| 90 return eglMakeCurrent(dpy, draw, read, ctx); | |
| 91 } | |
| 92 | |
| 93 EGLBoolean GPU_COMMAND_BUFER_EGL_EXPORT | |
| 94 CommandBuffer_SwapBuffers(EGLDisplay dpy, EGLSurface surface) { | |
| 95 return eglSwapBuffers(dpy, surface); | |
| 96 } | |
| 97 | |
| 98 __eglMustCastToProperFunctionPointerType GPU_COMMAND_BUFER_EGL_EXPORT | |
| 99 CommandBuffer_GetProcAddress(const char* procname) { | |
| 100 return eglGetProcAddress(procname); | |
| 101 } | |
| 102 } // extern "C" | |
| OLD | NEW |