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