| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | */ |
| | | #include "../SDL_internal.h" |
| | | |
| | | #ifndef _SDL_egl_h |
| | | #define _SDL_egl_h |
| | | #ifndef SDL_egl_h_ |
| | | #define SDL_egl_h_ |
| | | |
| | | #if SDL_VIDEO_OPENGL_EGL |
| | | |
| | |
| | | EGLDisplay egl_display; |
| | | EGLConfig egl_config; |
| | | int egl_swapinterval; |
| | | int egl_surfacetype; |
| | | |
| | | EGLDisplay(EGLAPIENTRY *eglGetDisplay) (NativeDisplayType display); |
| | | EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplay) (EGLenum platform, |
| | | void *native_display, |
| | | const EGLint *attrib_list); |
| | | EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplayEXT) (EGLenum platform, |
| | | void *native_display, |
| | | const EGLint *attrib_list); |
| | | EGLBoolean(EGLAPIENTRY *eglInitialize) (EGLDisplay dpy, EGLint * major, |
| | | EGLint * minor); |
| | | EGLBoolean(EGLAPIENTRY *eglTerminate) (EGLDisplay dpy); |
| | |
| | | |
| | | EGLBoolean(EGLAPIENTRY *eglDestroyContext) (EGLDisplay dpy, EGLContext ctx); |
| | | |
| | | EGLSurface(EGLAPIENTRY *eglCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config, |
| | | EGLint const* attrib_list); |
| | | |
| | | EGLSurface(EGLAPIENTRY *eglCreateWindowSurface) (EGLDisplay dpy, |
| | | EGLConfig config, |
| | | NativeWindowType window, |
| | |
| | | |
| | | EGLBoolean(EGLAPIENTRY *eglBindAPI)(EGLenum); |
| | | |
| | | EGLint(EGLAPIENTRY *eglGetError)(void); |
| | | |
| | | } SDL_EGL_VideoData; |
| | | |
| | | /* OpenGLES functions */ |
| | | extern int SDL_EGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value); |
| | | extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display); |
| | | /* SDL_EGL_LoadLibrary can get a display for a specific platform (EGL_PLATFORM_*) |
| | | * or, if 0 is passed, let the implementation decide. |
| | | */ |
| | | extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display, EGLenum platform); |
| | | extern void *SDL_EGL_GetProcAddress(_THIS, const char *proc); |
| | | extern void SDL_EGL_UnloadLibrary(_THIS); |
| | | extern int SDL_EGL_ChooseConfig(_THIS); |
| | |
| | | /* These need to be wrapped to get the surface for the window by the platform GLES implementation */ |
| | | extern SDL_GLContext SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface); |
| | | extern int SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context); |
| | | extern void SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface); |
| | | extern int SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface); |
| | | |
| | | /* SDL Error-reporting */ |
| | | extern int SDL_EGL_SetErrorEx(const char * message, const char * eglFunctionName, EGLint eglErrorCode); |
| | | #define SDL_EGL_SetError(message, eglFunctionName) SDL_EGL_SetErrorEx(message, eglFunctionName, _this->egl_data->eglGetError()) |
| | | |
| | | /* A few of useful macros */ |
| | | |
| | | #define SDL_EGL_SwapWindow_impl(BACKEND) void \ |
| | | #define SDL_EGL_SwapWindow_impl(BACKEND) int \ |
| | | BACKEND ## _GLES_SwapWindow(_THIS, SDL_Window * window) \ |
| | | {\ |
| | | SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\ |
| | | return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\ |
| | | } |
| | | |
| | | #define SDL_EGL_MakeCurrent_impl(BACKEND) int \ |
| | |
| | | |
| | | #endif /* SDL_VIDEO_OPENGL_EGL */ |
| | | |
| | | #endif /* _SDL_egl_h */ |
| | | #endif /* SDL_egl_h_ */ |
| | | |
| | | /* vi: set ts=4 sw=4 expandtab: */ |