src/video/x11/SDL_x11opengles.c
author Sam Lantinga <slouken@libsdl.org>
Sun, 08 Jan 2012 02:23:37 -0500
changeset 6188 e82023802002
parent 6138 4c64952a58fb
child 6190 519380462400
permissions -rwxr-xr-x
Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11

Scott Percival 2011-07-03 06:41:51 PDT

This submission is aimed at making life easier for OpenGL ES capable devices
running a X11 stack (e.g. Maemo, Meego, TrimSlice, other ARM SoC boards not
running Android). SDL's Pandora support already has the neccesary GLES-to-X11
glue code, however it's all ghetto'd off in Makefile.pandora and not very
flexible.

The patch:
- adds an awesome --enable-video-opengles option to configure
- re-modifies the opengles and opengles2 SDL_renderers to use function pointers
- no idea why this was removed?
- for SDL_Renderers, links in libGLESv1_CM, libGLES_CM (for PowerVR fans) or
libGLESv2 at runtime
- links in libEGL.so at runtime - the old code made an assumption that
eglFunctions could be pulled from the active GLES library, PowerVR for one
doesn't let you do that with their libGLESv2
- allows you to pick which of GLES v1 or v2 to load via
SDL_GL_CONTEXT_MAJOR_VERSION

So far I've tested this on a Nokia N900 (OMAP 3430/SGX 530 running Maemo 5) and
a Toshiba AC100 (Tegra 2 running Ubuntu 10.10). I haven't tested it on... well,
everything that isn't those two, such as a Pandora, iOS or Android device. The
Pandora specific code should be kept intact (fingers crossed), and nothing
painfully drastic has been added to the SDL_renderers. The library loading
sequence in SDL_x11opengles has been updated to accomodate both NVIDIA's
propensity to let developers get away with murder and PowerVR's alternative of
punishing every missed step.

The test apps work okay with GLES or GLES2 as the renderer. For some reason
alpha blending doesn't seem to work on the Tegra 2; last week NVIDIA pushed out
a new set of X11 GLES drivers, so I'll try and investigate once I upgrade
those. Also, this patch adds things to configure.in, include/SDL_config.h.in
and test/configure.in. I didn't know what the policy was re. committing
generated spaghetti from autotools, so ./autogen.sh has to be run again. Sorry.

I think that's about everything, let me know if there's anything I've
overlooked.
slouken@3190
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@6138
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
slouken@3190
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@3190
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@3190
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@3190
    20
*/
slouken@3190
    21
#include "SDL_config.h"
slouken@3190
    22
slouken@6044
    23
#if SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_ES
slouken@3190
    24
slouken@3190
    25
#include "SDL_x11video.h"
slouken@3190
    26
#include "SDL_x11opengles.h"
slouken@3190
    27
slouken@6188
    28
#define DEFAULT_EGL "/usr/lib/libEGL.so"
slouken@6188
    29
#define DEFAULT_OGL_ES2 "/usr/lib/libGLESv2.so"
slouken@6188
    30
#define DEFAULT_OGL_ES_PVR "/usr/lib/libGLES_CM.so"
slouken@6188
    31
#define DEFAULT_OGL_ES "/usr/lib/libGLESv1_CM.so"
slouken@3190
    32
slouken@3190
    33
