[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef APP_GFX_GL_GL_IMPLEMENTATION_H_ |
| 6 | #define APP_GFX_GL_GL_IMPLEMENTATION_H_ |
| 7 | |
[email protected] | 30aa5c1a | 2010-07-14 20:47:04 | [diff] [blame^] | 8 | #include <string> |
| 9 | |
| 10 | #include "base/native_library.h" |
| 11 | #include "build/build_config.h" |
| 12 | |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 13 | namespace gfx { |
| 14 | |
| 15 | // The GL implementation currently in use. |
| 16 | enum GLImplementation { |
| 17 | kGLImplementationNone, |
| 18 | kGLImplementationDesktopGL, |
| 19 | kGLImplementationOSMesaGL, |
| 20 | kGLImplementationEGLGLES2, |
| 21 | kGLImplementationMockGL |
| 22 | }; |
| 23 | |
[email protected] | 30aa5c1a | 2010-07-14 20:47:04 | [diff] [blame^] | 24 | #if defined(OS_WIN) |
| 25 | typedef void* (WINAPI *GLGetProcAddressProc)(const char* name); |
| 26 | #else |
| 27 | typedef void* (*GLGetProcAddressProc)(const char* name); |
| 28 | #endif |
| 29 | |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 30 | // Initialize a particular GL implementation. |
| 31 | bool InitializeGLBindings(GLImplementation implementation); |
| 32 | |
[email protected] | 30aa5c1a | 2010-07-14 20:47:04 | [diff] [blame^] | 33 | // Set the current GL implementation. |
| 34 | void SetGLImplementation(GLImplementation implementation); |
| 35 | |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 36 | // Get the current GL implementation. |
| 37 | GLImplementation GetGLImplementation(); |
| 38 | |
[email protected] | 30aa5c1a | 2010-07-14 20:47:04 | [diff] [blame^] | 39 | // Get the GL implementation with a given name. |
| 40 | GLImplementation GetNamedGLImplementation(const std::wstring& name); |
| 41 | |
| 42 | // Initialize the preferred GL binding from the given list. The preferred GL |
| 43 | // bindings depend on command line switches passed by the user and which GL |
| 44 | // implementations are available and working on the system |
| 45 | bool InitializeBestGLBindings( |
| 46 | const GLImplementation* allowed_implementations_begin, |
| 47 | const GLImplementation* allowed_implementations_end); |
| 48 | |
| 49 | // Add a native library to those searched for GL entry points. |
| 50 | void AddGLNativeLibrary(base::NativeLibrary library); |
| 51 | |
| 52 | // Set an additional function that will be called to find GL entry points. |
| 53 | void SetGLGetProcAddressProc(GLGetProcAddressProc proc); |
| 54 | |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 55 | // Find an entry point in the current GL implementation. |
| 56 | void* GetGLProcAddress(const char* name); |
| 57 | |
| 58 | } // namespace gfx |
| 59 | |
| 60 | #endif // APP_GFX_GL_GL_IMPLEMENTATION_H_ |