1//
2// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// main.h: Management of thread-local data.
8
9#ifndef LIBGLESV2_MAIN_H_
10#define LIBGLESV2_MAIN_H_
11
12#include "common/debug.h"
13
14#include <GLES2/gl2.h>
15#include <EGL/egl.h>
16
17namespace egl
18{
19class Display;
20class Surface;
21}
22
23namespace gl
24{
25class Context;
26
27struct Current
28{
29    Context *context;
30    egl::Display *display;
31};
32
33void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface);
34
35Context *getContext();
36Context *getNonLostContext();
37egl::Display *getDisplay();
38
39void error(GLenum errorCode);
40
41template<class T>
42const T &error(GLenum errorCode, const T &returnValue)
43{
44    error(errorCode);
45
46    return returnValue;
47}
48
49}
50
51namespace rx
52{
53class Renderer;
54}
55
56extern "C"
57{
58// Exported functions for use by EGL
59gl::Context *glCreateContext(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
60void glDestroyContext(gl::Context *context);
61void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface);
62gl::Context *glGetCurrentContext();
63rx::Renderer *glCreateRenderer(egl::Display *display, EGLNativeDisplayType nativeDisplay, EGLint requestedDisplayType);
64void glDestroyRenderer(rx::Renderer *renderer);
65
66__eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname);
67bool __stdcall glBindTexImage(egl::Surface *surface);
68}
69
70#endif   // LIBGLESV2_MAIN_H_
71