src/video/SDL_egl.c
author Gabriel Jacobo <gabomdq@gmail.com>
Wed, 21 Aug 2013 10:12:16 -0300
changeset 7679 b1fe132bc6a4
parent 7659 ac4ce59c40e7
child 7702 83878644c8e6
permissions -rw-r--r--
Fixes for -Wdeclaration-after-statement
gabomdq@7659
     1
/*
gabomdq@7659
     2
 *  Simple DirectMedia Layer
gabomdq@7659
     3
 *  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
gabomdq@7659
     4
 * 
gabomdq@7659
     5
 *  This software is provided 'as-is', without any express or implied
gabomdq@7659
     6
 *  warranty.  In no event will the authors be held liable for any damages
gabomdq@7659
     7
 *  arising from the use of this software.
gabomdq@7659
     8
 * 
gabomdq@7659
     9
 *  Permission is granted to anyone to use this software for any purpose,
gabomdq@7659
    10
 *  including commercial applications, and to alter it and redistribute it
gabomdq@7659
    11
 *  freely, subject to the following restrictions:
gabomdq@7659
    12
 * 
gabomdq@7659
    13
 *  1. The origin of this software must not be misrepresented; you must not
gabomdq@7659
    14
 *     claim that you wrote the original software. If you use this software
gabomdq@7659
    15
 *     in a product, an acknowledgment in the product documentation would be
gabomdq@7659
    16
 *     appreciated but is not required.
gabomdq@7659
    17
 *  2. Altered source versions must be plainly marked as such, and must not be
gabomdq@7659
    18
 *     misrepresented as being the original software.
gabomdq@7659
    19
 *  3. This notice may not be removed or altered from any source distribution.
gabomdq@7659
    20
 */
gabomdq@7659
    21
#include "SDL_config.h"
gabomdq@7659
    22
gabomdq@7659
    23
#if SDL_VIDEO_OPENGL_EGL
gabomdq@7659
    24
gabomdq@7659
    25
#include "SDL_sysvideo.h"
gabomdq@7659
    26
#include "SDL_egl.h"
gabomdq@7659
    27
gabomdq@7659
    28
#define DEFAULT_EGL "libEGL.so"
gabomdq@7659
    29
#define DEFAULT_OGL_ES2 "libGLESv2.so"
gabomdq@7659
    30
#define DEFAULT_OGL_ES_PVR "libGLES_CM.so"
gabomdq@7659
    31
#define DEFAULT_OGL_ES "libGLESv1_CM.so"
gabomdq@7659
    32
gabomdq@7659
    33
#define LOAD_FUNC(NAME) \
gabomdq@7659
    34
