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