src/video/winrt/SDL_winrtopengles.h
author David Ludwig <dludwig@pobox.com>
Sat, 22 Mar 2014 20:48:18 -0400
changeset 8663 308e74493106
parent 8615 097646deaef2
child 9211 04c7e1220a65
permissions -rw-r--r--
WinRT: Got OpenGL ES 2 working with the latest version of ANGLE/WinRT.

SDL/WinRT did have support for OpenGL ES 2 via an older version of ANGLE/WinRT,
however its API changed a few months ago, and SDL/WinRT would crash when trying
to use it. It would also occasionally crash when using the older version.

This changeset should make SDL/WinRT work with the latest version, as
available via MS Open Tech's git repository of it at
https://github.com/msopentech/angle

Older versions of ANGLE/WinRT (from either https://github.com/stammen/angleproject
or https://bitbucket.org/DavidLudwig/angleproject) will need to be updated to
MS Open Tech's latest version.
slouken@8582
     1
/*
slouken@8582
     2
  Simple DirectMedia Layer
slouken@8615
     3
  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
slouken@8582
     4
slouken@8582
     5
  This software is provided 'as-is', without any express or implied
slouken@8582
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@8582
     7
  arising from the use of this software.
slouken@8582
     8
slouken@8582
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@8582
    10
  including commercial applications, and to alter it and redistribute it
slouken@8582
    11
  freely, subject to the following restrictions:
slouken@8582
    12
slouken@8582
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@8582
    14
     claim that you wrote the original software. If you use this software
slouken@8582
    15
     in a product, an acknowledgment in the product documentation would be
slouken@8582
    16
     appreciated but is not required.
slouken@8582
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@8582
    18
     misrepresented as being the original software.
slouken@8582
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@8582
    20
*/
slouken@8582
    21
#include "SDL_config.h"
slouken@8582
    22
slouken@8582
    23
#ifndef _SDL_winrtopengles_h
slouken@8582
    24
#define _SDL_winrtopengles_h
slouken@8582
    25
slouken@8582
    26
#if SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL
slouken@8582
    27
slouken@8582
    28
#include "../SDL_sysvideo.h"
slouken@8582
    29
#include "../SDL_egl_c.h"
slouken@8582
    30
slouken@8582
    31
/* OpenGLES functions */
slouken@8582
    32
#define WINRT_GLES_GetAttribute SDL_EGL_GetAttribute
slouken@8582
    33
#define WINRT_GLES_GetProcAddress SDL_EGL_GetProcAddress
slouken@8582
    34
#define WINRT_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
slouken@8582
    35
#define WINRT_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
slouken@8582
    36
#define WINRT_GLES_DeleteContext SDL_EGL_DeleteContext
slouken@8582
    37
slouken@8582
    38
extern int WINRT_GLES_LoadLibrary(_THIS, const char *path);
dludwig@8663
    39
extern void WINRT_GLES_UnloadLibrary(_THIS);
slouken@8582
    40
extern SDL_GLContext WINRT_GLES_CreateContext(_THIS, SDL_Window * window);
slouken@8582
    41
extern void WINRT_GLES_SwapWindow(_THIS, SDL_Window * window);
slouken@8582
    42
extern int WINRT_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
slouken@8582
    43
dludwig@8663
    44
dludwig@8663
    45
#ifdef __cplusplus
dludwig@8663
    46
dludwig@8663
    47
/* Typedefs for ANGLE/WinRT's C++-based native-display and native-window types,
dludwig@8663
    48
 * which are used when calling eglGetDisplay and eglCreateWindowSurface.
dludwig@8663
    49
 */
dludwig@8663
    50
typedef Microsoft::WRL::ComPtr<IUnknown> WINRT_EGLNativeWindowType;
dludwig@8663
    51
typedef WINRT_EGLNativeWindowType WINRT_EGLNativeDisplayType;
dludwig@8663
    52
dludwig@8663
    53
/* Function pointer typedefs for ANGLE/WinRT's functions that require
dludwig@8663
    54
 * parameter customization [by passing in C++ objects].
dludwig@8663
    55
 */
dludwig@8663
    56
typedef EGLDisplay (EGLAPIENTRY *eglGetDisplay_Function)(WINRT_EGLNativeWindowType);
dludwig@8663
    57
typedef EGLSurface (EGLAPIENTRY *eglCreateWindowSurface_Function)(EGLDisplay, EGLConfig, WINRT_EGLNativeWindowType, const EGLint *);
dludwig@8663
    58
typedef HRESULT (EGLAPIENTRY *CreateWinrtEglWindow_Function)(Microsoft::WRL::ComPtr<IUnknown>, int, IUnknown ** result);
dludwig@8663
    59
dludwig@8663
    60
#endif /* __cplusplus */
dludwig@8663
    61
slouken@8582
    62
#endif /* SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL */
slouken@8582
    63
slouken@8582
    64
#endif /* _SDL_winrtopengles_h */
slouken@8582
    65
slouken@8582
    66
/* vi: set ts=4 sw=4 expandtab: */