*((void**)&_this->egl_data->NAME) = dlsym(handle, #NAME); \
gabomdq@7659
    35
if (!_this->egl_data->NAME) \
gabomdq@7659
    36
{ \
gabomdq@7659
    37
    return SDL_SetError("Could not retrieve EGL function " #NAME); \
gabomdq@7659
    38
}
gabomdq@7659
    39
    
gabomdq@7659
    40
/* EGL implementation of SDL OpenGL ES support */
gabomdq@7659
    41
gabomdq@7659
    42
void *
gabomdq@7659
    43
SDL_EGL_GetProcAddress(_THIS, const char *proc)
gabomdq@7659
    44
{
gabomdq@7659
    45
    static char procname[1024];
gabomdq@7659
    46
    void *handle;
gabomdq@7659
    47
    void *retval;
gabomdq@7659
    48
    
gabomdq@7659
    49
    /* eglGetProcAddress is busted on Android http://code.google.com/p/android/issues/detail?id=7681 */
gabomdq@7659
    50
#if !defined(SDL_VIDEO_DRIVER_ANDROID)
gabomdq@7659
    51
    handle = _this->egl_data->egl_dll_handle;
gabomdq@7659
    52
    if (_this->egl_data->eglGetProcAddress) {
gabomdq@7659
    53
        retval = _this->egl_data->eglGetProcAddress(proc);
gabomdq@7659
    54
        if (retval) {
gabomdq@7659
    55
            return retval;
gabomdq@7659
    56
        }
gabomdq@7659
    57
    }
gabomdq@7659
    58
#endif
gabomdq@7659
    59
    
gabomdq@7659
    60
    handle = _this->gl_config.dll_handle;
gabomdq@7659
    61
    #if defined(__OpenBSD__) && !defined(__ELF__)
gabomdq@7659
    62
    #undef dlsym(x,y);
gabomdq@7659
    63
    #endif
gabomdq@7659
    64
    retval = dlsym(handle, proc);
gabomdq@7659
    65
    if (!retval && strlen(proc) <= 1022) {
gabomdq@7659
    66
        procname[0] = '_';
gabomdq@7659
    67
        strcpy(procname + 1, proc);
gabomdq@7659
    68
        retval = dlsym(handle, procname);
gabomdq@7659
    69
    }
gabomdq@7659
    70
    return retval;
gabomdq@7659
    71
}
gabomdq@7659
    72
gabomdq@7659
    73
void
gabomdq@7659
    74
SDL_EGL_UnloadLibrary(_THIS)
gabomdq@7659
    75
{
gabomdq@7659
    76
    if ((_this->egl_data) && (_this->gl_config.driver_loaded)) {
gabomdq@7659
    77
        _this->egl_data->eglTerminate(_this->egl_data->egl_display);
gabomdq@7659
    78
        
gabomdq@7659
    79
        dlclose(_this->gl_config.dll_handle);
gabomdq@7659
    80
        dlclose(_this->egl_data->egl_dll_handle);
gabomdq@7659
    81
        
gabomdq@7659
    82
        SDL_free(_this->egl_data);
gabomdq@7659
    83
        _this->egl_data = NULL;
gabomdq@7659
    84
        
gabomdq@7659
    85
        _this->gl_config.dll_handle = NULL;
gabomdq@7659
    86
        _this->gl_config.driver_loaded = 0;
gabomdq@7659
    87
    }
gabomdq@7659
    88
}
gabomdq@7659
    89
gabomdq@7659
    90
int
gabomdq@7659
    91
SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display)
gabomdq@7659
    92
{
gabomdq@7659
    93
    void *handle;
gabomdq@7659
    94
    int dlopen_flags;
gabomdq@7659
    95
    
gabomdq@7659
    96
    if (_this->egl_data) {
gabomdq@7659
    97
        return SDL_SetError("OpenGL ES context already created");
gabomdq@7659
    98
    }
gabomdq@7659
    99
    
gabomdq@7659
   100
    /* Unload the old driver and reset the pointers */
gabomdq@7659
   101
    SDL_EGL_UnloadLibrary(_this);
gabomdq@7659
   102
    
gabomdq@7659
   103
    #ifdef RTLD_GLOBAL
gabomdq@7659
   104
    dlopen_flags = RTLD_LAZY | RTLD_GLOBAL;
gabomdq@7659
   105
    #else
gabomdq@7659
   106
    dlopen_flags = RTLD_LAZY;
gabomdq@7659
   107
    #endif
gabomdq@7659
   108
    handle = dlopen(path, dlopen_flags);
gabomdq@7659
   109
    /* Catch the case where the application isn't linked with EGL */
gabomdq@7659
   110
    if ((dlsym(handle, "eglChooseConfig") == NULL) && (path == NULL)) {
gabomdq@7659
   111
        
gabomdq@7659
   112
        dlclose(handle);
gabomdq@7659
   113
        path = getenv("SDL_VIDEO_EGL_DRIVER");
gabomdq@7659
   114
        if (path == NULL) {
gabomdq@7659
   115
            path = DEFAULT_EGL;
gabomdq@7659
   116
        }
gabomdq@7659
   117
        handle = dlopen(path, dlopen_flags);
gabomdq@7659
   118
    }
gabomdq@7659
   119
gabomdq@7659
   120
    if (handle == NULL) {
gabomdq@7659
   121
        return SDL_SetError("Could not load OpenGL ES/EGL library");
gabomdq@7659
   122
    }
gabomdq@7659
   123
    
gabomdq@7659
   124
    _this->egl_data = (struct SDL_EGL_VideoData *) SDL_calloc(1, sizeof(SDL_EGL_VideoData));
gabomdq@7659
   125
    if (!_this->egl_data) {
gabomdq@7659
   126
        return SDL_OutOfMemory();
gabomdq@7659
   127
    }
gabomdq@7659
   128
    
gabomdq@7659
   129
    /* Load new function pointers */
gabomdq@7659
   130
    LOAD_FUNC(eglGetDisplay);
gabomdq@7659
   131
    LOAD_FUNC(eglInitialize);
gabomdq@7659
   132
    LOAD_FUNC(eglTerminate);
gabomdq@7659
   133
    LOAD_FUNC(eglGetProcAddress);
gabomdq@7659
   134
    LOAD_FUNC(eglChooseConfig);
gabomdq@7659
   135
    LOAD_FUNC(eglGetConfigAttrib);
gabomdq@7659
   136
    LOAD_FUNC(eglCreateContext);
gabomdq@7659
   137
    LOAD_FUNC(eglDestroyContext);
gabomdq@7659
   138
    LOAD_FUNC(eglCreateWindowSurface);
gabomdq@7659
   139
    LOAD_FUNC(eglDestroySurface);
gabomdq@7659
   140
    LOAD_FUNC(eglMakeCurrent);
gabomdq@7659
   141
    LOAD_FUNC(eglSwapBuffers);
gabomdq@7659
   142
    LOAD_FUNC(eglSwapInterval);
gabomdq@7659
   143
    LOAD_FUNC(eglWaitNative);
gabomdq@7659
   144
    LOAD_FUNC(eglWaitGL);
gabomdq@7659
   145
    
gabomdq@7659
   146
    _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(native_display);
gabomdq@7659
   147
    
gabomdq@7659
   148
    if (!_this->egl_data->egl_display) {
gabomdq@7659
   149
        return SDL_SetError("Could not get EGL display");
gabomdq@7659
   150
    }
gabomdq@7659
   151
    
gabomdq@7659
   152
    if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) {
gabomdq@7659
   153
        return SDL_SetError("Could not initialize EGL");
gabomdq@7659
   154
    }
gabomdq@7659
   155
gabomdq@7659
   156
    _this->egl_data->egl_dll_handle = handle;
gabomdq@7659
   157
gabomdq@7659
   158
    path = getenv("SDL_VIDEO_GL_DRIVER");
gabomdq@7659
   159
    handle = dlopen(path, dlopen_flags);
gabomdq@7659
   160
    if ((path == NULL) | (handle == NULL)) {
gabomdq@7659
   161
      if (_this->gl_config.major_version > 1) {
gabomdq@7659
   162
          path = DEFAULT_OGL_ES2;
gabomdq@7659
   163
          handle = dlopen(path, dlopen_flags);
gabomdq@7659
   164
      } else {
gabomdq@7659
   165
          path = DEFAULT_OGL_ES;
gabomdq@7659
   166
          handle = dlopen(path, dlopen_flags);
gabomdq@7659
   167
          if (handle == NULL) {
gabomdq@7659
   168
              path = DEFAULT_OGL_ES_PVR;
gabomdq@7659
   169
              handle = dlopen(path, dlopen_flags);
gabomdq@7659
   170
          }
gabomdq@7659
   171
      }
gabomdq@7659
   172
    }
gabomdq@7659
   173
gabomdq@7659
   174
    if (handle == NULL) {
gabomdq@7659
   175
      return SDL_SetError("Could not initialize OpenGL ES library");
gabomdq@7659
   176
    }
gabomdq@7659
   177
gabomdq@7659
   178
    _this->gl_config.dll_handle = handle;
gabomdq@7659
   179
    _this->gl_config.driver_loaded = 1;
gabomdq@7659
   180
gabomdq@7659
   181
    if (path) {
gabomdq@7659
   182
      strncpy(_this->gl_config.driver_path, path,
gabomdq@7659
   183
              sizeof(_this->gl_config.driver_path) - 1);
gabomdq@7659
   184
    } else {
gabomdq@7659
   185
      strcpy(_this->gl_config.driver_path, "");
gabomdq@7659
   186
    }
gabomdq@7659
   187
    
gabomdq@7659
   188
    /* We need to select a config here to satisfy some video backends such as X11 */
gabomdq@7659
   189
    SDL_EGL_ChooseConfig(_this);
gabomdq@7659
   190
    
gabomdq@7659
   191
    return 0;
gabomdq@7659
   192
}
gabomdq@7659
   193
