blob: 9024ca1f53fc2ea8dd43491a5682e027dee41326 [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
18// The GL implementation currently in use.
19enum GLImplementation {
20 kGLImplementationNone,
21 kGLImplementationDesktopGL,
22 kGLImplementationOSMesaGL,
23 kGLImplementationEGLGLES2,
24 kGLImplementationMockGL
25};
26
[email protected]30aa5c1a2010-07-14 20:47:0427#if defined(OS_WIN)
28typedef void* (WINAPI *GLGetProcAddressProc)(const char* name);
29#else
30typedef void* (*GLGetProcAddressProc)(const char* name);
31#endif
32
[email protected]b9363b22010-06-09 22:06:1533// Initialize a particular GL implementation.
[email protected]fe377e12011-08-18 17:37:3634GL_EXPORT bool InitializeGLBindings(GLImplementation implementation);
[email protected]b9363b22010-06-09 22:06:1535
[email protected]e9f6aee52010-11-04 20:32:0636// Initialize Debug logging wrappers for GL bindings.
[email protected]218a5a22010-11-04 19:27:4937void InitializeDebugGLBindings();
38
[email protected]30aa5c1a2010-07-14 20:47:0439// Set the current GL implementation.
40void SetGLImplementation(GLImplementation implementation);
41
[email protected]b9363b22010-06-09 22:06:1542// Get the current GL implementation.
[email protected]fe377e12011-08-18 17:37:3643GL_EXPORT GLImplementation GetGLImplementation();
[email protected]b9363b22010-06-09 22:06:1544
[email protected]380aba82011-09-21 18:15:3945// Does the underlying GL support all features from Desktop GL 2.0 that were
46// removed from the ES 2.0 spec without requiring specific extension strings.
47GL_EXPORT bool HasDesktopGLFeatures();
48
[email protected]30aa5c1a2010-07-14 20:47:0449// Get the GL implementation with a given name.
50GLImplementation GetNamedGLImplementation(const std::wstring& name);
51
[email protected]363b20d2011-01-14 22:54:1652// Get the name of a GL implementation.
53const char* GetGLImplementationName(GLImplementation implementation);
54
[email protected]30aa5c1a2010-07-14 20:47:0455// Initialize the preferred GL binding from the given list. The preferred GL
56// bindings depend on command line switches passed by the user and which GL
[email protected]7dac0742011-02-04 22:32:5957// implementation is the default on a given platform.
58bool InitializeRequestedGLBindings(
[email protected]30aa5c1a2010-07-14 20:47:0459 const GLImplementation* allowed_implementations_begin,
[email protected]7dac0742011-02-04 22:32:5960 const GLImplementation* allowed_implementations_end,
61 GLImplementation default_implementation);
[email protected]30aa5c1a2010-07-14 20:47:0462
63// Add a native library to those searched for GL entry points.
64void AddGLNativeLibrary(base::NativeLibrary library);
65
66// Set an additional function that will be called to find GL entry points.
67void SetGLGetProcAddressProc(GLGetProcAddressProc proc);
68
[email protected]b9363b22010-06-09 22:06:1569// Find an entry point in the current GL implementation.
70void* GetGLProcAddress(const char* name);
71
72} // namespace gfx
73
[email protected]5ae0b282011-03-28 19:24:4974#endif // UI_GFX_GL_GL_IMPLEMENTATION_H_