blob: 5d5ab558408f2a677a1cb3aaab737e82a336ae47 [file] [log] [blame]
[email protected]5ae0b282011-03-28 19:24:491// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]b9363b22010-06-09 22:06:152// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]5ae0b282011-03-28 19:24:495#ifndef UI_GFX_GL_GL_IMPLEMENTATION_H_
6#define UI_GFX_GL_GL_IMPLEMENTATION_H_
[email protected]32b76ef2010-07-26 23:08:247#pragma once
[email protected]b9363b22010-06-09 22:06:158
[email protected]30aa5c1a2010-07-14 20:47:049#include <string>
10
11#include "base/native_library.h"
12#include "build/build_config.h"
[email protected]fe377e12011-08-18 17:37:3613#include "ui/gfx/gl/gl_export.h"
[email protected]418c3cb2011-07-28 18:07:4414#include "ui/gfx/gl/gl_switches.h"
[email protected]30aa5c1a2010-07-14 20:47:0415
[email protected]b9363b22010-06-09 22:06:1516namespace gfx {
17
[email protected]6494823b2011-10-27 18:30:4418class GLContext;
19
[email protected]b9363b22010-06-09 22:06:1520// The GL implementation currently in use.
21enum GLImplementation {
22 kGLImplementationNone,
23 kGLImplementationDesktopGL,
24 kGLImplementationOSMesaGL,
25 kGLImplementationEGLGLES2,
26 kGLImplementationMockGL
27};
28
[email protected]30aa5c1a2010-07-14 20:47:0429#if defined(OS_WIN)
30typedef void* (WINAPI *GLGetProcAddressProc)(const char* name);
31#else
32typedef void* (*GLGetProcAddressProc)(const char* name);
33#endif
34
[email protected]b9363b22010-06-09 22:06:1535// Initialize a particular GL implementation.
[email protected]fe377e12011-08-18 17:37:3636GL_EXPORT bool InitializeGLBindings(GLImplementation implementation);
[email protected]b9363b22010-06-09 22:06:1537
[email protected]6494823b2011-10-27 18:30:4438// Initialize extension function bindings for a GL implementation.
39GL_EXPORT bool InitializeGLExtensionBindings(GLImplementation implementation,
40 GLContext* context);
41
[email protected]e9f6aee52010-11-04 20:32:0642// Initialize Debug logging wrappers for GL bindings.
[email protected]218a5a22010-11-04 19:27:4943void InitializeDebugGLBindings();
44
[email protected]30aa5c1a2010-07-14 20:47:0445// Set the current GL implementation.
46void SetGLImplementation(GLImplementation implementation);
47
[email protected]b9363b22010-06-09 22:06:1548// Get the current GL implementation.
[email protected]fe377e12011-08-18 17:37:3649GL_EXPORT GLImplementation GetGLImplementation();
[email protected]b9363b22010-06-09 22:06:1550
[email protected]380aba82011-09-21 18:15:3951// Does the underlying GL support all features from Desktop GL 2.0 that were
52// removed from the ES 2.0 spec without requiring specific extension strings.
53GL_EXPORT bool HasDesktopGLFeatures();
54
[email protected]30aa5c1a2010-07-14 20:47:0455// Get the GL implementation with a given name.
56GLImplementation GetNamedGLImplementation(const std::wstring& name);
57
[email protected]363b20d2011-01-14 22:54:1658// Get the name of a GL implementation.
59const char* GetGLImplementationName(GLImplementation implementation);
60
[email protected]30aa5c1a2010-07-14 20:47:0461// Initialize the preferred GL binding from the given list. The preferred GL
62// bindings depend on command line switches passed by the user and which GL
[email protected]7dac0742011-02-04 22:32:5963// implementation is the default on a given platform.
64bool InitializeRequestedGLBindings(
[email protected]30aa5c1a2010-07-14 20:47:0465 const GLImplementation* allowed_implementations_begin,
[email protected]7dac0742011-02-04 22:32:5966 const GLImplementation* allowed_implementations_end,
67 GLImplementation default_implementation);
[email protected]30aa5c1a2010-07-14 20:47:0468
69// Add a native library to those searched for GL entry points.
70void AddGLNativeLibrary(base::NativeLibrary library);
71
72// Set an additional function that will be called to find GL entry points.
73void SetGLGetProcAddressProc(GLGetProcAddressProc proc);
74
[email protected]6494823b2011-10-27 18:30:4475// 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.
78void* GetGLCoreProcAddress(const char* name);
79
[email protected]b9363b22010-06-09 22:06:1580// Find an entry point in the current GL implementation.
81void* GetGLProcAddress(const char* name);
82
83} // namespace gfx
84
[email protected]5ae0b282011-03-28 19:24:4985#endif // UI_GFX_GL_GL_IMPLEMENTATION_H_