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