gabomdq@7659
   194
int
gabomdq@7659
   195
SDL_EGL_ChooseConfig(_THIS) 
gabomdq@7659
   196
{
gabomdq@7659
   197
    /* 64 seems nice. */
gabomdq@7659
   198
    EGLint attribs[64];
gabomdq@7659
   199
    EGLint found_configs = 0;
gabomdq@7659
   200
    int i;
gabomdq@7659
   201
    
gabomdq@7659
   202
    if (!_this->egl_data) {
gabomdq@7659
   203
        /* The EGL library wasn't loaded, SDL_GetError() should have info */
gabomdq@7659
   204
        return -1;
gabomdq@7659
   205
    }
gabomdq@7659
   206
  
gabomdq@7659
   207
    /* Get a valid EGL configuration */
gabomdq@7659
   208
    i = 0;
gabomdq@7659
   209
    attribs[i++] = EGL_RED_SIZE;
gabomdq@7659
   210
    attribs[i++] = _this->gl_config.red_size;
gabomdq@7659
   211
    attribs[i++] = EGL_GREEN_SIZE;
gabomdq@7659
   212
    attribs[i++] = _this->gl_config.green_size;
gabomdq@7659
   213
    attribs[i++] = EGL_BLUE_SIZE;
gabomdq@7659
   214
    attribs[i++] = _this->gl_config.blue_size;
gabomdq@7659
   215
    
gabomdq@7659
   216
    if (_this->gl_config.alpha_size) {
gabomdq@7659
   217
        attribs[i++] = EGL_ALPHA_SIZE;
gabomdq@7659
   218
        attribs[i++] = _this->gl_config.alpha_size;
gabomdq@7659
   219
    }
gabomdq@7659
   220
    
gabomdq@7659
   221
    if (_this->gl_config.buffer_size) {
gabomdq@7659
   222
        attribs[i++] = EGL_BUFFER_SIZE;
gabomdq@7659
   223
        attribs[i++] = _this->gl_config.buffer_size;
gabomdq@7659
   224
    }
gabomdq@7659
   225
    
gabomdq@7659
   226
    attribs[i++] = EGL_DEPTH_SIZE;
gabomdq@7659
   227
    attribs[i++] = _this->gl_config.depth_size;
gabomdq@7659
   228
    
gabomdq@7659
   229
    if (_this->gl_config.stencil_size) {
gabomdq@7659
   230
        attribs[i++] = EGL_STENCIL_SIZE;
gabomdq@7659
   231
        attribs[i++] = _this->gl_config.stencil_size;
gabomdq@7659
   232
    }
gabomdq@7659
   233
    
gabomdq@7659
   234
    if (_this->gl_config.multisamplebuffers) {
gabomdq@7659
   235
        attribs[i++] = EGL_SAMPLE_BUFFERS;
gabomdq@7659
   236
        attribs[i++] = _this->gl_config.multisamplebuffers;
gabomdq@7659
   237
    }
gabomdq@7659
   238
    
gabomdq@7659
   239
    if (_this->gl_config.multisamplesamples) {
gabomdq@7659
   240
        attribs[i++] = EGL_SAMPLES;
gabomdq@7659
   241
        attribs[i++] = _this->gl_config.multisamplesamples;
gabomdq@7659
   242
    }
gabomdq@7659
   243
    
gabomdq@7659
   244
    attribs[i++] = EGL_RENDERABLE_TYPE;
gabomdq@7659
   245
    if (_this->gl_config.major_version == 2) {
gabomdq@7659
   246
        attribs[i++] = EGL_OPENGL_ES2_BIT;
gabomdq@7659
   247
    } else {
gabomdq@7659
   248
        attribs[i++] = EGL_OPENGL_ES_BIT;
gabomdq@7659
   249
    }
gabomdq@7659
   250
    
gabomdq@7659
   251
    attribs[i++] = EGL_NONE;
gabomdq@7659
   252
    
gabomdq@7659
   253
    if (_this->egl_data->eglChooseConfig(_this->egl_data->egl_display,
gabomdq@7659
   254
        attribs,
gabomdq@7659
   255
        &_this->egl_data->egl_config, 1,
gabomdq@7659
   256
        &found_configs) == EGL_FALSE ||
gabomdq@7659
   257
        found_configs == 0) {
gabomdq@7659
   258
        return SDL_SetError("Couldn't find matching EGL config");
gabomdq@7659
   259
    }
gabomdq@7659
   260
    
gabomdq@7659
   261
    return 0;
gabomdq@7659
   262
}
gabomdq@7659
   263
