OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "app/gfx/gl/gl_bindings.h" | 7 #include "app/gfx/gl/gl_bindings.h" |
8 #include "app/gfx/gl/gl_implementation.h" | 8 #include "app/gfx/gl/gl_implementation.h" |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 case kGLImplementationOSMesaGL: { | 40 case kGLImplementationOSMesaGL: { |
41 FilePath module_path; | 41 FilePath module_path; |
42 if (!PathService::Get(base::DIR_MODULE, &module_path)) { | 42 if (!PathService::Get(base::DIR_MODULE, &module_path)) { |
43 LOG(ERROR) << "PathService::Get failed."; | 43 LOG(ERROR) << "PathService::Get failed."; |
44 return false; | 44 return false; |
45 } | 45 } |
46 | 46 |
47 base::NativeLibrary library = base::LoadNativeLibrary( | 47 base::NativeLibrary library = base::LoadNativeLibrary( |
48 module_path.Append("libosmesa.so")); | 48 module_path.Append("libosmesa.so")); |
49 if (!library) { | 49 if (!library) { |
50 DVLOG(1) << "libosmesa.so not found"; | 50 VLOG(1) << "libosmesa.so not found"; |
51 return false; | 51 return false; |
52 } | 52 } |
53 | 53 |
54 GLGetProcAddressProc get_proc_address = | 54 GLGetProcAddressProc get_proc_address = |
55 reinterpret_cast<GLGetProcAddressProc>( | 55 reinterpret_cast<GLGetProcAddressProc>( |
56 base::GetFunctionPointerFromNativeLibrary( | 56 base::GetFunctionPointerFromNativeLibrary( |
57 library, "OSMesaGetProcAddress")); | 57 library, "OSMesaGetProcAddress")); |
58 if (!get_proc_address) { | 58 if (!get_proc_address) { |
59 DLOG(ERROR) << "OSMesaGetProcAddress not found."; | 59 LOG(ERROR) << "OSMesaGetProcAddress not found."; |
60 base::UnloadNativeLibrary(library); | 60 base::UnloadNativeLibrary(library); |
61 return false; | 61 return false; |
62 } | 62 } |
63 | 63 |
64 SetGLGetProcAddressProc(get_proc_address); | 64 SetGLGetProcAddressProc(get_proc_address); |
65 AddGLNativeLibrary(library); | 65 AddGLNativeLibrary(library); |
66 SetGLImplementation(kGLImplementationOSMesaGL); | 66 SetGLImplementation(kGLImplementationOSMesaGL); |
67 | 67 |
68 InitializeGLBindingsGL(); | 68 InitializeGLBindingsGL(); |
69 InitializeGLBindingsOSMESA(); | 69 InitializeGLBindingsOSMESA(); |
70 break; | 70 break; |
71 } | 71 } |
72 case kGLImplementationDesktopGL: { | 72 case kGLImplementationDesktopGL: { |
73 base::NativeLibrary library = base::LoadNativeLibrary( | 73 base::NativeLibrary library = base::LoadNativeLibrary( |
74 FilePath("libGL.so.1")); | 74 FilePath("libGL.so.1")); |
75 if (!library) { | 75 if (!library) { |
76 LOG(ERROR) << "libGL.so.1 not found."; | 76 VLOG(1) << "libGL.so.1 not found."; |
77 return false; | 77 return false; |
78 } | 78 } |
79 | 79 |
80 GLGetProcAddressProc get_proc_address = | 80 GLGetProcAddressProc get_proc_address = |
81 reinterpret_cast<GLGetProcAddressProc>( | 81 reinterpret_cast<GLGetProcAddressProc>( |
82 base::GetFunctionPointerFromNativeLibrary( | 82 base::GetFunctionPointerFromNativeLibrary( |
83 library, "glXGetProcAddress")); | 83 library, "glXGetProcAddress")); |
84 if (!get_proc_address) { | 84 if (!get_proc_address) { |
85 LOG(ERROR) << "glxGetProcAddress not found."; | 85 LOG(ERROR) << "glxGetProcAddress not found."; |
86 base::UnloadNativeLibrary(library); | 86 base::UnloadNativeLibrary(library); |
87 return false; | 87 return false; |
88 } | 88 } |
89 | 89 |
90 SetGLGetProcAddressProc(get_proc_address); | 90 SetGLGetProcAddressProc(get_proc_address); |
91 AddGLNativeLibrary(library); | 91 AddGLNativeLibrary(library); |
92 SetGLImplementation(kGLImplementationDesktopGL); | 92 SetGLImplementation(kGLImplementationDesktopGL); |
93 | 93 |
94 InitializeGLBindingsGL(); | 94 InitializeGLBindingsGL(); |
95 InitializeGLBindingsGLX(); | 95 InitializeGLBindingsGLX(); |
96 break; | 96 break; |
97 } | 97 } |
98 case kGLImplementationEGLGLES2: { | 98 case kGLImplementationEGLGLES2: { |
99 base::NativeLibrary gles_library = base::LoadNativeLibrary( | 99 base::NativeLibrary gles_library = base::LoadNativeLibrary( |
100 FilePath("libGLESv2.so")); | 100 FilePath("libGLESv2.so")); |
101 if (!gles_library) { | 101 if (!gles_library) { |
102 DLOG(ERROR) << "libGLESv2.so not found"; | 102 VLOG(1) << "libGLESv2.so not found"; |
103 return false; | 103 return false; |
104 } | 104 } |
105 | 105 |
106 base::NativeLibrary egl_library = base::LoadNativeLibrary( | 106 base::NativeLibrary egl_library = base::LoadNativeLibrary( |
107 FilePath("libEGL.so")); | 107 FilePath("libEGL.so")); |
108 if (!egl_library) { | 108 if (!egl_library) { |
109 DLOG(ERROR) << "libEGL.so not found"; | 109 VLOG(1) << "libEGL.so not found"; |
110 base::UnloadNativeLibrary(gles_library); | 110 base::UnloadNativeLibrary(gles_library); |
111 return false; | 111 return false; |
112 } | 112 } |
113 | 113 |
114 GLGetProcAddressProc get_proc_address = | 114 GLGetProcAddressProc get_proc_address = |
115 reinterpret_cast<GLGetProcAddressProc>( | 115 reinterpret_cast<GLGetProcAddressProc>( |
116 base::GetFunctionPointerFromNativeLibrary( | 116 base::GetFunctionPointerFromNativeLibrary( |
117 egl_library, "eglGetProcAddress")); | 117 egl_library, "eglGetProcAddress")); |
118 if (!get_proc_address) { | 118 if (!get_proc_address) { |
119 LOG(ERROR) << "eglGetProcAddress not found."; | 119 LOG(ERROR) << "eglGetProcAddress not found."; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 | 152 |
153 void InitializeDebugGLBindings() { | 153 void InitializeDebugGLBindings() { |
154 InitializeDebugGLBindingsEGL(); | 154 InitializeDebugGLBindingsEGL(); |
155 InitializeDebugGLBindingsGL(); | 155 InitializeDebugGLBindingsGL(); |
156 InitializeDebugGLBindingsGLX(); | 156 InitializeDebugGLBindingsGLX(); |
157 InitializeDebugGLBindingsOSMESA(); | 157 InitializeDebugGLBindingsOSMESA(); |
158 } | 158 } |
159 | 159 |
160 } // namespace gfx | 160 } // namespace gfx |
OLD | NEW |