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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 } | 95 } |
96 | 96 |
97 EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) { | 97 EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) { |
98 if (dpy == EGL_NO_DISPLAY) | 98 if (dpy == EGL_NO_DISPLAY) |
99 return EglError(EGL_BAD_DISPLAY, EGL_FALSE); | 99 return EglError(EGL_BAD_DISPLAY, EGL_FALSE); |
100 | 100 |
101 egl::Display* display = static_cast<egl::Display*>(dpy); | 101 egl::Display* display = static_cast<egl::Display*>(dpy); |
102 if (!display->Initialize()) | 102 if (!display->Initialize()) |
103 return EglError(EGL_NOT_INITIALIZED, EGL_FALSE); | 103 return EglError(EGL_NOT_INITIALIZED, EGL_FALSE); |
104 | 104 |
105 int argc = 1; | 105 // eglInitialze can be called multiple times, prevent InitializeOneOff from |
no sievers
2015/08/27 19:21:28
nit: s/eglInitialze/eglInitialize
hendrikw
2015/08/27 20:34:44
Done.
| |
106 const char* const argv[] = { | 106 // being called multiple times. |
no sievers
2015/08/27 19:21:28
Actually InitializeOneOff() already seems to handl
hendrikw
2015/08/27 20:34:44
It DCHECKS if called more than once because of DCH
| |
107 "dummy" | 107 if (gfx::GetGLImplementation() == gfx::kGLImplementationNone) { |
108 }; | 108 int argc = 1; |
109 base::CommandLine::Init(argc, argv); | 109 const char* const argv[] = { |
110 gfx::GLSurface::InitializeOneOff(); | 110 "dummy" |
111 }; | |
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 EGLBoolean 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); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 return EGL_FALSE; | 425 return EGL_FALSE; |
422 } | 426 } |
423 | 427 |
424 /* Now, define eglGetProcAddress using the generic function ptr. type */ | 428 /* Now, define eglGetProcAddress using the generic function ptr. type */ |
425 __eglMustCastToProperFunctionPointerType | 429 __eglMustCastToProperFunctionPointerType |
426 eglGetProcAddress(const char* procname) { | 430 eglGetProcAddress(const char* procname) { |
427 return reinterpret_cast<__eglMustCastToProperFunctionPointerType>( | 431 return reinterpret_cast<__eglMustCastToProperFunctionPointerType>( |
428 gles2::GetGLFunctionPointer(procname)); | 432 gles2::GetGLFunctionPointer(procname)); |
429 } | 433 } |
430 } // extern "C" | 434 } // extern "C" |
OLD | NEW |