gabomdq@7659
   264
SDL_GLContext
gabomdq@7659
   265
SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
gabomdq@7659
   266
{
gabomdq@7659
   267
    EGLint context_attrib_list[] = {
gabomdq@7659
   268
        EGL_CONTEXT_CLIENT_VERSION,
gabomdq@7659
   269
        1,
gabomdq@7659
   270
        EGL_NONE
gabomdq@7659
   271
    };
gabomdq@7659
   272
    
gabomdq@7659
   273
    EGLContext egl_context;
gabomdq@7659
   274
    
gabomdq@7659
   275
    if (!_this->egl_data) {
gabomdq@7659
   276
        /* The EGL library wasn't loaded, SDL_GetError() should have info */
gabomdq@7659
   277
        return NULL;
gabomdq@7659
   278
    }
gabomdq@7659
   279
    
gabomdq@7659
   280
    if (_this->gl_config.major_version) {
gabomdq@7659
   281
        context_attrib_list[1] = _this->gl_config.major_version;
gabomdq@7659
   282
    }
gabomdq@7659
   283
gabomdq@7659
   284
    egl_context =
gabomdq@7659
   285
    _this->egl_data->eglCreateContext(_this->egl_data->egl_display,
gabomdq@7659
   286
                                      _this->egl_data->egl_config,
gabomdq@7659
   287
                                      EGL_NO_CONTEXT, context_attrib_list);
gabomdq@7659
   288
    
gabomdq@7659
   289
    if (egl_context == EGL_NO_CONTEXT) {
gabomdq@7659
   290
        SDL_SetError("Could not create EGL context");
gabomdq@7659
   291
        return NULL;
gabomdq@7659
   292
    }
gabomdq@7659
   293
    
gabomdq@7659
   294
    _this->egl_data->egl_swapinterval = 0;
gabomdq@7659
   295
    
gabomdq@7659
   296
    if (SDL_EGL_MakeCurrent(_this, egl_surface, egl_context) < 0) {
gabomdq@7659
   297
        SDL_EGL_DeleteContext(_this, egl_context);
gabomdq@7659
   298
        SDL_SetError("Could not make EGL context current");
gabomdq@7659
   299
        return NULL;
gabomdq@7659
   300
    }
gabomdq@7659
   301
  
gabomdq@7659
   302
    return (SDL_GLContext) egl_context;
gabomdq@7659
   303
}
gabomdq@7659
   304
