Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / angle / src / libEGL / main.h
1 //
2 // Copyright (c) 2002-2010 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 LIBEGL_MAIN_H_
10 #define LIBEGL_MAIN_H_
11
12 #include <EGL/egl.h>
13 #include <EGL/eglext.h>
14
15 namespace egl
16 {
17 struct Current
18 {
19     EGLint error;
20     EGLenum API;
21     EGLDisplay display;
22     EGLSurface drawSurface;
23     EGLSurface readSurface;
24 };
25
26 void setCurrentError(EGLint error);
27 EGLint getCurrentError();
28
29 void setCurrentAPI(EGLenum API);
30 EGLenum getCurrentAPI();
31
32 void setCurrentDisplay(EGLDisplay dpy);
33 EGLDisplay getCurrentDisplay();
34
35 void setCurrentDrawSurface(EGLSurface surface);
36 EGLSurface getCurrentDrawSurface();
37
38 void setCurrentReadSurface(EGLSurface surface);
39 EGLSurface getCurrentReadSurface();
40
41 void error(EGLint errorCode);
42
43 template<class T>
44 const T &error(EGLint errorCode, const T &returnValue)
45 {
46     error(errorCode);
47
48     return returnValue;
49 }
50
51 template<class T>
52 const T &success(const T &returnValue)
53 {
54     egl::setCurrentError(EGL_SUCCESS);
55
56     return returnValue;
57 }
58
59 }
60
61 #endif  // LIBEGL_MAIN_H_