blob: b8f43f19988e41951fb6466180da4ff341adfef2 [file] [log] [blame]
[email protected]b9363b22010-06-09 22:06:151// 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_
[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"
13
[email protected]b9363b22010-06-09 22:06:1514namespace gfx {
15
16// The GL implementation currently in use.
17enum GLImplementation {
18 kGLImplementationNone,
19 kGLImplementationDesktopGL,
20 kGLImplementationOSMesaGL,
21 kGLImplementationEGLGLES2,
22 kGLImplementationMockGL
23};
24
[email protected]aefbf902010-10-27 19:42:5625// The GL implementation names that can be passed to --use-gl.
26extern const char kGLImplementationDesktopName[];
27extern const char kGLImplementationOSMesaName[];
28extern const char kGLImplementationEGLName[];
29extern const char kGLImplementationMockName[];
30
[email protected]30aa5c1a2010-07-14 20:47:0431#if defined(OS_WIN)
32typedef void* (WINAPI *GLGetProcAddressProc)(const char* name);
33#else
34typedef void* (*GLGetProcAddressProc)(const char* name);
35#endif
36
[email protected]b9363b22010-06-09 22:06:1537// Initialize a particular GL implementation.
38bool InitializeGLBindings(GLImplementation implementation);
39
[email protected]e9f6aee52010-11-04 20:32:0640// Initialize Debug logging wrappers for GL bindings.
[email protected]218a5a22010-11-04 19:27:4941void InitializeDebugGLBindings();
42
[email protected]30aa5c1a2010-07-14 20:47:0443// Set the current GL implementation.
44void SetGLImplementation(GLImplementation implementation);
45
[email protected]b9363b22010-06-09 22:06:1546// Get the current GL implementation.
47GLImplementation GetGLImplementation();
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
57// implementations are available and working on the system
58bool InitializeBestGLBindings(
59 const GLImplementation* allowed_implementations_begin,
60 const GLImplementation* allowed_implementations_end);
61
62// Add a native library to those searched for GL entry points.
63void AddGLNativeLibrary(base::NativeLibrary library);
64
65// Set an additional function that will be called to find GL entry points.
66void SetGLGetProcAddressProc(GLGetProcAddressProc proc);
67
[email protected]b9363b22010-06-09 22:06:1568// Find an entry point in the current GL implementation.
69void* GetGLProcAddress(const char* name);
70
71} // namespace gfx
72
73#endif // APP_GFX_GL_GL_IMPLEMENTATION_H_