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