OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/ozone/common/egl_util.h" | 5 #include "ui/ozone/common/egl_util.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 namespace { | 10 namespace { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 return false; | 55 return false; |
56 } | 56 } |
57 | 57 |
58 set_gl_get_proc_address.Run(get_proc_address); | 58 set_gl_get_proc_address.Run(get_proc_address); |
59 add_gl_library.Run(egl_library); | 59 add_gl_library.Run(egl_library); |
60 add_gl_library.Run(gles_library); | 60 add_gl_library.Run(gles_library); |
61 | 61 |
62 return true; | 62 return true; |
63 } | 63 } |
64 | 64 |
| 65 void* ChooseEGLConfig(const SurfaceFactoryOzone::EglConfigInfo& egl, |
| 66 const int32* attributes) { |
| 67 void* config; |
| 68 int32 num_configs; |
| 69 if (!egl.choose_config.Run(attributes, NULL, 0, &num_configs)) { |
| 70 LOG(ERROR) << "eglChooseConfig failed with error " |
| 71 << egl.get_last_error_string.Run(); |
| 72 return nullptr; |
| 73 } |
| 74 |
| 75 if (num_configs == 0) { |
| 76 LOG(ERROR) << "No suitable EGL configs found."; |
| 77 return nullptr; |
| 78 } |
| 79 |
| 80 if (!egl.choose_config.Run(attributes, &config, 1, &num_configs)) { |
| 81 LOG(ERROR) << "eglChooseConfig failed with error " |
| 82 << egl.get_last_error_string.Run(); |
| 83 return nullptr; |
| 84 } |
| 85 return config; |
| 86 } |
| 87 |
65 } // namespace ui | 88 } // namespace ui |
OLD | NEW |