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