michael@0: // michael@0: // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: // main.h: Management of thread-local data. michael@0: michael@0: #ifndef LIBEGL_MAIN_H_ michael@0: #define LIBEGL_MAIN_H_ michael@0: michael@0: #define EGLAPI michael@0: #include michael@0: #include michael@0: michael@0: namespace egl michael@0: { michael@0: struct Current michael@0: { michael@0: EGLint error; michael@0: EGLenum API; michael@0: EGLDisplay display; michael@0: EGLSurface drawSurface; michael@0: EGLSurface readSurface; michael@0: }; michael@0: michael@0: void setCurrentError(EGLint error); michael@0: EGLint getCurrentError(); michael@0: michael@0: void setCurrentAPI(EGLenum API); michael@0: EGLenum getCurrentAPI(); michael@0: michael@0: void setCurrentDisplay(EGLDisplay dpy); michael@0: EGLDisplay getCurrentDisplay(); michael@0: michael@0: void setCurrentDrawSurface(EGLSurface surface); michael@0: EGLSurface getCurrentDrawSurface(); michael@0: michael@0: void setCurrentReadSurface(EGLSurface surface); michael@0: EGLSurface getCurrentReadSurface(); michael@0: michael@0: void error(EGLint errorCode); michael@0: michael@0: template michael@0: const T &error(EGLint errorCode, const T &returnValue) michael@0: { michael@0: error(errorCode); michael@0: michael@0: return returnValue; michael@0: } michael@0: michael@0: template michael@0: const T &success(const T &returnValue) michael@0: { michael@0: egl::setCurrentError(EGL_SUCCESS); michael@0: michael@0: return returnValue; michael@0: } michael@0: michael@0: } michael@0: michael@0: #endif // LIBEGL_MAIN_H_