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