| 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 "ui/gl/gl_implementation.h" | 5 #include "ui/gl/gl_implementation.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/gl/gl_context_stub_with_extensions.h" | 9 #include "ui/gl/gl_context_stub_with_extensions.h" |
| 10 #include "ui/gl/gl_gl_api_implementation.h" | 10 #include "ui/gl/gl_gl_api_implementation.h" |
| 11 #include "ui/gl/gl_osmesa_api_implementation.h" | 11 #include "ui/gl/gl_osmesa_api_implementation.h" |
| 12 | 12 |
| 13 namespace gl { | 13 namespace gl { |
| 14 | 14 |
| 15 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { | 15 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { |
| 16 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 16 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 17 switches::kEnableUnsafeES3APIs)) { | 17 switches::kEnableUnsafeES3APIs)) { |
| 18 impls->push_back(kGLImplementationDesktopGLCoreProfile); | 18 impls->push_back(kGLImplementationDesktopGLCoreProfile); |
| 19 } | 19 } |
| 20 impls->push_back(kGLImplementationDesktopGL); | 20 impls->push_back(kGLImplementationDesktopGL); |
| 21 impls->push_back(kGLImplementationAppleGL); | 21 impls->push_back(kGLImplementationAppleGL); |
| 22 impls->push_back(kGLImplementationOSMesaGL); | 22 impls->push_back(kGLImplementationOSMesaGL); |
| 23 } | 23 } |
| 24 | 24 |
| 25 bool InitializeDynamicGLBindings(GLImplementation implementation, | |
| 26 GLContext* context) { | |
| 27 switch (implementation) { | |
| 28 case kGLImplementationOSMesaGL: | |
| 29 case kGLImplementationDesktopGL: | |
| 30 case kGLImplementationDesktopGLCoreProfile: | |
| 31 case kGLImplementationAppleGL: | |
| 32 InitializeDynamicGLBindingsGL(context); | |
| 33 break; | |
| 34 case kGLImplementationMockGL: | |
| 35 if (!context) { | |
| 36 scoped_refptr<GLContextStubWithExtensions> mock_context( | |
| 37 new GLContextStubWithExtensions()); | |
| 38 mock_context->SetGLVersionString("3.0"); | |
| 39 InitializeDynamicGLBindingsGL(mock_context.get()); | |
| 40 } else { | |
| 41 InitializeDynamicGLBindingsGL(context); | |
| 42 } | |
| 43 break; | |
| 44 default: | |
| 45 return false; | |
| 46 } | |
| 47 | |
| 48 return true; | |
| 49 } | |
| 50 | |
| 51 bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) { | 25 bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) { |
| 52 return false; | 26 return false; |
| 53 } | 27 } |
| 54 | 28 |
| 55 } // namespace gl | 29 } // namespace gl |
| OLD | NEW |