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