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 // eglInitialize can be called multiple times, prevent InitializeOneOff from | 105 int argc = 1; |
106 // being called multiple times. | 106 const char* const argv[] = { |
107 if (gfx::GetGLImplementation() == gfx::kGLImplementationNone) { | 107 "dummy" |
108 int argc = 1; | 108 }; |
109 const char* const argv[] = { | 109 base::CommandLine::Init(argc, argv); |
110 "dummy" | 110 gfx::GLSurface::InitializeOneOff(); |
111 }; | |
112 base::CommandLine::Init(argc, argv); | |
113 gfx::GLSurface::InitializeOneOff(); | |
114 } | |
115 | 111 |
116 *major = 1; | 112 *major = 1; |
117 *minor = 4; | 113 *minor = 4; |
118 return EglSuccess(EGL_TRUE); | 114 return EglSuccess(EGL_TRUE); |
119 } | 115 } |
120 | 116 |
121 EGLBoolean eglTerminate(EGLDisplay dpy) { | 117 EGLBoolean eglTerminate(EGLDisplay dpy) { |
122 EGLint error_code = ValidateDisplay(dpy); | 118 EGLint error_code = ValidateDisplay(dpy); |
123 if (error_code != EGL_SUCCESS) | 119 if (error_code != EGL_SUCCESS) |
124 return EglError(error_code, EGL_FALSE); | 120 return EglError(error_code, EGL_FALSE); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 return EGL_FALSE; | 421 return EGL_FALSE; |
426 } | 422 } |
427 | 423 |
428 /* Now, define eglGetProcAddress using the generic function ptr. type */ | 424 /* Now, define eglGetProcAddress using the generic function ptr. type */ |
429 __eglMustCastToProperFunctionPointerType | 425 __eglMustCastToProperFunctionPointerType |
430 eglGetProcAddress(const char* procname) { | 426 eglGetProcAddress(const char* procname) { |
431 return reinterpret_cast<__eglMustCastToProperFunctionPointerType>( | 427 return reinterpret_cast<__eglMustCastToProperFunctionPointerType>( |
432 gles2::GetGLFunctionPointer(procname)); | 428 gles2::GetGLFunctionPointer(procname)); |
433 } | 429 } |
434 } // extern "C" | 430 } // extern "C" |
OLD | NEW |