gabomdq@7659
   305
int
gabomdq@7659
   306
SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context)
gabomdq@7659
   307
{
gabomdq@7679
   308
    EGLContext egl_context = (EGLContext) context;
gabomdq@7679
   309
gabomdq@7659
   310
    if (!_this->egl_data) {
gabomdq@7659
   311
        return SDL_SetError("OpenGL not initialized");
gabomdq@7659
   312
    }
gabomdq@7659
   313
    
gabomdq@7659
   314
    /* The android emulator crashes badly if you try to eglMakeCurrent 
gabomdq@7659
   315
     * with a valid context and invalid surface, so we have to check for both here.
gabomdq@7659
   316
     */
gabomdq@7659
   317
    if (!egl_context || !egl_surface) {
gabomdq@7659
   318
         _this->egl_data->eglMakeCurrent(_this->egl_data->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
gabomdq@7659
   319
    }
gabomdq@7659
   320
    else {
gabomdq@7659
   321
        if (!_this->egl_data->eglMakeCurrent(_this->egl_data->egl_display,
gabomdq@7659
   322
            egl_surface, egl_surface, egl_context)) {
gabomdq@7659
   323
            return SDL_SetError("Unable to make EGL context current");
gabomdq@7659
   324
        }
gabomdq@7659
   325
    }
gabomdq@7659
   326
      
gabomdq@7659
   327
    return 0;
gabomdq@7659
   328
}
gabomdq@7659
   329
gabomdq@7659
   330
int
gabomdq@7659
   331
SDL_EGL_SetSwapInterval(_THIS, int interval)
gabomdq@7659
   332
{
gabomdq@7679
   333
    EGLBoolean status;
gabomdq@7679
   334
    
gabomdq@7659
   335
    if (_this->egl_data) {
gabomdq@7659
   336
        return SDL_SetError("OpenGL ES context not active");
gabomdq@7659
   337
    }
gabomdq@7659
   338
    
gabomdq@7659
   339
    status = _this->egl_data->eglSwapInterval(_this->egl_data->egl_display, interval);
gabomdq@7659
   340
    if (status == EGL_TRUE) {
gabomdq@7659
   341
        _this->egl_data->egl_swapinterval = interval;
gabomdq@7659
   342
        return 0;
gabomdq@7659
   343
    }
gabomdq@7659
   344
    
gabomdq@7659
   345
    return SDL_SetError("Unable to set the EGL swap interval");
gabomdq@7659
   346
}
gabomdq@7659
   347
gabomdq@7659
   348
int
gabomdq@7659
   349
SDL_EGL_GetSwapInterval(_THIS)
gabomdq@7659
   350
{
gabomdq@7659
   351
    if (_this->egl_data) {
gabomdq@7659
   352
        return SDL_SetError("OpenGL ES context not active");
gabomdq@7659
   353
    }
gabomdq@7659
   354
    
gabomdq@7659
   355
    return _this->egl_data->egl_swapinterval;
gabomdq@7659
   356
}
gabomdq@7659
   357
gabomdq@7659
   358
void
gabomdq@7659
   359
SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface)
gabomdq@7659
   360
{
gabomdq@7659
   361
    _this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, egl_surface);