#define LOAD_FUNC(NAME) \
slouken@3190
    34
	*((void**)&_this->gles_data->NAME) = dlsym(handle, #NAME); \
slouken@3190
    35
	if (!_this->gles_data->NAME) \
slouken@3190
    36
	{ \
slouken@3190
    37
		SDL_SetError("Could not retrieve EGL function " #NAME); \
slouken@3190
    38
		return -1; \
slouken@3190
    39
	}
slouken@3190
    40
slouken@3190
    41
/* GLES implementation of SDL OpenGL support */
slouken@3190
    42
slouken@3190
    43
void *
slouken@3190
    44
X11_GLES_GetProcAddress(_THIS, const char *proc)
slouken@3190
    45
{
slouken@3190
    46
    static char procname[1024];
slouken@3190
    47
    void *handle;
slouken@3190
    48
    void *retval;
slouken@3190
    49
slouken@6188
    50
    handle = _this->gles_data->egl_dll_handle;
slouken@3190
    51
    if (_this->gles_data->eglGetProcAddress) {
slouken@3190
    52
        retval = _this->gles_data->eglGetProcAddress(proc);
slouken@3190
    53
        if (retval) {
slouken@3190
    54
            return retval;
slouken@3190
    55
        }
slouken@3190
    56
    }
slouken@6188
    57
    
slouken@6188
    58
    handle = _this->gl_config.dll_handle;
slouken@3190
    59
#if defined(__OpenBSD__) && !defined(__ELF__)
slouken@3190
    60
#undef dlsym(x,y);
slouken@3190
    61
#endif
slouken@3190
    62
    retval = dlsym(handle, proc);
slouken@3190
    63
    if (!retval && strlen(proc) <= 1022) {
slouken@3190
    64
        procname[0] = '_';
slouken@3190
    65
        strcpy(procname + 1, proc);
slouken@3190
    66
        retval = dlsym(handle, procname);
slouken@3190
    67
    }
slouken@3190
    68
    return retval;
slouken@3190
    69
}
slouken@3190
    70
slouken@3190
    71
void
slouken@3190
    72
X11_GLES_UnloadLibrary(_THIS)
slouken@3190
    73
{
slouken@3190
    74
    if (_this->gl_config.driver_loaded) {
slouken@3190
    75
        _this->gles_data->eglTerminate(_this->gles_data->egl_display);
slouken@3190
    76
slouken@3190
    77
        dlclose(_this->gl_config.dll_handle);
slouken@6188
    78
        dlclose(_this->gles_data->egl_dll_handle);
slouken@3190
    79
slouken@3190
    80
        _this->gles_data->eglGetProcAddress = NULL;
slouken@3190
    81
        _this->gles_data->eglChooseConfig = NULL;
slouken@3190
    82
        _this->gles_data->eglCreateContext = NULL;
slouken@3190
    83
        _this->gles_data->eglCreateWindowSurface = NULL;
slouken@3190
    84
        _this->gles_data->eglDestroyContext = NULL;
slouken@3190
    85
        _this->gles_data->eglDestroySurface = NULL;
slouken@3190
    86
        _this->gles_data->eglMakeCurrent = NULL;
slouken@3190
    87
        _this->gles_data->eglSwapBuffers = NULL;
slouken@3190
    88
        _this->gles_data->eglGetDisplay = NULL;
slouken@3190
    89
        _this->gles_data->eglTerminate = NULL;
slouken@3190
    90
slouken@3190
    91
        _this->gl_config.dll_handle = NULL;
slouken@3190
    92
        _this->gl_config.driver_loaded = 0;
slouken@3190
    93
    }
slouken@3190
    94
}
slouken@3190
    95
slouken@3190
    96
int
slouken@3190
    97
X11_GLES_LoadLibrary(_THIS, const char *path)
slouken@3190
    98
{
slouken@3190
    99
    void *handle;
slouken@3190
   100
    int dlopen_flags;
slouken@3190
   101
slouken@3190
   102
    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
slouken@3190
   103
slouken@3190
   104
    if (_this->gles_data->egl_active) {
slouken@3190
   105
        SDL_SetError("OpenGL ES context already created");
slouken@3190
   106
        return -1;
slouken@3190
   107
    }
slouken@3190
   108
#ifdef RTLD_GLOBAL
slouken@3190
   109
    dlopen_flags = RTLD_LAZY | RTLD_GLOBAL;
slouken@3190
   110
#else
slouken@3190
   111
    dlopen_flags = RTLD_LAZY;
slouken@3190
   112
#endif
slouken@3190
   113
    handle = dlopen(path, dlopen_flags);
slouken@3190
   114
    /* Catch the case where the application isn't linked with EGL */
slouken@3190
   115
    if ((dlsym(handle, "eglChooseConfig") == NULL) && (path == NULL)) {
slouken@3190
   116
slouken@3190
   117
        dlclose(handle);
slouken@3190
   118
        path = getenv("SDL_VIDEO_GL_DRIVER");
slouken@3190
   119
        if (path == NULL) {
slouken@6188
   120
            path = DEFAULT_EGL;
slouken@3190
   121
        }
slouken@3190
   122
        handle = dlopen(path, dlopen_flags);
slouken@3190
   123
    }
slouken@3190
   124
slouken@3190
   125
    if (handle == NULL) {
slouken@3190
   126
        SDL_SetError("Could not load OpenGL ES/EGL library");
slouken@3190
   127
        return -1;
slouken@3190
   128
    }
slouken@3190
   129
slouken@3190
   130
    /* Unload the old driver and reset the pointers */
slouken@3190
   131
    X11_GLES_UnloadLibrary(_this);
slouken@3190
   132
slouken@3190
   133
    /* Load new function pointers */
slouken@3190
   134
    LOAD_FUNC(eglGetDisplay);
slouken@3190
   135
    LOAD_FUNC(eglInitialize);
slouken@3190
   136
    LOAD_FUNC(eglTerminate);
slouken@3190
   137
    LOAD_FUNC(eglGetProcAddress);
slouken@3190
   138
    LOAD_FUNC(eglChooseConfig);
slouken@3190
   139
    LOAD_FUNC(eglGetConfigAttrib);
slouken@3190
   140
    LOAD_FUNC(eglCreateContext);
slouken@3190
   141
    LOAD_FUNC(eglDestroyContext);
slouken@3190
   142
    LOAD_FUNC(eglCreateWindowSurface);
slouken@3190
   143
    LOAD_FUNC(eglDestroySurface);
slouken@3190
   144
    LOAD_FUNC(eglMakeCurrent);
slouken@3190
   145
    LOAD_FUNC(eglSwapBuffers);
slouken@3190
   146
slouken@3190
   147
    _this->gles_data->egl_display =
slouken@3190
   148
        _this->gles_data->eglGetDisplay((NativeDisplayType) data->display);
slouken@3190
   149
slouken@3190
   150
    if (!_this->gles_data->egl_display) {
slouken@3190
   151
        SDL_SetError("Could not get EGL display");
slouken@3190
   152
        return -1;
slouken@3190
   153
    }
slouken@3190
   154
slouken@3190
   155
    if (_this->gles_data->
slouken@3190
   156
        eglInitialize(_this->gles_data->egl_display, NULL,
slouken@3190
   157
                      NULL) != EGL_TRUE) {
slouken@3190
   158
        SDL_SetError("Could not initialize EGL");
slouken@3190
   159
        return -1;
slouken@3190
   160
    }
slouken@3190
   161
slouken@6188
   162
    _this->gles_data->egl_dll_handle = handle;
slouken@6188
   163
slouken@6188
   164
    path = getenv("SDL_VIDEO_GL_DRIVER");
slouken@6188
   165
    handle = dlopen(path, dlopen_flags);
slouken@6188
   166
    if ((path == NULL) | (handle == NULL)) {
slouken@6188
   167
        if (_this->gl_config.major_version > 1) {
slouken@6188
   168
            path = DEFAULT_OGL_ES2;
slouken@6188
   169
            handle = dlopen(path, dlopen_flags);
slouken@6188
   170
        } else {
slouken@6188
   171
            path = DEFAULT_OGL_ES;
slouken@6188
   172
            handle = dlopen(path, dlopen_flags);
slouken@6188
   173
            if (handle == NULL) {
slouken@6188
   174
                path = DEFAULT_OGL_ES_PVR;
slouken@6188
   175
                handle = dlopen(path, dlopen_flags);
slouken@6188
   176
            }
slouken@6188
   177
        }
slouken@6188
   178
    }
slouken@6188
   179
slouken@6188
   180
    if (handle == NULL) {
slouken@6188
   181
        SDL_SetError("Could not initialize OpenGL ES library");
slouken@6188
   182
        return -1;
slouken@6188
   183
    }
slouken@6188
   184
slouken@3190
   185
    _this->gl_config.dll_handle = handle;
slouken@3190
   186
    _this->gl_config.driver_loaded = 1;
slouken@3190
   187
slouken@3190
   188
    if (path) {
slouken@3190
   189
        strncpy(_this->gl_config.driver_path, path,
slouken@3190
   190
                sizeof(_this->gl_config.driver_path) - 1);
slouken@3190
   191
    } else {
slouken@3190
   192
        strcpy(_this->gl_config.driver_path, "");
slouken@3190
   193
    }
slouken@3190
   194
    return 0;
slouken@3190
   195
}
slouken@3190
   196
slouken@3190
   197
XVisualInfo *
slouken@3190
   198
X11_GLES_GetVisual(_THIS, Display * display, int screen)
slouken@3190
   199
{
slouken@3190
   200
    /* 64 seems nice. */
slouken@3190
   201
    EGLint attribs[64];
slouken@3190
   202
    EGLint found_configs = 0;
slouken@3190
   203
    VisualID visual_id;
slouken@3190
   204
    int i;
slouken@3190
   205
slouken@3190
   206
    /* load the gl driver from a default path */
slouken@3190
   207
    if (!_this->gl_config.driver_loaded) {
slouken@3190
   208
        /* no driver has been loaded, use default (ourselves) */
slouken@3190
   209
        if (X11_GLES_LoadLibrary(_this, NULL) < 0) {
slouken@3190
   210
            return NULL;
slouken@3190
   211
        }
slouken@3190
   212
    }
slouken@3190
   213
slouken@3190
   214
    i = 0;
slouken@3190
   215
    attribs[i++] = EGL_RED_SIZE;
slouken@3190
   216
    attribs[i++] = _this->gl_config.red_size;
slouken@3190
   217
    attribs[i++] = EGL_GREEN_SIZE;
slouken@3190
   218
    attribs[i++] = _this->gl_config.green_size;
slouken@3190
   219
    attribs[i++] = EGL_BLUE_SIZE;
slouken@3190
   220
    attribs[i++] = _this->gl_config.blue_size;
slouken@3190
   221
slouken@3190
   222
    if (_this->gl_config.alpha_size) {
slouken@3190
   223
        attribs[i++] = EGL_ALPHA_SIZE;
slouken@3190
   224
        attribs[i++] = _this->gl_config.alpha_size;
slouken@3190
   225
    }
slouken@3190
   226
slouken@3190
   227
    if (_this->gl_config.buffer_size) {
slouken@3190
   228
        attribs[i++] = EGL_BUFFER_SIZE;
slouken@3190
   229
        attribs[i++] = _this->gl_config.buffer_size;
slouken@3190
   230
    }
slouken@3190
   231
slouken@3190
   232
    attribs[i++] = EGL_DEPTH_SIZE;
slouken@3190
   233
    attribs[i++] = _this->gl_config.depth_size;
slouken@3190
   234
slouken@3190
   235
    if (_this->gl_config.stencil_size) {
slouken@3190
   236
        attribs[i++] = EGL_STENCIL_SIZE;
slouken@3190
   237
        attribs[i++] = _this->gl_config.stencil_size;
slouken@3190
   238
    }
slouken@3190
   239
slouken@3190
   240
    if (_this->gl_config.multisamplebuffers) {
slouken@3190
   241
        attribs[i++] = EGL_SAMPLE_BUFFERS;
slouken@3190
   242
        attribs[i++] = _this->gl_config.multisamplebuffers;
slouken@3190
   243
    }
slouken@3190
   244
slouken@3190
   245
    if (_this->gl_config.multisamplesamples) {
slouken@3190
   246
        attribs[i++] = EGL_SAMPLES;
slouken@3190
   247
        attribs[i++] = _this->gl_config.multisamplesamples;
slouken@3190
   248
    }
slouken@3190
   249
slouken@6188
   250
    attribs[i++] = EGL_RENDERABLE_TYPE;
slouken@6188
   251
    if (_this->gl_config.major_version == 2) {
slouken@6188
   252
        attribs[i++] = EGL_OPENGL_ES2_BIT;
slouken@6188
   253
    } else {
slouken@6188
   254
        attribs[i++] = EGL_OPENGL_ES_BIT;
slouken@6188
   255
    }
slouken@6188
   256
slouken@3190
   257
    attribs[i++] = EGL_NONE;
slouken@3190
   258
slouken@3190
   259
    if (_this->gles_data->eglChooseConfig(_this->gles_data->egl_display,
slouken@3190
   260
                                          attribs,
slouken@3190
   261
                                          &_this->gles_data->egl_config, 1,
slouken@3190
   262
                                          &found_configs) == EGL_FALSE ||
slouken@3190
   263
        found_configs == 0) {
slouken@3190
   264
        SDL_SetError("Couldn't find matching EGL config");
slouken@3190
   265
        return NULL;
slouken@3190
   266
    }
slouken@3190
   267
slouken@3190
   268
    if (_this->gles_data->eglGetConfigAttrib(_this->gles_data->egl_display,
slouken@3190
   269
                                             _this->gles_data->egl_config,
slouken@3190
   270
                                             EGL_NATIVE_VISUAL_ID,
slouken@3190
   271
                                             (EGLint *) & visual_id) ==
slouken@3190
   272
        EGL_FALSE || !visual_id) {
slouken@3190
   273
        /* Use the default visual when all else fails */
slouken@3190
   274
        XVisualInfo vi_in;
slouken@3190
   275
        int out_count;
slouken@3190
   276
        vi_in.screen = screen;
slouken@3190
   277
slouken@3190
   278
        _this->gles_data->egl_visualinfo = XGetVisualInfo(display,
slouken@3190
   279
                                                          VisualScreenMask,
slouken@3190
   280
                                                          &vi_in, &out_count);
slouken@3190
   281
    } else {
slouken@3190
   282
        XVisualInfo vi_in;
slouken@3190
   283
        int out_count;
slouken@3190
   284
slouken@3190
   285
        vi_in.screen = screen;
slouken@3190
   286
        vi_in.visualid = visual_id;
slouken@3190
   287
        _this->gles_data->egl_visualinfo = XGetVisualInfo(display,
slouken@3190
   288
                                                          VisualScreenMask |
slouken@3190
   289
                                                          VisualIDMask,
slouken@3190
   290
                                                          &vi_in, &out_count);
slouken@3190
   291
    }
slouken@3190
   292
slouken@3190
   293
    return _this->gles_data->egl_visualinfo;
slouken@3190
   294
}
slouken@3190
   295
slouken@3190
   296
SDL_GLContext
slouken@3190
   297
X11_GLES_CreateContext(_THIS, SDL_Window * window)
slouken@3190
   298
{
slouken@6188
   299
    EGLint context_attrib_list[] = {
slouken@6188
   300
        EGL_CONTEXT_CLIENT_VERSION,
slouken@6188
   301
        1,
slouken@6188
   302
        EGL_NONE
slouken@6188
   303
    };
slouken@6188
   304
slouken@3190
   305
    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
slouken@3190
   306
    Display *display = data->videodata->display;
slouken@3190
   307
slouken@3190
   308
    XSync(display, False);
slouken@3190
   309
slouken@6188
   310
    if (_this->gl_config.major_version) {
slouken@6188
   311
        context_attrib_list[1] = _this->gl_config.major_version;
slouken@6188
   312
    }
slouken@3190
   313
slouken@3190
   314
    _this->gles_data->egl_context =
slouken@3190
   315
        _this->gles_data->eglCreateContext(_this->gles_data->egl_display,
slouken@3190
   316
                                           _this->gles_data->egl_config,
slouken@6188
   317
                                           EGL_NO_CONTEXT, context_attrib_list);
slouken@3190
   318
    XSync(display, False);
slouken@3190
   319
slouken@3190
   320
    if (_this->gles_data->egl_context == EGL_NO_CONTEXT) {
slouken@3190
   321
        SDL_SetError("Could not create EGL context");
slouken@3190
   322
        return NULL;
slouken@3190
   323
    }
slouken@3190
   324
slouken@3190
   325
    _this->gles_data->egl_active = 1;
slouken@3190
   326
slouken@6188
   327
    if (X11_GLES_MakeCurrent(_this, window, context) < 0) {
slouken@6188
   328
        X11_GLES_DeleteContext(_this, context);
slouken@6188
   329
        return NULL;
slouken@6188
   330
    }
slouken@3190
   331
slouken@6188
   332
    return (SDL_GLContext)(1);
slouken@3190
   333
}
slouken@3190
   334
slouken@3190
   335
int
slouken@3190
   336
X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
slouken@3190
   337
{
slouken@3190
   338
    int retval;
slouken@3190
   339
slouken@3218
   340
//    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
slouken@3218
   341
//    Display *display = data->videodata->display;
slouken@3190
   342
slouken@3190
   343
    retval = 1;
slouken@3190
   344
    if (!_this->gles_data->eglMakeCurrent(_this->gles_data->egl_display,
slouken@3190
   345
                                          _this->gles_data->egl_surface,
slouken@3190
   346
                                          _this->gles_data->egl_surface,
slouken@3190
   347
                                          _this->gles_data->egl_context)) {
slouken@3190
   348
        SDL_SetError("Unable to make EGL context current");
slouken@3190
   349
        retval = -1;
slouken@3190
   350
    }
slouken@3218
   351
//    XSync(display, False);
slouken@3190
   352
slouken@3190
   353
    return (retval);
slouken@3190
   354
}
slouken@3190
   355
slouken@3190
   356
static int swapinterval = -1;
slouken@3190
   357
int
slouken@3190
   358
X11_GLES_SetSwapInterval(_THIS, int interval)
slouken@3190
   359
{
slouken@3190
   360
    return 0;
slouken@3190
   361
}
slouken@3190
   362
slouken@3190
   363
int
slouken@3190
   364
X11_GLES_GetSwapInterval(_THIS)
slouken@3190
   365
{
slouken@3190
   366
    return 0;
slouken@3190
   367
}
slouken@3190
   368
slouken@3190
   369
void
slouken@3190
   370
X11_GLES_SwapWindow(_THIS, SDL_Window * window)
slouken@3190
   371
{
slouken@3190
   372
    _this->gles_data->eglSwapBuffers(_this->gles_data->egl_display,
slouken@3190
   373
                                     _this->gles_data->egl_surface);
slouken@3190
   374
}
slouken@3190
   375
slouken@3190
   376
void
slouken@3190
   377
X11_GLES_DeleteContext(_THIS, SDL_GLContext context)
slouken@3190
   378
{
slouken@3190
   379
    /* Clean up GLES and EGL */
slouken@3190
   380
    if (_this->gles_data->egl_context != EGL_NO_CONTEXT ||
slouken@3190
   381
        _this->gles_data->egl_surface != EGL_NO_SURFACE) {
slouken@3190
   382
        _this->gles_data->eglMakeCurrent(_this->gles_data->egl_display,
slouken@3190
   383
                                         EGL_NO_SURFACE, EGL_NO_SURFACE,
slouken@3190
   384
                                         EGL_NO_CONTEXT);
slouken@3190
   385
slouken@3190
   386
        if (_this->gles_data->egl_context != EGL_NO_CONTEXT) {
slouken@3190
   387
            _this->gles_data->eglDestroyContext(_this->gles_data->egl_display,
slouken@3190
   388
                                                _this->gles_data->
slouken@3190
   389
                                                egl_context);
slouken@3190
   390
            _this->gles_data->egl_context = EGL_NO_CONTEXT;
slouken@3190
   391
        }
slouken@3190
   392
slouken@3190
   393
        if (_this->gles_data->egl_surface != EGL_NO_SURFACE) {
slouken@3190
   394
            _this->gles_data->eglDestroySurface(_this->gles_data->egl_display,
slouken@3190
   395
                                                _this->gles_data->
slouken@3190
   396
                                                egl_surface);
slouken@3190
   397
            _this->gles_data->egl_surface = EGL_NO_SURFACE;
slouken@3190
   398
        }
slouken@3190
   399
    }
slouken@3190
   400
    _this->gles_data->egl_active = 0;
slouken@3218
   401
slouken@3218
   402
/* crappy fix */
slouken@3218
   403
    X11_GLES_UnloadLibrary(_this);
slouken@3218
   404
slouken@3190
   405
}
slouken@3190
   406
slouken@6044
   407
#endif /* SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_ES */
slouken@3190
   408
slouken@3190
   409
/* vi: set ts=4 sw=4 expandtab: */