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
3 // found in the LICENSE file.
5 #ifndef UI_GL_GL_IMPLEMENTATION_H_
6 #define UI_GL_GL_IMPLEMENTATION_H_
11 #include "base/native_library.h"
12 #include "build/build_config.h"
13 #include "ui/gl/gl_export.h"
14 #include "ui/gl/gl_switches.h"
20 // The GL implementation currently in use.
21 enum GLImplementation
{
22 kGLImplementationNone
,
23 kGLImplementationDesktopGL
,
24 kGLImplementationOSMesaGL
,
25 kGLImplementationAppleGL
,
26 kGLImplementationEGLGLES2
,
27 kGLImplementationMockGL
30 void GetAllowedGLImplementations(std::vector
<GLImplementation
>* impls
);
33 typedef void* (WINAPI
*GLGetProcAddressProc
)(const char* name
);
35 typedef void* (*GLGetProcAddressProc
)(const char* name
);
38 // Initialize a particular GL implementation.
39 GL_EXPORT
bool InitializeGLBindings(GLImplementation implementation
);
41 // Initialize extension function bindings for a GL implementation.
42 GL_EXPORT
bool InitializeGLExtensionBindings(GLImplementation implementation
,
45 // Initialize Debug logging wrappers for GL bindings.
46 void InitializeDebugGLBindings();
48 void ClearGLBindings();
50 // Set the current GL implementation.
51 GL_EXPORT
void SetGLImplementation(GLImplementation implementation
);
53 // Get the current GL implementation.
54 GL_EXPORT GLImplementation
GetGLImplementation();
56 // Does the underlying GL support all features from Desktop GL 2.0 that were
57 // removed from the ES 2.0 spec without requiring specific extension strings.
58 GL_EXPORT
bool HasDesktopGLFeatures();
60 // Get the GL implementation with a given name.
61 GLImplementation
GetNamedGLImplementation(const std::string
& name
);
63 // Get the name of a GL implementation.
64 const char* GetGLImplementationName(GLImplementation implementation
);
66 // Add a native library to those searched for GL entry points.
67 void AddGLNativeLibrary(base::NativeLibrary library
);
69 // Unloads all native libraries.
70 void UnloadGLNativeLibraries();
72 // Set an additional function that will be called to find GL entry points.
73 void SetGLGetProcAddressProc(GLGetProcAddressProc proc
);
75 // Find a core (non-extension) entry point in the current GL implementation. On
76 // EGL based implementations core entry points will not be queried through
77 // GLGetProcAddressProc.
78 void* GetGLCoreProcAddress(const char* name
);
80 // Find an entry point in the current GL implementation.
81 void* GetGLProcAddress(const char* name
);
85 #endif // UI_GL_GL_IMPLEMENTATION_H_