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