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 #include "common/system.h"
14
15 namespace egl
16 {
17 class Display;
18 class Surface;
19 }
20
21 namespace gl
22 {
23 class Context;
24
25 struct Current
26 {
27 Context *context;
28 egl::Display *display;
29 };
30
31 void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface);
32
33 Context *getContext();
34 Context *getNonLostContext();
35 egl::Display *getDisplay();
36
37 void error(GLenum errorCode);
38
39 template<class T>
error(GLenum errorCode,const T & returnValue)40 const T &error(GLenum errorCode, const T &returnValue)
41 {
42 error(errorCode);
43
44 return returnValue;
45 }
46
47 }
48
49 namespace rx
50 {
51 class Renderer;
52 }
53
54 extern "C"
55 {
56 // Exported functions for use by EGL
57 gl::Context *glCreateContext(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
58 void glDestroyContext(gl::Context *context);
59 void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface);
60 gl::Context *glGetCurrentContext();
61 rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayType displayId);
62 void glDestroyRenderer(rx::Renderer *renderer);
63
64 __eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname);
65 bool __stdcall glBindTexImage(egl::Surface *surface);
66 }
67
68 #endif // LIBGLESV2_MAIN_H_
69