mirror of https://github.com/libsdl-org/SDL
egl: implement public functions to obtain internal EGL handles
These functions allow applications to call EGL functions against the SDL EGL context. For example, applications can use an EGL API loader via SDL_EGL_GetCurrentDisplay and SDL_EGL_GetProcAddress, and can call functions such as eglQuerySurface against the internal EGLSurface and EGLDisplay.
This commit is contained in:
parent
eacf6dc15e
commit
0644042eb8
|
@ -217,6 +217,13 @@ typedef enum
|
|||
*/
|
||||
typedef void *SDL_GLContext;
|
||||
|
||||
/**
|
||||
* \brief Opaque EGL types.
|
||||
*/
|
||||
typedef void *SDL_EGLDisplay;
|
||||
typedef void *SDL_EGLConfig;
|
||||
typedef void *SDL_EGLSurface;
|
||||
|
||||
/**
|
||||
* \brief OpenGL configuration attributes
|
||||
*/
|
||||
|
@ -1903,6 +1910,21 @@ extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
|
|||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
|
||||
|
||||
/**
|
||||
* Get an EGL library function by name.
|
||||
*
|
||||
* If an EGL library is loaded, this function allows applications to get entry
|
||||
* points for EGL functions. This is useful to provide to an EGL API and
|
||||
* extension loader.
|
||||
*
|
||||
* \param proc the name of an EGL function
|
||||
* \returns a pointer to the named EGL function. The returned pointer should be
|
||||
* cast to the appropriate function signature.
|
||||
*
|
||||
* \sa SDL_GL_GetCurrentEGLDisplay
|
||||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_EGL_GetProcAddress(const char *proc);
|
||||
|
||||
/**
|
||||
* Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
|
||||
*
|
||||
|
@ -2041,6 +2063,32 @@ extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void);
|
|||
*/
|
||||
extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void);
|
||||
|
||||
/**
|
||||
* Get the currently active EGL display.
|
||||
*
|
||||
* \returns the currently active EGL display or NULL on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
*/
|
||||
extern DECLSPEC SDL_EGLDisplay SDLCALL SDL_EGL_GetCurrentEGLDisplay(void);
|
||||
|
||||
/**
|
||||
* Get the currently active EGL config.
|
||||
*
|
||||
* \returns the currently active EGL config or NULL on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
*/
|
||||
extern DECLSPEC SDL_EGLConfig SDLCALL SDL_EGL_GetCurrentEGLConfig(void);
|
||||
|
||||
/**
|
||||
* Get the EGL surface associated with the window.
|
||||
*
|
||||
* \returns the EGLSurface pointer associated with the window, or NULL on
|
||||
* failure.
|
||||
*/
|
||||
extern DECLSPEC SDL_EGLSurface SDLCALL SDL_EGL_GetWindowEGLSurface(SDL_Window * window);
|
||||
|
||||
/**
|
||||
* Get the size of a window's underlying drawable in pixels.
|
||||
*
|
||||
|
|
|
@ -242,7 +242,7 @@ SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext
|
|||
}
|
||||
|
||||
void *
|
||||
SDL_EGL_GetProcAddress(_THIS, const char *proc)
|
||||
SDL_EGL_GetProcAddressInternal(_THIS, const char *proc)
|
||||
{
|
||||
const Uint32 eglver = (((Uint32) _this->egl_data->egl_version_major) << 16) | ((Uint32) _this->egl_data->egl_version_minor);
|
||||
const SDL_bool is_egl_15_or_later = eglver >= ((((Uint32) 1) << 16) | 5);
|
||||
|
@ -517,7 +517,7 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa
|
|||
_this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplay(platform, (void *)(uintptr_t)native_display, NULL);
|
||||
} else {
|
||||
if (SDL_EGL_HasExtension(_this, SDL_EGL_CLIENT_EXTENSION, "EGL_EXT_platform_base")) {
|
||||
_this->egl_data->eglGetPlatformDisplayEXT = SDL_EGL_GetProcAddress(_this, "eglGetPlatformDisplayEXT");
|
||||
_this->egl_data->eglGetPlatformDisplayEXT = SDL_EGL_GetProcAddressInternal(_this, "eglGetPlatformDisplayEXT");
|
||||
if (_this->egl_data->eglGetPlatformDisplayEXT) {
|
||||
_this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplayEXT(platform, (void *)(uintptr_t)native_display, NULL);
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ extern int SDL_EGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
|
|||
*/
|
||||
extern int SDL_EGL_LoadLibraryOnly(_THIS, const char *path);
|
||||
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_GetProcAddressInternal(_THIS, const char *proc);
|
||||
extern void SDL_EGL_UnloadLibrary(_THIS);
|
||||
extern void SDL_EGL_SetRequiredVisualId(_THIS, int visual_id);
|
||||
extern int SDL_EGL_ChooseConfig(_THIS);
|
||||
|
|
|
@ -275,6 +275,7 @@ struct SDL_VideoDevice
|
|||
SDL_GLContext(*GL_CreateContext) (_THIS, SDL_Window * window);
|
||||
int (*GL_MakeCurrent) (_THIS, SDL_Window * window, SDL_GLContext context);
|
||||
void (*GL_GetDrawableSize) (_THIS, SDL_Window * window, int *w, int *h);
|
||||
SDL_EGLSurface (*GL_GetEGLSurface) (_THIS, SDL_Window * window);
|
||||
int (*GL_SetSwapInterval) (_THIS, int interval);
|
||||
int (*GL_GetSwapInterval) (_THIS);
|
||||
int (*GL_SwapWindow) (_THIS, SDL_Window * window);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "SDL.h"
|
||||
#include "SDL_video.h"
|
||||
#include "SDL_sysvideo.h"
|
||||
#include "SDL_egl_c.h"
|
||||
#include "SDL_blit.h"
|
||||
#include "SDL_pixels_c.h"
|
||||
#include "SDL_rect_c.h"
|
||||
|
@ -3480,6 +3481,31 @@ SDL_GL_GetProcAddress(const char *proc)
|
|||
return func;
|
||||
}
|
||||
|
||||
void *
|
||||
SDL_EGL_GetProcAddress(const char *proc)
|
||||
{
|
||||
#if SDL_VIDEO_OPENGL_EGL
|
||||
void *func;
|
||||
|
||||
if (!_this) {
|
||||
SDL_UninitializedVideo();
|
||||
return NULL;
|
||||
}
|
||||
func = NULL;
|
||||
|
||||
if (_this->egl_data) {
|
||||
func = SDL_EGL_GetProcAddressInternal(_this, proc);
|
||||
} else {
|
||||
SDL_SetError("No EGL library has been loaded");
|
||||
}
|
||||
|
||||
return func;
|
||||
#else
|
||||
SDL_SetError("SDL was not built with EGL support");
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
SDL_GL_UnloadLibrary(void)
|
||||
{
|
||||
|
@ -4152,6 +4178,66 @@ SDL_GL_GetCurrentContext(void)
|
|||
return (SDL_GLContext)SDL_TLSGet(_this->current_glctx_tls);
|
||||
}
|
||||
|
||||
SDL_EGLDisplay
|
||||
SDL_EGL_GetCurrentEGLDisplay(void)
|
||||
{
|
||||
#if SDL_VIDEO_OPENGL_EGL
|
||||
if (!_this) {
|
||||
SDL_UninitializedVideo();
|
||||
return EGL_NO_DISPLAY;
|
||||
}
|
||||
if (!_this->egl_data) {
|
||||
SDL_SetError("There is no current EGL display");
|
||||
return EGL_NO_DISPLAY;
|
||||
}
|
||||
return _this->egl_data->egl_display;
|
||||
#else
|
||||
SDL_SetError("SDL was not built with EGL support");
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
SDL_EGLConfig
|
||||
SDL_EGL_GetCurrentEGLConfig(void)
|
||||
{
|
||||
#if SDL_VIDEO_OPENGL_EGL
|
||||
if (!_this) {
|
||||
SDL_UninitializedVideo();
|
||||
return NULL;
|
||||
}
|
||||
if (!_this->egl_data) {
|
||||
SDL_SetError("There is no current EGL display");
|
||||
return NULL;
|
||||
}
|
||||
return _this->egl_data->egl_config;
|
||||
#else
|
||||
SDL_SetError("SDL was not built with EGL support");
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
SDL_EGLConfig
|
||||
SDL_EGL_GetWindowEGLSurface(SDL_Window * window)
|
||||
{
|
||||
#if SDL_VIDEO_OPENGL_EGL
|
||||
if (!_this) {
|
||||
SDL_UninitializedVideo();
|
||||
return NULL;
|
||||
}
|
||||
if (!_this->egl_data) {
|
||||
SDL_SetError("There is no current EGL display");
|
||||
return NULL;
|
||||
}
|
||||
if (_this->GL_GetEGLSurface) {
|
||||
return _this->GL_GetEGLSurface(_this, window);
|
||||
}
|
||||
return NULL;
|
||||
#else
|
||||
SDL_SetError("SDL was not built with EGL support");
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SDL_GL_GetDrawableSize(SDL_Window * window, int *w, int *h)
|
||||
{
|
||||
CHECK_WINDOW_MAGIC(window,);
|
||||
|
|
|
@ -50,7 +50,7 @@ static void Android_VideoQuit(_THIS);
|
|||
int Android_GetDisplayDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi);
|
||||
|
||||
#include "../SDL_egl_c.h"
|
||||
#define Android_GLES_GetProcAddress SDL_EGL_GetProcAddress
|
||||
#define Android_GLES_GetProcAddress SDL_EGL_GetProcAddressInternal
|
||||
#define Android_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
|
||||
#define Android_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
|
||||
#define Android_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
/* OpenGLES functions */
|
||||
#define Cocoa_GLES_GetAttribute SDL_EGL_GetAttribute
|
||||
#define Cocoa_GLES_GetProcAddress SDL_EGL_GetProcAddress
|
||||
#define Cocoa_GLES_GetProcAddress SDL_EGL_GetProcAddressInternal
|
||||
#define Cocoa_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
|
||||
#define Cocoa_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
|
||||
#define Cocoa_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
|
||||
|
@ -41,6 +41,7 @@ extern int Cocoa_GLES_SwapWindow(_THIS, SDL_Window * window);
|
|||
extern int Cocoa_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
|
||||
extern void Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context);
|
||||
extern int Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window);
|
||||
extern SDL_EGLSurface Cocoa_GLES_GetEGLSurface(_THIS, SDL_Window * window);
|
||||
|
||||
#endif /* SDL_VIDEO_OPENGL_EGL */
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ Cocoa_GLES_LoadLibrary(_THIS, const char *path)
|
|||
_this->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval;
|
||||
_this->GL_SwapWindow = Cocoa_GL_SwapWindow;
|
||||
_this->GL_DeleteContext = Cocoa_GL_DeleteContext;
|
||||
_this->GL_GetEGLSurface = NULL;
|
||||
return Cocoa_GL_LoadLibrary(_this, path);
|
||||
#else
|
||||
return SDL_SetError("SDL not configured with OpenGL/CGL support");
|
||||
|
@ -77,6 +78,7 @@ Cocoa_GLES_CreateContext(_THIS, SDL_Window * window)
|
|||
_this->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval;
|
||||
_this->GL_SwapWindow = Cocoa_GL_SwapWindow;
|
||||
_this->GL_DeleteContext = Cocoa_GL_DeleteContext;
|
||||
_this->GL_GetEGLSurface = NULL;
|
||||
|
||||
if (Cocoa_GL_LoadLibrary(_this, NULL) != 0) {
|
||||
return NULL;
|
||||
|
@ -145,6 +147,13 @@ Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window)
|
|||
return Cocoa_GLES_MakeCurrent(_this, current_win, current_ctx);
|
||||
}
|
||||
|
||||
SDL_EGLSurface
|
||||
Cocoa_GLES_GetEGLSurface(_THIS, SDL_Window * window)
|
||||
{ @autoreleasepool
|
||||
{
|
||||
return ((__bridge SDL_WindowData *) window->driverdata).egl_surface;
|
||||
}}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_COCOA && SDL_VIDEO_OPENGL_EGL */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -139,6 +139,7 @@ Cocoa_CreateDevice(void)
|
|||
device->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval;
|
||||
device->GL_SwapWindow = Cocoa_GL_SwapWindow;
|
||||
device->GL_DeleteContext = Cocoa_GL_DeleteContext;
|
||||
device->GL_GetEGLSurface = NULL;
|
||||
#endif
|
||||
#if SDL_VIDEO_OPENGL_EGL
|
||||
#if SDL_VIDEO_OPENGL_CGL
|
||||
|
@ -153,6 +154,7 @@ Cocoa_CreateDevice(void)
|
|||
device->GL_GetSwapInterval = Cocoa_GLES_GetSwapInterval;
|
||||
device->GL_SwapWindow = Cocoa_GLES_SwapWindow;
|
||||
device->GL_DeleteContext = Cocoa_GLES_DeleteContext;
|
||||
device->GL_GetEGLSurface = Cocoa_GLES_GetEGLSurface;
|
||||
#if SDL_VIDEO_OPENGL_CGL
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
/* OpenGLES functions */
|
||||
#define Emscripten_GLES_GetAttribute SDL_EGL_GetAttribute
|
||||
#define Emscripten_GLES_GetProcAddress SDL_EGL_GetProcAddress
|
||||
#define Emscripten_GLES_GetProcAddress SDL_EGL_GetProcAddressInternal
|
||||
#define Emscripten_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
|
||||
#define Emscripten_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
|
||||
#define Emscripten_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
/* OpenGLES functions */
|
||||
#define KMSDRM_GLES_GetAttribute SDL_EGL_GetAttribute
|
||||
#define KMSDRM_GLES_GetProcAddress SDL_EGL_GetProcAddress
|
||||
#define KMSDRM_GLES_GetProcAddress SDL_EGL_GetProcAddressInternal
|
||||
#define KMSDRM_GLES_DeleteContext SDL_EGL_DeleteContext
|
||||
#define KMSDRM_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "../SDL_sysvideo.h"
|
||||
#include "../SDL_egl_c.h"
|
||||
|
||||
#define OFFSCREEN_GLES_GetProcAddress SDL_EGL_GetProcAddress
|
||||
#define OFFSCREEN_GLES_GetProcAddress SDL_EGL_GetProcAddressInternal
|
||||
#define OFFSCREEN_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
|
||||
#define OFFSCREEN_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
|
||||
#define OFFSCREEN_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
/* OpenGLES functions */
|
||||
#define RPI_GLES_GetAttribute SDL_EGL_GetAttribute
|
||||
#define RPI_GLES_GetProcAddress SDL_EGL_GetProcAddress
|
||||
#define RPI_GLES_GetProcAddress SDL_EGL_GetProcAddressInternal
|
||||
#define RPI_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
|
||||
#define RPI_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
|
||||
#define RPI_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#if defined(SDL_VIDEO_VITA_PVR_OGL)
|
||||
#include "SDL_vitagl_pvr_c.h"
|
||||
#endif
|
||||
#define VITA_GLES_GetProcAddress SDL_EGL_GetProcAddress
|
||||
#define VITA_GLES_GetProcAddress SDL_EGL_GetProcAddressInternal
|
||||
#define VITA_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
|
||||
#define VITA_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
|
||||
#define VITA_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
/* OpenGLES functions */
|
||||
#define VIVANTE_GLES_GetAttribute SDL_EGL_GetAttribute
|
||||
#define VIVANTE_GLES_GetProcAddress SDL_EGL_GetProcAddress
|
||||
#define VIVANTE_GLES_GetProcAddress SDL_EGL_GetProcAddressInternal
|
||||
#define VIVANTE_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
|
||||
#define VIVANTE_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
|
||||
#define VIVANTE_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
|
||||
|
|
|
@ -40,7 +40,7 @@ Wayland_GLES_LoadLibrary(_THIS, const char *path) {
|
|||
int ret;
|
||||
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
||||
|
||||
ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, 0);
|
||||
ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, _this->gl_config.egl_platform);
|
||||
|
||||
Wayland_PumpEvents(_this);
|
||||
WAYLAND_wl_display_flush(data->display);
|
||||
|
@ -204,6 +204,14 @@ Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context)
|
|||
WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
|
||||
}
|
||||
|
||||
EGLSurface
|
||||
Wayland_GLES_GetEGLSurface(_THIS, SDL_Window * window)
|
||||
{
|
||||
SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
|
||||
|
||||
return windowdata->egl_surface;
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -33,7 +33,7 @@ typedef struct SDL_PrivateGLESData
|
|||
|
||||
/* OpenGLES functions */
|
||||
#define Wayland_GLES_GetAttribute SDL_EGL_GetAttribute
|
||||
#define Wayland_GLES_GetProcAddress SDL_EGL_GetProcAddress
|
||||
#define Wayland_GLES_GetProcAddress SDL_EGL_GetProcAddressInternal
|
||||
#define Wayland_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
|
||||
|
||||
extern int Wayland_GLES_LoadLibrary(_THIS, const char *path);
|
||||
|
@ -43,6 +43,7 @@ extern int Wayland_GLES_GetSwapInterval(_THIS);
|
|||
extern int Wayland_GLES_SwapWindow(_THIS, SDL_Window * window);
|
||||
extern int Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
|
||||
extern void Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context);
|
||||
extern SDL_EGLSurface Wayland_GLES_GetEGLSurface(_THIS, SDL_Window * window);
|
||||
|
||||
#endif /* SDL_waylandopengles_h_ */
|
||||
|
||||
|
|
|
@ -237,6 +237,7 @@ Wayland_CreateDevice(void)
|
|||
device->GL_UnloadLibrary = Wayland_GLES_UnloadLibrary;
|
||||
device->GL_GetProcAddress = Wayland_GLES_GetProcAddress;
|
||||
device->GL_DeleteContext = Wayland_GLES_DeleteContext;
|
||||
device->GL_GetEGLSurface = Wayland_GLES_GetEGLSurface;
|
||||
#endif
|
||||
|
||||
device->CreateSDLWindow = Wayland_CreateWindow;
|
||||
|
|
|
@ -689,6 +689,7 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
|
|||
_this->GL_GetSwapInterval = WIN_GLES_GetSwapInterval;
|
||||
_this->GL_SwapWindow = WIN_GLES_SwapWindow;
|
||||
_this->GL_DeleteContext = WIN_GLES_DeleteContext;
|
||||
_this->GL_GetEGLSurface = WIN_GLES_GetEGLSurface;
|
||||
|
||||
if (WIN_GLES_LoadLibrary(_this, NULL) != 0) {
|
||||
return NULL;
|
||||
|
|
|
@ -45,6 +45,7 @@ WIN_GLES_LoadLibrary(_THIS, const char *path) {
|
|||
_this->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
|
||||
_this->GL_SwapWindow = WIN_GL_SwapWindow;
|
||||
_this->GL_DeleteContext = WIN_GL_DeleteContext;
|
||||
_this->GL_GetEGLSurface = NULL;
|
||||
return WIN_GL_LoadLibrary(_this, path);
|
||||
#else
|
||||
return SDL_SetError("SDL not configured with OpenGL/WGL support");
|
||||
|
@ -77,6 +78,7 @@ WIN_GLES_CreateContext(_THIS, SDL_Window * window)
|
|||
_this->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
|
||||
_this->GL_SwapWindow = WIN_GL_SwapWindow;
|
||||
_this->GL_DeleteContext = WIN_GL_DeleteContext;
|
||||
_this->GL_GetEGLSurface = NULL;
|
||||
|
||||
if (WIN_GL_LoadLibrary(_this, NULL) != 0) {
|
||||
return NULL;
|
||||
|
@ -130,6 +132,14 @@ WIN_GLES_SetupWindow(_THIS, SDL_Window * window)
|
|||
return WIN_GLES_MakeCurrent(_this, current_win, current_ctx);
|
||||
}
|
||||
|
||||
EGLSurface
|
||||
WIN_GLES_GetEGLSurface(_THIS, SDL_Window * window)
|
||||
{
|
||||
SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
|
||||
|
||||
return windowdata->egl_surface;
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
/* OpenGLES functions */
|
||||
#define WIN_GLES_GetAttribute SDL_EGL_GetAttribute
|
||||
#define WIN_GLES_GetProcAddress SDL_EGL_GetProcAddress
|
||||
#define WIN_GLES_GetProcAddress SDL_EGL_GetProcAddressInternal
|
||||
#define WIN_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
|
||||
#define WIN_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
|
||||
#define WIN_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
|
||||
|
@ -41,6 +41,7 @@ extern int WIN_GLES_SwapWindow(_THIS, SDL_Window * window);
|
|||
extern int WIN_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
|
||||
extern void WIN_GLES_DeleteContext(_THIS, SDL_GLContext context);
|
||||
extern int WIN_GLES_SetupWindow(_THIS, SDL_Window * window);
|
||||
extern SDL_EGLSurface WIN_GLES_GetEGLSurface(_THIS, SDL_Window * window);
|
||||
|
||||
#endif /* SDL_VIDEO_OPENGL_EGL */
|
||||
|
||||
|
|
|
@ -226,6 +226,7 @@ WIN_CreateDevice(void)
|
|||
device->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
|
||||
device->GL_SwapWindow = WIN_GL_SwapWindow;
|
||||
device->GL_DeleteContext = WIN_GL_DeleteContext;
|
||||
device->GL_GetEGLSurface = NULL;
|
||||
#endif
|
||||
#if SDL_VIDEO_OPENGL_EGL
|
||||
#if SDL_VIDEO_OPENGL_WGL
|
||||
|
@ -241,6 +242,7 @@ WIN_CreateDevice(void)
|
|||
device->GL_GetSwapInterval = WIN_GLES_GetSwapInterval;
|
||||
device->GL_SwapWindow = WIN_GLES_SwapWindow;
|
||||
device->GL_DeleteContext = WIN_GLES_DeleteContext;
|
||||
device->GL_GetEGLSurface = WIN_GLES_GetEGLSurface;
|
||||
#if SDL_VIDEO_OPENGL_WGL
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
/* OpenGLES functions */
|
||||
#define WINRT_GLES_GetAttribute SDL_EGL_GetAttribute
|
||||
#define WINRT_GLES_GetProcAddress SDL_EGL_GetProcAddress
|
||||
#define WINRT_GLES_GetProcAddress SDL_EGL_GetProcAddressInternal
|
||||
#define WINRT_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
|
||||
#define WINRT_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
|
||||
#define WINRT_GLES_DeleteContext SDL_EGL_DeleteContext
|
||||
|
|
|
@ -104,6 +104,13 @@ X11_GLES_CreateContext(_THIS, SDL_Window * window)
|
|||
return context;
|
||||
}
|
||||
|
||||
SDL_EGLSurface
|
||||
X11_GLES_GetEGLSurface(_THIS, SDL_Window * window)
|
||||
{
|
||||
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
|
||||
return data->egl_surface;
|
||||
}
|
||||
|
||||
SDL_EGL_SwapWindow_impl(X11)
|
||||
SDL_EGL_MakeCurrent_impl(X11)
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef struct SDL_PrivateGLESData
|
|||
|
||||
/* OpenGLES functions */
|
||||
#define X11_GLES_GetAttribute SDL_EGL_GetAttribute
|
||||
#define X11_GLES_GetProcAddress SDL_EGL_GetProcAddress
|
||||
#define X11_GLES_GetProcAddress SDL_EGL_GetProcAddressInternal
|
||||
#define X11_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
|
||||
#define X11_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
|
||||
#define X11_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
|
||||
|
@ -48,6 +48,7 @@ extern XVisualInfo *X11_GLES_GetVisual(_THIS, Display * display, int screen);
|
|||
extern SDL_GLContext X11_GLES_CreateContext(_THIS, SDL_Window * window);
|
||||
extern int X11_GLES_SwapWindow(_THIS, SDL_Window * window);
|
||||
extern int X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
|
||||
extern SDL_EGLSurface X11_GLES_GetEGLSurface(_THIS, SDL_Window * window);
|
||||
|
||||
#endif /* SDL_VIDEO_OPENGL_EGL */
|
||||
|
||||
|
|
|
@ -279,6 +279,7 @@ X11_CreateDevice(void)
|
|||
device->GL_GetSwapInterval = X11_GL_GetSwapInterval;
|
||||
device->GL_SwapWindow = X11_GL_SwapWindow;
|
||||
device->GL_DeleteContext = X11_GL_DeleteContext;
|
||||
device->GL_GetEGLSurface = NULL;
|
||||
#endif
|
||||
#if SDL_VIDEO_OPENGL_EGL
|
||||
#if SDL_VIDEO_OPENGL_GLX
|
||||
|
@ -294,6 +295,7 @@ X11_CreateDevice(void)
|
|||
device->GL_GetSwapInterval = X11_GLES_GetSwapInterval;
|
||||
device->GL_SwapWindow = X11_GLES_SwapWindow;
|
||||
device->GL_DeleteContext = X11_GLES_DeleteContext;
|
||||
device->GL_GetEGLSurface = X11_GLES_GetEGLSurface;
|
||||
#if SDL_VIDEO_OPENGL_GLX
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue