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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/base_paths.h" | 8 #include "base/base_paths.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if (!library) { | 54 if (!library) { |
55 library = base::LoadNativeLibrary(module_path.Append(name), NULL); | 55 library = base::LoadNativeLibrary(module_path.Append(name), NULL); |
56 if (!library) { | 56 if (!library) { |
57 DVLOG(1) << name << " not found."; | 57 DVLOG(1) << name << " not found."; |
58 return false; | 58 return false; |
59 } | 59 } |
60 } | 60 } |
61 return true; | 61 return true; |
62 } | 62 } |
63 | 63 |
64 const unsigned char* AngleGetTraceCategoryEnabledFlag(const char* name) { | |
65 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(name); | |
66 } | |
67 | |
68 void AngleAddTraceEvent(char phase, | |
69 const unsigned char* category_group_enabled, | |
70 const char* name, | |
71 unsigned long long id, | |
72 int num_args, | |
73 const char** arg_names, | |
74 const unsigned char* arg_types, | |
75 const unsigned long long* arg_values, | |
76 unsigned char flags) { | |
77 TRACE_EVENT_API_ADD_TRACE_EVENT(phase, | |
78 category_group_enabled, | |
79 name, | |
80 id, | |
81 num_args, | |
82 arg_names, | |
83 arg_types, | |
84 arg_values, | |
85 NULL, | |
86 flags); | |
87 } | |
88 | |
89 typedef const unsigned char* (*GetCategoryEnabledFlagFunc)(const char* name); | |
90 typedef void (*AddTraceEventFunc)(char phase, | |
91 const unsigned char* categoryGroupEnabled, | |
92 const char* name, | |
93 unsigned long long id, | |
94 int numArgs, | |
95 const char** argNames, | |
96 const unsigned char* argTypes, | |
97 const unsigned long long* argValues, | |
98 unsigned char flags); | |
99 typedef void (__stdcall *SetTraceFunctionPointersFunc)( | |
100 GetCategoryEnabledFlagFunc get_category_enabled_flag, | |
101 AddTraceEventFunc add_trace_event_func); | |
102 | |
103 // TODO(jmadill): Apply to all platforms eventually | 64 // TODO(jmadill): Apply to all platforms eventually |
104 base::LazyInstance<ANGLEPlatformImpl> g_angle_platform_impl = | 65 base::LazyInstance<ANGLEPlatformImpl> g_angle_platform_impl = |
105 LAZY_INSTANCE_INITIALIZER; | 66 LAZY_INSTANCE_INITIALIZER; |
106 | 67 |
107 ANGLEPlatformShutdownFunc g_angle_platform_shutdown = nullptr; | 68 ANGLEPlatformShutdownFunc g_angle_platform_shutdown = nullptr; |
108 | 69 |
109 } // namespace | 70 } // namespace |
110 | 71 |
111 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { | 72 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { |
112 impls->push_back(kGLImplementationEGLGLES2); | 73 impls->push_back(kGLImplementationEGLGLES2); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 return false; | 167 return false; |
207 } | 168 } |
208 | 169 |
209 #if defined(ENABLE_SWIFTSHADER) | 170 #if defined(ENABLE_SWIFTSHADER) |
210 if (using_swift_shader) { | 171 if (using_swift_shader) { |
211 SetupSoftwareRenderer(gles_library); | 172 SetupSoftwareRenderer(gles_library); |
212 } | 173 } |
213 #endif | 174 #endif |
214 | 175 |
215 if (!using_swift_shader) { | 176 if (!using_swift_shader) { |
216 // TODO(jmadill): remove when platform impl supports tracing | |
217 SetTraceFunctionPointersFunc set_trace_function_pointers = | |
218 reinterpret_cast<SetTraceFunctionPointersFunc>( | |
219 base::GetFunctionPointerFromNativeLibrary( | |
220 gles_library, "SetTraceFunctionPointers")); | |
221 if (set_trace_function_pointers) { | |
222 set_trace_function_pointers(&AngleGetTraceCategoryEnabledFlag, | |
223 &AngleAddTraceEvent); | |
224 } | |
225 | |
226 // Init ANGLE platform here, before we call GetPlatformDisplay(). | 177 // Init ANGLE platform here, before we call GetPlatformDisplay(). |
227 // TODO(jmadill): Apply to all platforms eventually | 178 // TODO(jmadill): Apply to all platforms eventually |
228 ANGLEPlatformInitializeFunc angle_platform_init = | 179 ANGLEPlatformInitializeFunc angle_platform_init = |
229 reinterpret_cast<ANGLEPlatformInitializeFunc>( | 180 reinterpret_cast<ANGLEPlatformInitializeFunc>( |
230 base::GetFunctionPointerFromNativeLibrary( | 181 base::GetFunctionPointerFromNativeLibrary( |
231 gles_library, | 182 gles_library, |
232 "ANGLEPlatformInitialize")); | 183 "ANGLEPlatformInitialize")); |
233 if (angle_platform_init) { | 184 if (angle_platform_init) { |
234 angle_platform_init(&g_angle_platform_impl.Get()); | 185 angle_platform_init(&g_angle_platform_impl.Get()); |
235 | 186 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 case kGLImplementationDesktopGL: | 344 case kGLImplementationDesktopGL: |
394 return GetGLWindowSystemBindingInfoWGL(info); | 345 return GetGLWindowSystemBindingInfoWGL(info); |
395 case kGLImplementationEGLGLES2: | 346 case kGLImplementationEGLGLES2: |
396 return GetGLWindowSystemBindingInfoEGL(info); | 347 return GetGLWindowSystemBindingInfoEGL(info); |
397 default: | 348 default: |
398 return false; | 349 return false; |
399 } | 350 } |
400 } | 351 } |
401 | 352 |
402 } // namespace gfx | 353 } // namespace gfx |
OLD | NEW |