OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef UI_GFX_GL_GL_IMPLEMENTATION_H_ | 5 #ifndef UI_GFX_GL_GL_IMPLEMENTATION_H_ |
6 #define UI_GFX_GL_GL_IMPLEMENTATION_H_ | 6 #define UI_GFX_GL_GL_IMPLEMENTATION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/native_library.h" | 11 #include "base/native_library.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "ui/gfx/gl/gl_export.h" |
13 #include "ui/gfx/gl/gl_switches.h" | 14 #include "ui/gfx/gl/gl_switches.h" |
14 | 15 |
15 namespace gfx { | 16 namespace gfx { |
16 | 17 |
17 // The GL implementation currently in use. | 18 // The GL implementation currently in use. |
18 enum GLImplementation { | 19 enum GLImplementation { |
19 kGLImplementationNone, | 20 kGLImplementationNone, |
20 kGLImplementationDesktopGL, | 21 kGLImplementationDesktopGL, |
21 kGLImplementationOSMesaGL, | 22 kGLImplementationOSMesaGL, |
22 kGLImplementationEGLGLES2, | 23 kGLImplementationEGLGLES2, |
23 kGLImplementationMockGL | 24 kGLImplementationMockGL |
24 }; | 25 }; |
25 | 26 |
26 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
27 typedef void* (WINAPI *GLGetProcAddressProc)(const char* name); | 28 typedef void* (WINAPI *GLGetProcAddressProc)(const char* name); |
28 #else | 29 #else |
29 typedef void* (*GLGetProcAddressProc)(const char* name); | 30 typedef void* (*GLGetProcAddressProc)(const char* name); |
30 #endif | 31 #endif |
31 | 32 |
32 // Initialize a particular GL implementation. | 33 // Initialize a particular GL implementation. |
33 bool InitializeGLBindings(GLImplementation implementation); | 34 GL_EXPORT bool InitializeGLBindings(GLImplementation implementation); |
34 | 35 |
35 // Initialize Debug logging wrappers for GL bindings. | 36 // Initialize Debug logging wrappers for GL bindings. |
36 void InitializeDebugGLBindings(); | 37 void InitializeDebugGLBindings(); |
37 | 38 |
38 // Set the current GL implementation. | 39 // Set the current GL implementation. |
39 void SetGLImplementation(GLImplementation implementation); | 40 void SetGLImplementation(GLImplementation implementation); |
40 | 41 |
41 // Get the current GL implementation. | 42 // Get the current GL implementation. |
42 GLImplementation GetGLImplementation(); | 43 GL_EXPORT GLImplementation GetGLImplementation(); |
43 | 44 |
44 // Get the GL implementation with a given name. | 45 // Get the GL implementation with a given name. |
45 GLImplementation GetNamedGLImplementation(const std::wstring& name); | 46 GLImplementation GetNamedGLImplementation(const std::wstring& name); |
46 | 47 |
47 // Get the name of a GL implementation. | 48 // Get the name of a GL implementation. |
48 const char* GetGLImplementationName(GLImplementation implementation); | 49 const char* GetGLImplementationName(GLImplementation implementation); |
49 | 50 |
50 // Initialize the preferred GL binding from the given list. The preferred GL | 51 // Initialize the preferred GL binding from the given list. The preferred GL |
51 // bindings depend on command line switches passed by the user and which GL | 52 // bindings depend on command line switches passed by the user and which GL |
52 // implementation is the default on a given platform. | 53 // implementation is the default on a given platform. |
53 bool InitializeRequestedGLBindings( | 54 bool InitializeRequestedGLBindings( |
54 const GLImplementation* allowed_implementations_begin, | 55 const GLImplementation* allowed_implementations_begin, |
55 const GLImplementation* allowed_implementations_end, | 56 const GLImplementation* allowed_implementations_end, |
56 GLImplementation default_implementation); | 57 GLImplementation default_implementation); |
57 | 58 |
58 // Add a native library to those searched for GL entry points. | 59 // Add a native library to those searched for GL entry points. |
59 void AddGLNativeLibrary(base::NativeLibrary library); | 60 void AddGLNativeLibrary(base::NativeLibrary library); |
60 | 61 |
61 // Set an additional function that will be called to find GL entry points. | 62 // Set an additional function that will be called to find GL entry points. |
62 void SetGLGetProcAddressProc(GLGetProcAddressProc proc); | 63 void SetGLGetProcAddressProc(GLGetProcAddressProc proc); |
63 | 64 |
64 // Find an entry point in the current GL implementation. | 65 // Find an entry point in the current GL implementation. |
65 void* GetGLProcAddress(const char* name); | 66 void* GetGLProcAddress(const char* name); |
66 | 67 |
67 } // namespace gfx | 68 } // namespace gfx |
68 | 69 |
69 #endif // UI_GFX_GL_GL_IMPLEMENTATION_H_ | 70 #endif // UI_GFX_GL_GL_IMPLEMENTATION_H_ |
OLD | NEW |