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 "base/base_paths.h" | 5 #include "base/base_paths.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/native_library.h" | 9 #include "base/native_library.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 | 50 |
51 bool InitializeStaticGLBindings(GLImplementation implementation) { | 51 bool InitializeStaticGLBindings(GLImplementation implementation) { |
52 // Prevent reinitialization with a different implementation. Once the gpu | 52 // Prevent reinitialization with a different implementation. Once the gpu |
53 // unit tests have initialized with kGLImplementationMock, we don't want to | 53 // unit tests have initialized with kGLImplementationMock, we don't want to |
54 // later switch to another GL implementation. | 54 // later switch to another GL implementation. |
55 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); | 55 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); |
56 | 56 |
57 switch (implementation) { | 57 switch (implementation) { |
58 case kGLImplementationEGLGLES2: { | 58 case kGLImplementationEGLGLES2: { |
59 base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so"); | 59 base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so"); |
60 if (!gles_library) | 60 if (!gles_library) { |
61 LOG(ERROR) << "Failed to load libGLESv2.so."; | |
61 return false; | 62 return false; |
63 } | |
62 base::NativeLibrary egl_library = LoadLibrary("libEGL.so"); | 64 base::NativeLibrary egl_library = LoadLibrary("libEGL.so"); |
63 if (!egl_library) { | 65 if (!egl_library) { |
66 LOG(ERROR) << "Failed to load libEGL.so."; | |
64 base::UnloadNativeLibrary(gles_library); | 67 base::UnloadNativeLibrary(gles_library); |
65 return false; | 68 return false; |
66 } | 69 } |
67 | 70 |
68 GLGetProcAddressProc get_proc_address = | 71 GLGetProcAddressProc get_proc_address = |
69 reinterpret_cast<GLGetProcAddressProc>( | 72 reinterpret_cast<GLGetProcAddressProc>( |
70 base::GetFunctionPointerFromNativeLibrary( | 73 base::GetFunctionPointerFromNativeLibrary( |
71 egl_library, "eglGetProcAddress")); | 74 egl_library, "eglGetProcAddress")); |
72 if (!get_proc_address) { | 75 if (!get_proc_address) { |
73 LOG(ERROR) << "eglGetProcAddress not found."; | 76 LOG(ERROR) << "eglGetProcAddress not found."; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 case kGLImplementationMockGL: | 116 case kGLImplementationMockGL: |
114 if (!context) { | 117 if (!context) { |
115 scoped_refptr<GLContextStubWithExtensions> mock_context( | 118 scoped_refptr<GLContextStubWithExtensions> mock_context( |
116 new GLContextStubWithExtensions()); | 119 new GLContextStubWithExtensions()); |
117 mock_context->SetGLVersionString("opengl es 3.0"); | 120 mock_context->SetGLVersionString("opengl es 3.0"); |
118 InitializeDynamicGLBindingsGL(mock_context.get()); | 121 InitializeDynamicGLBindingsGL(mock_context.get()); |
119 } else | 122 } else |
120 InitializeDynamicGLBindingsGL(context); | 123 InitializeDynamicGLBindingsGL(context); |
121 break; | 124 break; |
122 default: | 125 default: |
126 NOTIMPLEMENTED() << "InitializeDynamicGLBindings on Android"; | |
no sievers
2014/02/12 17:20:43
NOTREACHED()
hyunki
2014/02/14 02:00:36
Done.
| |
123 return false; | 127 return false; |
124 } | 128 } |
125 | 129 |
126 return true; | 130 return true; |
127 } | 131 } |
128 | 132 |
129 void InitializeDebugGLBindings() { | 133 void InitializeDebugGLBindings() { |
130 InitializeDebugGLBindingsEGL(); | 134 InitializeDebugGLBindingsEGL(); |
131 InitializeDebugGLBindingsGL(); | 135 InitializeDebugGLBindingsGL(); |
132 } | 136 } |
(...skipping 10 matching lines...) Expand all Loading... | |
143 switch (GetGLImplementation()) { | 147 switch (GetGLImplementation()) { |
144 case kGLImplementationEGLGLES2: | 148 case kGLImplementationEGLGLES2: |
145 return GetGLWindowSystemBindingInfoEGL(info); | 149 return GetGLWindowSystemBindingInfoEGL(info); |
146 default: | 150 default: |
147 return false; | 151 return false; |
148 } | 152 } |
149 return false; | 153 return false; |
150 } | 154 } |
151 | 155 |
152 } // namespace gfx | 156 } // namespace gfx |
OLD | NEW |