OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/gl/init/gl_initializer.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "ui/gl/gl_implementation.h" |
| 9 #include "ui/gl/gl_surface_egl.h" |
| 10 #include "ui/gl/gl_surface_glx.h" |
| 11 #include "ui/gl/gl_surface_osmesa_x11.h" |
| 12 |
| 13 namespace gl { |
| 14 namespace init { |
| 15 |
| 16 bool InitializeGLOneOffPlatform() { |
| 17 switch (GetGLImplementation()) { |
| 18 case kGLImplementationDesktopGL: |
| 19 if (!GLSurfaceGLX::InitializeOneOff()) { |
| 20 LOG(ERROR) << "GLSurfaceGLX::InitializeOneOff failed."; |
| 21 return false; |
| 22 } |
| 23 return true; |
| 24 case kGLImplementationOSMesaGL: |
| 25 if (!GLSurfaceOSMesaX11::InitializeOneOff()) { |
| 26 LOG(ERROR) << "GLSurfaceOSMesaX11::InitializeOneOff failed."; |
| 27 return false; |
| 28 } |
| 29 return true; |
| 30 case kGLImplementationEGLGLES2: |
| 31 if (!GLSurfaceEGL::InitializeOneOff()) { |
| 32 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; |
| 33 return false; |
| 34 } |
| 35 return true; |
| 36 default: |
| 37 return true; |
| 38 } |
| 39 } |
| 40 |
| 41 } // namespace init |
| 42 } // namespace gl |
OLD | NEW |