src/video/wayland/SDL_waylandopengles.c
changeset 8104 2e4f1bd21196
parent 8062 4fc5f66d63cc
child 8149 681eb46b8ac4
equal deleted inserted replaced
8103:d4a88c49247e 8104:2e4f1bd21196
    16      appreciated but is not required.
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    20 */
    21 #include "SDL_config.h"
    21 #include "../../SDL_internal.h"
    22 
    22 
    23 #if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL
    23 #if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL
    24 
    24 
    25 #include "SDL_waylandvideo.h"
    25 #include "SDL_waylandvideo.h"
    26 #include "SDL_waylandopengles.h"
    26 #include "SDL_waylandopengles.h"
    27 #include "SDL_waylandwindow.h"
    27 #include "SDL_waylandwindow.h"
    28 #include "SDL_waylandevents_c.h"
    28 #include "SDL_waylandevents_c.h"
       
    29 #include "SDL_waylanddyn.h"
    29 
    30 
    30 /* EGL implementation of SDL OpenGL ES support */
    31 /* EGL implementation of SDL OpenGL ES support */
    31 
    32 
    32 int
    33 int
    33 Wayland_GLES_LoadLibrary(_THIS, const char *path) {
    34 Wayland_GLES_LoadLibrary(_THIS, const char *path) {
    35     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    36     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    36     
    37     
    37     ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display);
    38     ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display);
    38 
    39 
    39     Wayland_PumpEvents(_this);
    40     Wayland_PumpEvents(_this);
    40     wayland_schedule_write(data);
    41     WAYLAND_wl_display_flush(data->display);
    41     
    42     
    42     return ret;
    43     return ret;
    43 }
    44 }
    44 
    45 
    45 
    46 
    46 SDL_GLContext
    47 SDL_GLContext
    47 Wayland_GLES_CreateContext(_THIS, SDL_Window * window)
    48 Wayland_GLES_CreateContext(_THIS, SDL_Window * window)
    48 {
    49 {
    49     SDL_GLContext context;
    50     SDL_GLContext context;
    50     context = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
    51     context = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
    51     wayland_schedule_write(_this->driverdata);
    52     WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
    52     
    53     
    53     return context;
    54     return context;
    54 }
    55 }
    55 
    56 
    56 void
    57 void
    57 Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
    58 Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
    58 {
    59 {
    59     SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
    60     SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
    60     wayland_schedule_write(_this->driverdata);
    61     WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
    61 }
    62 }
    62 
    63 
    63 
    64 
    64 int
    65 int
    65 Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
    66 Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
    71     }
    72     }
    72     else {
    73     else {
    73         ret = SDL_EGL_MakeCurrent(_this, NULL, NULL);
    74         ret = SDL_EGL_MakeCurrent(_this, NULL, NULL);
    74     }
    75     }
    75     
    76     
    76     wayland_schedule_write(_this->driverdata);
    77     WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
    77     
    78     
    78     return ret;
    79     return ret;
    79 }
    80 }
    80 
    81 
    81 void 
    82 void 
    82 Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context)
    83 Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context)
    83 {
    84 {
    84     SDL_EGL_DeleteContext(_this, context);
    85     SDL_EGL_DeleteContext(_this, context);
    85     wayland_schedule_write(_this->driverdata);
    86     WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
    86 }
    87 }
    87 
    88 
    88 #endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */
    89 #endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */
    89 
    90 
    90 /* vi: set ts=4 sw=4 expandtab: */
    91 /* vi: set ts=4 sw=4 expandtab: */