gabomdq@7659
   362
}
gabomdq@7659
   363
gabomdq@7659
   364
void
gabomdq@7659
   365
SDL_EGL_DeleteContext(_THIS, SDL_GLContext context)
gabomdq@7659
   366
{
gabomdq@7679
   367
    EGLContext egl_context = (EGLContext) context;
gabomdq@7679
   368
gabomdq@7659
   369
    /* Clean up GLES and EGL */
gabomdq@7659
   370
    if (!_this->egl_data) {
gabomdq@7659
   371
        return;
gabomdq@7659
   372
    }
gabomdq@7659
   373
    
gabomdq@7659
   374
    if (!egl_context && egl_context != EGL_NO_CONTEXT) {
gabomdq@7659
   375
        SDL_EGL_MakeCurrent(_this, NULL, NULL);
gabomdq@7659
   376
        _this->egl_data->eglDestroyContext(_this->egl_data->egl_display, egl_context);
gabomdq@7659
   377
    }
gabomdq@7659
   378
        
gabomdq@7659
   379
    /* FIXME: This "crappy fix" comes from the X11 code, 
gabomdq@7659
   380
     * it's required so you can create a GLX context, destroy it and create a EGL one */
gabomdq@7659
   381
    SDL_EGL_UnloadLibrary(_this);
gabomdq@7659
   382
}
gabomdq@7659
   383
gabomdq@7659
   384
EGLSurface *
gabomdq@7659
   385
SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) 
gabomdq@7659
   386
{
gabomdq@7659
   387
    return _this->egl_data->eglCreateWindowSurface(
gabomdq@7659
   388
            _this->egl_data->egl_display,
gabomdq@7659
   389
            _this->egl_data->egl_config,
gabomdq@7659
   390
            nw, NULL);
gabomdq@7659
   391
}
gabomdq@7659
   392
gabomdq@7659
   393
void
gabomdq@7659
   394
SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface) 
gabomdq@7659
   395
{
gabomdq@7659
   396
    if (!_this->egl_data) {
gabomdq@7659
   397
        return;
gabomdq@7659
   398
    }
gabomdq@7659
   399
    
gabomdq@7659
   400
    if (egl_surface != EGL_NO_SURFACE) {
gabomdq@7659
   401
        _this->egl_data->eglDestroySurface(_this->egl_data->egl_display, egl_surface);
gabomdq@7659
   402
    }
gabomdq@7659
   403
}
gabomdq@7659
   404
gabomdq@7659
   405
#endif /* SDL_VIDEO_OPENGL_EGL */
gabomdq@7659
   406
gabomdq@7659
   407
/* vi: set ts=4 sw=4 expandtab: */
gabomdq@7659
   408