WinRT: got the SDL-official OpenGL ES 2 changes working, in an experimental state
authorDavid Ludwig <dludwig@pobox.com>
Thu, 28 Nov 2013 22:59:21 -0500
changeset 85457cf4f8916997
parent 8544 356878e614e2
child 8546 b09dc0606036
WinRT: got the SDL-official OpenGL ES 2 changes working, in an experimental state
VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj
VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters
include/SDL_egl.h
src/video/SDL_egl.c
src/video/winrt/SDL_winrtegl.h
src/video/winrt/SDL_winrtopengles.h
src/video/winrt/SDL_winrtvideo_cpp.h
     1.1 --- a/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj	Thu Nov 28 22:24:13 2013 -0500
     1.2 +++ b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj	Thu Nov 28 22:59:21 2013 -0500
     1.3 @@ -217,6 +217,7 @@
     1.4      <ClInclude Include="..\..\include\SDL_config_winrt.h" />
     1.5      <ClInclude Include="..\..\include\SDL_copying.h" />
     1.6      <ClInclude Include="..\..\include\SDL_cpuinfo.h" />
     1.7 +    <ClInclude Include="..\..\include\SDL_egl.h" />
     1.8      <ClInclude Include="..\..\include\SDL_endian.h" />
     1.9      <ClInclude Include="..\..\include\SDL_error.h" />
    1.10      <ClInclude Include="..\..\include\SDL_events.h" />
    1.11 @@ -315,7 +316,6 @@
    1.12      <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
    1.13      <ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
    1.14      <ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
    1.15 -    <ClInclude Include="..\..\src\video\winrt\SDL_winrtegl.h" />
    1.16      <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
    1.17      <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
    1.18      <ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
     2.1 --- a/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters	Thu Nov 28 22:24:13 2013 -0500
     2.2 +++ b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters	Thu Nov 28 22:59:21 2013 -0500
     2.3 @@ -629,10 +629,10 @@
     2.4      <ClInclude Include="..\..\src\video\SDL_egl.h">
     2.5        <Filter>Source Files</Filter>
     2.6      </ClInclude>
     2.7 -    <ClInclude Include="..\..\src\video\winrt\SDL_winrtegl.h">
     2.8 -      <Filter>Source Files</Filter>
     2.9 +    <ClInclude Include="..\..\include\SDL_opengles2.h">
    2.10 +      <Filter>Header Files</Filter>
    2.11      </ClInclude>
    2.12 -    <ClInclude Include="..\..\include\SDL_opengles2.h">
    2.13 +    <ClInclude Include="..\..\include\SDL_egl.h">
    2.14        <Filter>Header Files</Filter>
    2.15      </ClInclude>
    2.16    </ItemGroup>
     3.1 --- a/include/SDL_egl.h	Thu Nov 28 22:24:13 2013 -0500
     3.2 +++ b/include/SDL_egl.h	Thu Nov 28 22:59:21 2013 -0500
     3.3 @@ -391,9 +391,16 @@
     3.4  #endif
     3.5  #include <windows.h>
     3.6  
     3.7 +#if __WINRT__
     3.8 +#include <Unknwn.h>
     3.9 +typedef IUnknown * EGLNativeWindowType;
    3.10 +typedef int EGLNativeDisplayType;
    3.11 +typedef HBITMAP EGLNativePixmapType;
    3.12 +#else
    3.13  typedef HDC     EGLNativeDisplayType;
    3.14  typedef HBITMAP EGLNativePixmapType;
    3.15  typedef HWND    EGLNativeWindowType;
    3.16 +#endif
    3.17  
    3.18  #elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
    3.19  
     4.1 --- a/src/video/SDL_egl.c	Thu Nov 28 22:24:13 2013 -0500
     4.2 +++ b/src/video/SDL_egl.c	Thu Nov 28 22:59:21 2013 -0500
     4.3 @@ -41,7 +41,7 @@
     4.4  #define DEFAULT_OGL_ES_PVR "libGLES_CM.so"
     4.5  #define DEFAULT_OGL_ES "libGLESv1_CM.so"
     4.6  
     4.7 -#elif SDL_VIDEO_DRIVER_WINDOWS
     4.8 +#elif SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT
     4.9  /* EGL AND OpenGL ES support via ANGLE */
    4.10  #define DEFAULT_EGL "libEGL.dll"
    4.11  #define DEFAULT_OGL_ES2 "libGLESv2.dll"
    4.12 @@ -118,7 +118,7 @@
    4.13  {
    4.14      void *dll_handle = NULL, *egl_dll_handle = NULL; /* The naming is counter intuitive, but hey, I just work here -- Gabriel */
    4.15      char *path = NULL;
    4.16 -#if SDL_VIDEO_DRIVER_WINDOWS
    4.17 +#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT
    4.18      const char *d3dcompiler;
    4.19  #endif
    4.20  
    4.21 @@ -131,7 +131,7 @@
    4.22          return SDL_OutOfMemory();
    4.23      }
    4.24  
    4.25 -#if SDL_VIDEO_DRIVER_WINDOWS
    4.26 +#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT
    4.27      d3dcompiler = SDL_GetHint(SDL_HINT_VIDEO_WIN_D3DCOMPILER);
    4.28      if (!d3dcompiler) {
    4.29          /* By default we load the Vista+ compatible compiler */
     5.1 --- a/src/video/winrt/SDL_winrtegl.h	Thu Nov 28 22:24:13 2013 -0500
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,166 +0,0 @@
     5.4 -/*
     5.5 -  Simple DirectMedia Layer
     5.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
     5.7 -
     5.8 -  This software is provided 'as-is', without any express or implied
     5.9 -  warranty.  In no event will the authors be held liable for any damages
    5.10 -  arising from the use of this software.
    5.11 -
    5.12 -  Permission is granted to anyone to use this software for any purpose,
    5.13 -  including commercial applications, and to alter it and redistribute it
    5.14 -  freely, subject to the following restrictions:
    5.15 -
    5.16 -  1. The origin of this software must not be misrepresented; you must not
    5.17 -     claim that you wrote the original software. If you use this software
    5.18 -     in a product, an acknowledgment in the product documentation would be
    5.19 -     appreciated but is not required.
    5.20 -  2. Altered source versions must be plainly marked as such, and must not be
    5.21 -     misrepresented as being the original software.
    5.22 -  3. This notice may not be removed or altered from any source distribution.
    5.23 -*/
    5.24 -
    5.25 -#include "SDL_config.h"
    5.26 -
    5.27 -#ifndef _SDL_winrtegl_h
    5.28 -#define _SDL_winrtegl_h
    5.29 -
    5.30 -#include "SDL_hints.h"
    5.31 -#include "SDL_loadso.h"
    5.32 -
    5.33 -#if SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL
    5.34 -
    5.35 -/* Emulate various *nix functions that SDL_egl.c will call.
    5.36 - */
    5.37 -#define dlsym SDL_LoadFunction
    5.38 -#define dlclose SDL_UnloadObject
    5.39 -#define dlopen(path, mode) ((path == NULL) ? NULL : SDL_LoadObject(path))  /* TODO, WinRT: create a separate function here, that sets dlerror on empty params */
    5.40 -#define dlerror SDL_GetError
    5.41 -#define getenv SDL_GetHint
    5.42 -#define RTLD_LAZY 0
    5.43 -
    5.44 -
    5.45 -/*
    5.46 -** Copyright (c) 2007-2009 The Khronos Group Inc.
    5.47 -**
    5.48 -** Permission is hereby granted, free of charge, to any person obtaining a
    5.49 -** copy of this software and/or associated documentation files (the
    5.50 -** "Materials"), to deal in the Materials without restriction, including
    5.51 -** without limitation the rights to use, copy, modify, merge, publish,
    5.52 -** distribute, sublicense, and/or sell copies of the Materials, and to
    5.53 -** permit persons to whom the Materials are furnished to do so, subject to
    5.54 -** the following conditions:
    5.55 -**
    5.56 -** The above copyright notice and this permission notice shall be included
    5.57 -** in all copies or substantial portions of the Materials.
    5.58 -**
    5.59 -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    5.60 -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    5.61 -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    5.62 -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    5.63 -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    5.64 -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    5.65 -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
    5.66 -*/
    5.67 -
    5.68 -/* EGL Types */
    5.69 -/* EGLint is defined in eglplatform.h */
    5.70 -typedef unsigned int EGLBoolean;
    5.71 -typedef unsigned int EGLenum;
    5.72 -typedef void *EGLConfig;
    5.73 -typedef void *EGLContext;
    5.74 -typedef void *EGLDisplay;
    5.75 -typedef void *EGLSurface;
    5.76 -typedef void *EGLClientBuffer;
    5.77 -
    5.78 -/* Platform-specific types */
    5.79 -//typedef int EGLNativeDisplayType;
    5.80 -typedef int NativeDisplayType;
    5.81 -typedef void * NativeWindowType;
    5.82 -
    5.83 -#ifndef EGLAPIENTRY
    5.84 -#define EGLAPIENTRY  __stdcall
    5.85 -#endif
    5.86 -
    5.87 -
    5.88 -/* Define EGLint. This must be a signed integral type large enough to contain
    5.89 - * all legal attribute names and values passed into and out of EGL, whether
    5.90 - * their type is boolean, bitmask, enumerant (symbolic constant), integer,
    5.91 - * handle, or other.  While in general a 32-bit integer will suffice, if
    5.92 - * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
    5.93 - * integer type.
    5.94 - */
    5.95 -typedef int EGLint;
    5.96 -
    5.97 -/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
    5.98 - * enums are assigned unique values starting at 0x3000.
    5.99 - */
   5.100 -
   5.101 -/* EGL aliases */
   5.102 -#define EGL_FALSE			0
   5.103 -#define EGL_TRUE			1
   5.104 -
   5.105 -/* Out-of-band handle values */
   5.106 -#define EGL_DEFAULT_DISPLAY		((EGLNativeDisplayType)0)
   5.107 -#define EGL_NO_CONTEXT			((EGLContext)0)
   5.108 -#define EGL_NO_DISPLAY			((EGLDisplay)0)
   5.109 -#define EGL_NO_SURFACE			((EGLSurface)0)
   5.110 -
   5.111 -/* Config attributes */
   5.112 -#define EGL_BUFFER_SIZE			0x3020
   5.113 -#define EGL_ALPHA_SIZE			0x3021
   5.114 -#define EGL_BLUE_SIZE			0x3022
   5.115 -#define EGL_GREEN_SIZE			0x3023
   5.116 -#define EGL_RED_SIZE			0x3024
   5.117 -#define EGL_DEPTH_SIZE			0x3025
   5.118 -#define EGL_STENCIL_SIZE		0x3026
   5.119 -#define EGL_CONFIG_CAVEAT		0x3027
   5.120 -#define EGL_CONFIG_ID			0x3028
   5.121 -#define EGL_LEVEL			0x3029
   5.122 -#define EGL_MAX_PBUFFER_HEIGHT		0x302A
   5.123 -#define EGL_MAX_PBUFFER_PIXELS		0x302B
   5.124 -#define EGL_MAX_PBUFFER_WIDTH		0x302C
   5.125 -#define EGL_NATIVE_RENDERABLE		0x302D
   5.126 -#define EGL_NATIVE_VISUAL_ID		0x302E
   5.127 -#define EGL_NATIVE_VISUAL_TYPE		0x302F
   5.128 -#define EGL_SAMPLES			0x3031
   5.129 -#define EGL_SAMPLE_BUFFERS		0x3032
   5.130 -#define EGL_SURFACE_TYPE		0x3033
   5.131 -#define EGL_TRANSPARENT_TYPE		0x3034
   5.132 -#define EGL_TRANSPARENT_BLUE_VALUE	0x3035
   5.133 -#define EGL_TRANSPARENT_GREEN_VALUE	0x3036
   5.134 -#define EGL_TRANSPARENT_RED_VALUE	0x3037
   5.135 -#define EGL_NONE			0x3038	/* Attrib list terminator */
   5.136 -#define EGL_BIND_TO_TEXTURE_RGB		0x3039
   5.137 -#define EGL_BIND_TO_TEXTURE_RGBA	0x303A
   5.138 -#define EGL_MIN_SWAP_INTERVAL		0x303B
   5.139 -#define EGL_MAX_SWAP_INTERVAL		0x303C
   5.140 -#define EGL_LUMINANCE_SIZE		0x303D
   5.141 -#define EGL_ALPHA_MASK_SIZE		0x303E
   5.142 -#define EGL_COLOR_BUFFER_TYPE		0x303F
   5.143 -#define EGL_RENDERABLE_TYPE		0x3040
   5.144 -#define EGL_MATCH_NATIVE_PIXMAP		0x3041	/* Pseudo-attribute (not queryable) */
   5.145 -#define EGL_CONFORMANT			0x3042
   5.146 -
   5.147 -/* Config attribute mask bits */
   5.148 -#define EGL_PBUFFER_BIT			0x0001	/* EGL_SURFACE_TYPE mask bits */
   5.149 -#define EGL_PIXMAP_BIT			0x0002	/* EGL_SURFACE_TYPE mask bits */
   5.150 -#define EGL_WINDOW_BIT			0x0004	/* EGL_SURFACE_TYPE mask bits */
   5.151 -#define EGL_VG_COLORSPACE_LINEAR_BIT	0x0020	/* EGL_SURFACE_TYPE mask bits */
   5.152 -#define EGL_VG_ALPHA_FORMAT_PRE_BIT	0x0040	/* EGL_SURFACE_TYPE mask bits */
   5.153 -#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200	/* EGL_SURFACE_TYPE mask bits */
   5.154 -#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400	/* EGL_SURFACE_TYPE mask bits */
   5.155 -
   5.156 -#define EGL_OPENGL_ES_BIT		0x0001	/* EGL_RENDERABLE_TYPE mask bits */
   5.157 -#define EGL_OPENVG_BIT			0x0002	/* EGL_RENDERABLE_TYPE mask bits */
   5.158 -#define EGL_OPENGL_ES2_BIT		0x0004	/* EGL_RENDERABLE_TYPE mask bits */
   5.159 -#define EGL_OPENGL_BIT			0x0008	/* EGL_RENDERABLE_TYPE mask bits */
   5.160 -
   5.161 -/* CreateContext attributes */
   5.162 -#define EGL_CONTEXT_CLIENT_VERSION	0x3098
   5.163 -
   5.164 -
   5.165 -#endif /* SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL */
   5.166 -
   5.167 -#endif /* _SDL_winrtegl_h */
   5.168 -
   5.169 -/* vi: set ts=4 sw=4 expandtab: */
     6.1 --- a/src/video/winrt/SDL_winrtopengles.h	Thu Nov 28 22:24:13 2013 -0500
     6.2 +++ b/src/video/winrt/SDL_winrtopengles.h	Thu Nov 28 22:59:21 2013 -0500
     6.3 @@ -26,7 +26,7 @@
     6.4  #if SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL
     6.5  
     6.6  #include "../SDL_sysvideo.h"
     6.7 -#include "../SDL_egl.h"
     6.8 +#include "../SDL_egl_c.h"
     6.9  
    6.10  /* OpenGLES functions */
    6.11  #define WINRT_GLES_GetAttribute SDL_EGL_GetAttribute
     7.1 --- a/src/video/winrt/SDL_winrtvideo_cpp.h	Thu Nov 28 22:24:13 2013 -0500
     7.2 +++ b/src/video/winrt/SDL_winrtvideo_cpp.h	Thu Nov 28 22:59:21 2013 -0500
     7.3 @@ -31,7 +31,7 @@
     7.4  
     7.5  extern "C" {
     7.6  #include "../SDL_sysvideo.h"
     7.7 -#include "SDL_winrtegl.h"
     7.8 +#include "../SDL_egl_c.h"
     7.9  }
    7.10  
    7.11