Fixed bug 3975 - Add GLES2 support for macOS via ANGLE library
authorSam Lantinga <slouken@libsdl.org>
Mon, 04 Dec 2017 20:35:01 -0800
changeset 11723bc7ca7cfa6ca
parent 11722 27dd67e1c5eb
child 11724 73826bd39748
Fixed bug 3975 - Add GLES2 support for macOS via ANGLE library

Andrey

Seems latest google angle library successfully built & tested under macOS'es.

https://github.com/google/angle

We need to use GLES2 to implement true cross-platform code.
CMakeLists.txt
Xcode/SDL/SDL.xcodeproj/project.pbxproj
include/SDL_config_macosx.h
src/video/SDL_egl.c
src/video/cocoa/SDL_cocoaopengl.m
src/video/cocoa/SDL_cocoavideo.m
src/video/cocoa/SDL_cocoawindow.h
src/video/cocoa/SDL_cocoawindow.m
     1.1 --- a/CMakeLists.txt	Mon Dec 04 20:26:09 2017 -0800
     1.2 +++ b/CMakeLists.txt	Mon Dec 04 20:35:01 2017 -0800
     1.3 @@ -1486,6 +1486,13 @@
     1.4          set(SDL_VIDEO_RENDER_OGL 1)
     1.5          set(HAVE_VIDEO_OPENGL TRUE)
     1.6        endif()
     1.7 +
     1.8 +      if(VIDEO_OPENGLES)
     1.9 +        set(SDL_VIDEO_OPENGL_EGL 1)
    1.10 +        set(SDL_VIDEO_OPENGL_ES2 1)
    1.11 +        set(SDL_VIDEO_RENDER_OGL_ES2 1)
    1.12 +        set(HAVE_VIDEO_OPENGLES TRUE)
    1.13 +      endif()
    1.14      endif()
    1.15    endif()
    1.16  
     2.1 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Mon Dec 04 20:26:09 2017 -0800
     2.2 +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Mon Dec 04 20:35:01 2017 -0800
     2.3 @@ -418,6 +418,38 @@
     2.4  		56F9D55D1DF73B6C00C15B5D /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = 56115BB91DF72C6D00F47E1E /* SDL_dataqueue.c */; };
     2.5  		56F9D55E1DF73B7C00C15B5D /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 56115BBA1DF72C6D00F47E1E /* SDL_dataqueue.h */; };
     2.6  		56F9D55F1DF73B7D00C15B5D /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 56115BBA1DF72C6D00F47E1E /* SDL_dataqueue.h */; };
     2.7 +		5C2EF69F1FC987C6003F5197 /* SDL_gles2funcs.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF69B1FC987C6003F5197 /* SDL_gles2funcs.h */; };
     2.8 +		5C2EF6A01FC987C6003F5197 /* SDL_render_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF69C1FC987C6003F5197 /* SDL_render_gles2.c */; };
     2.9 +		5C2EF6A11FC987C6003F5197 /* SDL_shaders_gles2.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF69D1FC987C6003F5197 /* SDL_shaders_gles2.h */; };
    2.10 +		5C2EF6A21FC987C6003F5197 /* SDL_shaders_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF69E1FC987C6003F5197 /* SDL_shaders_gles2.c */; };
    2.11 +		5C2EF6A31FC98B38003F5197 /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F131FB0209C00FED37F /* SDL_yuv.c */; };
    2.12 +		5C2EF6A41FC98B39003F5197 /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F131FB0209C00FED37F /* SDL_yuv.c */; };
    2.13 +		5C2EF6A51FC98B6B003F5197 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F101FB0206300FED37F /* yuv_rgb.c */; };
    2.14 +		5C2EF6A61FC98B6C003F5197 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F101FB0206300FED37F /* yuv_rgb.c */; };
    2.15 +		5C2EF6A71FC98D2D003F5197 /* SDL_gles2funcs.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF69B1FC987C6003F5197 /* SDL_gles2funcs.h */; };
    2.16 +		5C2EF6A81FC98D2D003F5197 /* SDL_render_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF69C1FC987C6003F5197 /* SDL_render_gles2.c */; };
    2.17 +		5C2EF6A91FC98D2D003F5197 /* SDL_shaders_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF69E1FC987C6003F5197 /* SDL_shaders_gles2.c */; };
    2.18 +		5C2EF6AA1FC98D2D003F5197 /* SDL_shaders_gles2.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF69D1FC987C6003F5197 /* SDL_shaders_gles2.h */; };
    2.19 +		5C2EF6AB1FC98D2E003F5197 /* SDL_gles2funcs.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF69B1FC987C6003F5197 /* SDL_gles2funcs.h */; };
    2.20 +		5C2EF6AC1FC98D2E003F5197 /* SDL_render_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF69C1FC987C6003F5197 /* SDL_render_gles2.c */; };
    2.21 +		5C2EF6AD1FC98D2E003F5197 /* SDL_shaders_gles2.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF69E1FC987C6003F5197 /* SDL_shaders_gles2.c */; };
    2.22 +		5C2EF6AE1FC98D2E003F5197 /* SDL_shaders_gles2.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF69D1FC987C6003F5197 /* SDL_shaders_gles2.h */; };
    2.23 +		5C2EF6EE1FC9D0ED003F5197 /* SDL_cocoaopengles.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6EC1FC9D0EC003F5197 /* SDL_cocoaopengles.m */; };
    2.24 +		5C2EF6EF1FC9D0ED003F5197 /* SDL_cocoaopengles.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6ED1FC9D0ED003F5197 /* SDL_cocoaopengles.h */; };
    2.25 +		5C2EF6F01FC9D181003F5197 /* SDL_cocoaopengles.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6ED1FC9D0ED003F5197 /* SDL_cocoaopengles.h */; };
    2.26 +		5C2EF6F11FC9D181003F5197 /* SDL_cocoaopengles.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6EC1FC9D0EC003F5197 /* SDL_cocoaopengles.m */; };
    2.27 +		5C2EF6F21FC9D182003F5197 /* SDL_cocoaopengles.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6ED1FC9D0ED003F5197 /* SDL_cocoaopengles.h */; };
    2.28 +		5C2EF6F31FC9D182003F5197 /* SDL_cocoaopengles.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6EC1FC9D0EC003F5197 /* SDL_cocoaopengles.m */; };
    2.29 +		5C2EF6F71FC9EE35003F5197 /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F41FC9EE34003F5197 /* SDL_rect_c.h */; };
    2.30 +		5C2EF6F81FC9EE35003F5197 /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */; };
    2.31 +		5C2EF6F91FC9EE35003F5197 /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F61FC9EE35003F5197 /* SDL_egl_c.h */; };
    2.32 +		5C2EF6FA1FC9EE64003F5197 /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F61FC9EE35003F5197 /* SDL_egl_c.h */; };
    2.33 +		5C2EF6FB1FC9EE64003F5197 /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */; };
    2.34 +		5C2EF6FC1FC9EE64003F5197 /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F41FC9EE34003F5197 /* SDL_rect_c.h */; };
    2.35 +		5C2EF6FD1FC9EE65003F5197 /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F61FC9EE35003F5197 /* SDL_egl_c.h */; };
    2.36 +		5C2EF6FE1FC9EE65003F5197 /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */; };
    2.37 +		5C2EF6FF1FC9EE65003F5197 /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F41FC9EE34003F5197 /* SDL_rect_c.h */; };
    2.38 +		5C2EF7011FC9EF10003F5197 /* SDL_egl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */; };
    2.39  		A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; };
    2.40  		A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; };
    2.41  		A77E6EB4167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; };
    2.42 @@ -1042,6 +1074,16 @@
    2.43  		56A6701E185654B40007D20F /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dynapi.c; path = ../../src/dynapi/SDL_dynapi.c; sourceTree = "<group>"; };
    2.44  		56A6701F185654B40007D20F /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi.h; path = ../../src/dynapi/SDL_dynapi.h; sourceTree = "<group>"; };
    2.45  		56A67020185654B40007D20F /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_overrides.h; path = ../../src/dynapi/SDL_dynapi_overrides.h; sourceTree = "<group>"; };
    2.46 +		5C2EF69B1FC987C6003F5197 /* SDL_gles2funcs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gles2funcs.h; sourceTree = "<group>"; };
    2.47 +		5C2EF69C1FC987C6003F5197 /* SDL_render_gles2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_gles2.c; sourceTree = "<group>"; };
    2.48 +		5C2EF69D1FC987C6003F5197 /* SDL_shaders_gles2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_gles2.h; sourceTree = "<group>"; };
    2.49 +		5C2EF69E1FC987C6003F5197 /* SDL_shaders_gles2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shaders_gles2.c; sourceTree = "<group>"; };
    2.50 +		5C2EF6EC1FC9D0EC003F5197 /* SDL_cocoaopengles.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoaopengles.m; sourceTree = "<group>"; };
    2.51 +		5C2EF6ED1FC9D0ED003F5197 /* SDL_cocoaopengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoaopengles.h; sourceTree = "<group>"; };
    2.52 +		5C2EF6F41FC9EE34003F5197 /* SDL_rect_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rect_c.h; sourceTree = "<group>"; };
    2.53 +		5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_egl.c; sourceTree = "<group>"; };
    2.54 +		5C2EF6F61FC9EE35003F5197 /* SDL_egl_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_egl_c.h; sourceTree = "<group>"; };
    2.55 +		5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_egl.h; sourceTree = "<group>"; };
    2.56  		A7381E931D8B69C300B177DD /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
    2.57  		A7381E951D8B69D600B177DD /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
    2.58  		A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = "<group>"; };
    2.59 @@ -1194,6 +1236,7 @@
    2.60  				AA7557CF1595D4D800BBD41B /* SDL_config.h */,
    2.61  				AA7557D01595D4D800BBD41B /* SDL_copying.h */,
    2.62  				AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */,
    2.63 +				5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */,
    2.64  				AA7557D21595D4D800BBD41B /* SDL_endian.h */,
    2.65  				AA7557D31595D4D800BBD41B /* SDL_error.h */,
    2.66  				AA7557D41595D4D800BBD41B /* SDL_events.h */,
    2.67 @@ -1262,6 +1305,7 @@
    2.68  		041B2C9712FA0D680087D585 /* render */ = {
    2.69  			isa = PBXGroup;
    2.70  			children = (
    2.71 +				5C2EF6921FC986D8003F5197 /* opengles2 */,
    2.72  				041B2C9A12FA0D680087D585 /* opengl */,
    2.73  				041B2CA012FA0D680087D585 /* software */,
    2.74  				041B2C9E12FA0D680087D585 /* SDL_render.c */,
    2.75 @@ -1581,9 +1625,12 @@
    2.76  				04BDFF4F12E6671800899322 /* SDL_blit.h */,
    2.77  				04BDFF5A12E6671800899322 /* SDL_bmp.c */,
    2.78  				04BDFF5B12E6671800899322 /* SDL_clipboard.c */,
    2.79 +				5C2EF6F61FC9EE35003F5197 /* SDL_egl_c.h */,
    2.80 +				5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */,
    2.81  				04BDFF6012E6671800899322 /* SDL_fillrect.c */,
    2.82  				04BDFF6612E6671800899322 /* SDL_pixels_c.h */,
    2.83  				04BDFF6512E6671800899322 /* SDL_pixels.c */,
    2.84 +				5C2EF6F41FC9EE34003F5197 /* SDL_rect_c.h */,
    2.85  				04BDFF6712E6671800899322 /* SDL_rect.c */,
    2.86  				04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */,
    2.87  				04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */,
    2.88 @@ -1623,6 +1670,8 @@
    2.89  				D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */,
    2.90  				04BDFECC12E6671800899322 /* SDL_cocoaopengl.h */,
    2.91  				04BDFECD12E6671800899322 /* SDL_cocoaopengl.m */,
    2.92 +				5C2EF6ED1FC9D0ED003F5197 /* SDL_cocoaopengles.h */,
    2.93 +				5C2EF6EC1FC9D0EC003F5197 /* SDL_cocoaopengles.m */,
    2.94  				04BDFECE12E6671800899322 /* SDL_cocoashape.h */,
    2.95  				04BDFECF12E6671800899322 /* SDL_cocoashape.m */,
    2.96  				04BDFED012E6671800899322 /* SDL_cocoavideo.h */,
    2.97 @@ -1764,6 +1813,17 @@
    2.98  			name = dynapi;
    2.99  			sourceTree = "<group>";
   2.100  		};
   2.101 +		5C2EF6921FC986D8003F5197 /* opengles2 */ = {
   2.102 +			isa = PBXGroup;
   2.103 +			children = (
   2.104 +				5C2EF69B1FC987C6003F5197 /* SDL_gles2funcs.h */,
   2.105 +				5C2EF69C1FC987C6003F5197 /* SDL_render_gles2.c */,
   2.106 +				5C2EF69E1FC987C6003F5197 /* SDL_shaders_gles2.c */,
   2.107 +				5C2EF69D1FC987C6003F5197 /* SDL_shaders_gles2.h */,
   2.108 +			);
   2.109 +			path = opengles2;
   2.110 +			sourceTree = "<group>";
   2.111 +		};
   2.112  		AA9A7F0E1FB0200B00FED37F /* yuv2rgb */ = {
   2.113  			isa = PBXGroup;
   2.114  			children = (
   2.115 @@ -1822,6 +1882,7 @@
   2.116  				AA7558021595D4D800BBD41B /* SDL_audio.h in Headers */,
   2.117  				AADA5B8716CCAB3000107CF7 /* SDL_bits.h in Headers */,
   2.118  				AA7558041595D4D800BBD41B /* SDL_blendmode.h in Headers */,
   2.119 +				5C2EF7011FC9EF10003F5197 /* SDL_egl.h in Headers */,
   2.120  				AA7558061595D4D800BBD41B /* SDL_clipboard.h in Headers */,
   2.121  				AA7558081595D4D800BBD41B /* SDL_config_macosx.h in Headers */,
   2.122  				AA75580A1595D4D800BBD41B /* SDL_config.h in Headers */,
   2.123 @@ -1841,6 +1902,7 @@
   2.124  				AA7558221595D4D800BBD41B /* SDL_keycode.h in Headers */,
   2.125  				AA7558241595D4D800BBD41B /* SDL_loadso.h in Headers */,
   2.126  				AA7558261595D4D800BBD41B /* SDL_log.h in Headers */,
   2.127 +				5C2EF6F91FC9EE35003F5197 /* SDL_egl_c.h in Headers */,
   2.128  				AA7558281595D4D800BBD41B /* SDL_main.h in Headers */,
   2.129  				AA9FF95A1637CBF9000DF050 /* SDL_messagebox.h in Headers */,
   2.130  				AA75582A1595D4D800BBD41B /* SDL_mouse.h in Headers */,
   2.131 @@ -1859,6 +1921,7 @@
   2.132  				AA75583A1595D4D800BBD41B /* SDL_power.h in Headers */,
   2.133  				AA75583C1595D4D800BBD41B /* SDL_quit.h in Headers */,
   2.134  				AA75583E1595D4D800BBD41B /* SDL_rect.h in Headers */,
   2.135 +				5C2EF69F1FC987C6003F5197 /* SDL_gles2funcs.h in Headers */,
   2.136  				AA7558401595D4D800BBD41B /* SDL_render.h in Headers */,
   2.137  				AA7558421595D4D800BBD41B /* SDL_revision.h in Headers */,
   2.138  				AA7558441595D4D800BBD41B /* SDL_rwops.h in Headers */,
   2.139 @@ -1874,6 +1937,7 @@
   2.140  				AA7558581595D4D800BBD41B /* SDL_types.h in Headers */,
   2.141  				AA75585A1595D4D800BBD41B /* SDL_version.h in Headers */,
   2.142  				AA75585C1595D4D800BBD41B /* SDL_video.h in Headers */,
   2.143 +				5C2EF6A11FC987C6003F5197 /* SDL_shaders_gles2.h in Headers */,
   2.144  				AA8167541F5E727800518735 /* SDL_vulkan.h in Headers */,
   2.145  				4D7517291EE2562B00820EEA /* SDL_cocoametalview.h in Headers */,
   2.146  				04BD000912E6671800899322 /* SDL_diskaudio.h in Headers */,
   2.147 @@ -1915,6 +1979,7 @@
   2.148  				4D1664541EDD60AD003DE88E /* SDL_cocoavulkan.h in Headers */,
   2.149  				04BD00F512E6671800899322 /* SDL_cocoaevents.h in Headers */,
   2.150  				04BD00F712E6671800899322 /* SDL_cocoakeyboard.h in Headers */,
   2.151 +				5C2EF6EF1FC9D0ED003F5197 /* SDL_cocoaopengles.h in Headers */,
   2.152  				04BD00F912E6671800899322 /* SDL_cocoamodes.h in Headers */,
   2.153  				04BD00FB12E6671800899322 /* SDL_cocoamouse.h in Headers */,
   2.154  				04BD00FD12E6671800899322 /* SDL_cocoaopengl.h in Headers */,
   2.155 @@ -1922,6 +1987,7 @@
   2.156  				56115BBC1DF72C6D00F47E1E /* SDL_dataqueue.h in Headers */,
   2.157  				04BD010112E6671800899322 /* SDL_cocoavideo.h in Headers */,
   2.158  				04BD010312E6671800899322 /* SDL_cocoawindow.h in Headers */,
   2.159 +				5C2EF6F71FC9EE35003F5197 /* SDL_rect_c.h in Headers */,
   2.160  				04BD011812E6671800899322 /* SDL_nullevents_c.h in Headers */,
   2.161  				04BD011C12E6671800899322 /* SDL_nullvideo.h in Headers */,
   2.162  				04BD017612E6671800899322 /* SDL_blit.h in Headers */,
   2.163 @@ -2046,6 +2112,7 @@
   2.164  				04BD025D12E6671800899322 /* blank_cursor.h in Headers */,
   2.165  				04BD025E12E6671800899322 /* default_cursor.h in Headers */,
   2.166  				04BD025F12E6671800899322 /* scancodes_darwin.h in Headers */,
   2.167 +				5C2EF6FA1FC9EE64003F5197 /* SDL_egl_c.h in Headers */,
   2.168  				04BD026012E6671800899322 /* scancodes_linux.h in Headers */,
   2.169  				04BD026212E6671800899322 /* scancodes_xfree86.h in Headers */,
   2.170  				04BD026412E6671800899322 /* SDL_clipboardevents_c.h in Headers */,
   2.171 @@ -2058,6 +2125,7 @@
   2.172  				04BD027012E6671800899322 /* SDL_touch_c.h in Headers */,
   2.173  				04BD027212E6671800899322 /* SDL_windowevents_c.h in Headers */,
   2.174  				04BD027312E6671800899322 /* SDL_rwopsbundlesupport.h in Headers */,
   2.175 +				5C2EF6FC1FC9EE64003F5197 /* SDL_rect_c.h in Headers */,
   2.176  				04BD027B12E6671800899322 /* SDL_haptic_c.h in Headers */,
   2.177  				04BD027C12E6671800899322 /* SDL_syshaptic.h in Headers */,
   2.178  				04BD028212E6671800899322 /* SDL_sysjoystick_c.h in Headers */,
   2.179 @@ -2078,6 +2146,7 @@
   2.180  				04BD031712E6671800899322 /* SDL_cocoaopengl.h in Headers */,
   2.181  				04BD031912E6671800899322 /* SDL_cocoashape.h in Headers */,
   2.182  				AAC07103195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */,
   2.183 +				5C2EF6F01FC9D181003F5197 /* SDL_cocoaopengles.h in Headers */,
   2.184  				04BD031B12E6671800899322 /* SDL_cocoavideo.h in Headers */,
   2.185  				04BD031D12E6671800899322 /* SDL_cocoawindow.h in Headers */,
   2.186  				04BD033212E6671800899322 /* SDL_nullevents_c.h in Headers */,
   2.187 @@ -2087,6 +2156,7 @@
   2.188  				04BD039712E6671800899322 /* SDL_blit_copy.h in Headers */,
   2.189  				04BD039A12E6671800899322 /* SDL_blit_slow.h in Headers */,
   2.190  				04BD03A712E6671800899322 /* SDL_pixels_c.h in Headers */,
   2.191 +				5C2EF6A71FC98D2D003F5197 /* SDL_gles2funcs.h in Headers */,
   2.192  				04BD03B112E6671800899322 /* SDL_RLEaccel_c.h in Headers */,
   2.193  				04BD03B312E6671800899322 /* SDL_shape_internals.h in Headers */,
   2.194  				04BD03B612E6671800899322 /* SDL_sysvideo.h in Headers */,
   2.195 @@ -2108,6 +2178,7 @@
   2.196  				041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */,
   2.197  				04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */,
   2.198  				04F7803B12FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */,
   2.199 +				5C2EF6AA1FC98D2D003F5197 /* SDL_shaders_gles2.h in Headers */,
   2.200  				04F7805612FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */,
   2.201  				04F7805812FB74A200FC43C0 /* SDL_blendline.h in Headers */,
   2.202  				04F7805A12FB74A200FC43C0 /* SDL_blendpoint.h in Headers */,
   2.203 @@ -2200,6 +2271,7 @@
   2.204  				DB313F7C17554B71006C0E22 /* blank_cursor.h in Headers */,
   2.205  				DB313F7D17554B71006C0E22 /* default_cursor.h in Headers */,
   2.206  				DB313F7E17554B71006C0E22 /* scancodes_darwin.h in Headers */,
   2.207 +				5C2EF6FD1FC9EE65003F5197 /* SDL_egl_c.h in Headers */,
   2.208  				DB313F7F17554B71006C0E22 /* scancodes_linux.h in Headers */,
   2.209  				DB313F8017554B71006C0E22 /* scancodes_xfree86.h in Headers */,
   2.210  				DB313F8117554B71006C0E22 /* SDL_clipboardevents_c.h in Headers */,
   2.211 @@ -2212,6 +2284,7 @@
   2.212  				DB313F8717554B71006C0E22 /* SDL_touch_c.h in Headers */,
   2.213  				DB313F8817554B71006C0E22 /* SDL_windowevents_c.h in Headers */,
   2.214  				DB313F8917554B71006C0E22 /* SDL_rwopsbundlesupport.h in Headers */,
   2.215 +				5C2EF6FF1FC9EE65003F5197 /* SDL_rect_c.h in Headers */,
   2.216  				DB313F8A17554B71006C0E22 /* SDL_haptic_c.h in Headers */,
   2.217  				DB313F8B17554B71006C0E22 /* SDL_syshaptic.h in Headers */,
   2.218  				DB313F8C17554B71006C0E22 /* SDL_sysjoystick_c.h in Headers */,
   2.219 @@ -2232,6 +2305,7 @@
   2.220  				DB313F9C17554B71006C0E22 /* SDL_cocoaopengl.h in Headers */,
   2.221  				DB313F9D17554B71006C0E22 /* SDL_cocoashape.h in Headers */,
   2.222  				AAC07104195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */,
   2.223 +				5C2EF6F21FC9D182003F5197 /* SDL_cocoaopengles.h in Headers */,
   2.224  				DB313F9E17554B71006C0E22 /* SDL_cocoavideo.h in Headers */,
   2.225  				DB313F9F17554B71006C0E22 /* SDL_cocoawindow.h in Headers */,
   2.226  				DB313FA017554B71006C0E22 /* SDL_nullevents_c.h in Headers */,
   2.227 @@ -2241,6 +2315,7 @@
   2.228  				DB313FA417554B71006C0E22 /* SDL_blit_copy.h in Headers */,
   2.229  				DB313FA517554B71006C0E22 /* SDL_blit_slow.h in Headers */,
   2.230  				DB313FA617554B71006C0E22 /* SDL_pixels_c.h in Headers */,
   2.231 +				5C2EF6AB1FC98D2E003F5197 /* SDL_gles2funcs.h in Headers */,
   2.232  				DB313FA717554B71006C0E22 /* SDL_RLEaccel_c.h in Headers */,
   2.233  				DB313FA817554B71006C0E22 /* SDL_shape_internals.h in Headers */,
   2.234  				DB313FA917554B71006C0E22 /* SDL_sysvideo.h in Headers */,
   2.235 @@ -2262,6 +2337,7 @@
   2.236  				DB313FB817554B71006C0E22 /* SDL_sysrender.h in Headers */,
   2.237  				DB313FBA17554B71006C0E22 /* SDL_yuv_sw_c.h in Headers */,
   2.238  				DB313FBB17554B71006C0E22 /* SDL_nullframebuffer_c.h in Headers */,
   2.239 +				5C2EF6AE1FC98D2E003F5197 /* SDL_shaders_gles2.h in Headers */,
   2.240  				DB313FBC17554B71006C0E22 /* SDL_blendfillrect.h in Headers */,
   2.241  				DB313FBD17554B71006C0E22 /* SDL_blendline.h in Headers */,
   2.242  				DB313FBE17554B71006C0E22 /* SDL_blendpoint.h in Headers */,
   2.243 @@ -2436,6 +2512,7 @@
   2.244  			files = (
   2.245  				04BDFFFB12E6671800899322 /* SDL_atomic.c in Sources */,
   2.246  				04BDFFFC12E6671800899322 /* SDL_spinlock.c in Sources */,
   2.247 +				5C2EF6A21FC987C6003F5197 /* SDL_shaders_gles2.c in Sources */,
   2.248  				56115BBB1DF72C6D00F47E1E /* SDL_dataqueue.c in Sources */,
   2.249  				04BD000812E6671800899322 /* SDL_diskaudio.c in Sources */,
   2.250  				04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */,
   2.251 @@ -2517,6 +2594,7 @@
   2.252  				04BD01DB12E6671800899322 /* imKStoUCS.c in Sources */,
   2.253  				04BD01DD12E6671800899322 /* SDL_x11clipboard.c in Sources */,
   2.254  				04BD01DF12E6671800899322 /* SDL_x11dyn.c in Sources */,
   2.255 +				5C2EF6A01FC987C6003F5197 /* SDL_render_gles2.c in Sources */,
   2.256  				04BD01E112E6671800899322 /* SDL_x11events.c in Sources */,
   2.257  				04BD01E512E6671800899322 /* SDL_x11keyboard.c in Sources */,
   2.258  				04BD01E712E6671800899322 /* SDL_x11modes.c in Sources */,
   2.259 @@ -2533,6 +2611,7 @@
   2.260  				04F7804912FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */,
   2.261  				04F7804B12FB74A200FC43C0 /* SDL_blendline.c in Sources */,
   2.262  				04F7804D12FB74A200FC43C0 /* SDL_blendpoint.c in Sources */,
   2.263 +				5C2EF6F81FC9EE35003F5197 /* SDL_egl.c in Sources */,
   2.264  				04F7805012FB74A200FC43C0 /* SDL_drawline.c in Sources */,
   2.265  				04F7805212FB74A200FC43C0 /* SDL_drawpoint.c in Sources */,
   2.266  				0442EC1812FE1BBA004C9285 /* SDL_render_gl.c in Sources */,
   2.267 @@ -2541,6 +2620,7 @@
   2.268  				0442EC5F12FE1C75004C9285 /* SDL_hints.c in Sources */,
   2.269  				56A67024185654B40007D20F /* SDL_dynapi.c in Sources */,
   2.270  				04BAC0C81300C2160055DE28 /* SDL_log.c in Sources */,
   2.271 +				5C2EF6EE1FC9D0ED003F5197 /* SDL_cocoaopengles.m in Sources */,
   2.272  				0435673E1303160F00BA5428 /* SDL_shaders_gl.c in Sources */,
   2.273  				566CDE90148F0AC200C5A9BB /* SDL_dropevents.c in Sources */,
   2.274  				AA628ACA159367B7005138DD /* SDL_rotate.c in Sources */,
   2.275 @@ -2560,6 +2640,7 @@
   2.276  			files = (
   2.277  				4D1664571EDD61F0003DE88E /* SDL_cocoametalview.m in Sources */,
   2.278  				4D1664581EDD61F0003DE88E /* SDL_cocoavulkan.m in Sources */,
   2.279 +				5C2EF6A91FC98D2D003F5197 /* SDL_shaders_gles2.c in Sources */,
   2.280  				4D1664561EDD61DA003DE88E /* SDL_vulkan_utils.c in Sources */,
   2.281  				04BD021712E6671800899322 /* SDL_atomic.c in Sources */,
   2.282  				04BD021812E6671800899322 /* SDL_spinlock.c in Sources */,
   2.283 @@ -2575,6 +2656,7 @@
   2.284  				04BD025C12E6671800899322 /* SDL_cpuinfo.c in Sources */,
   2.285  				04BD026312E6671800899322 /* SDL_clipboardevents.c in Sources */,
   2.286  				04BD026512E6671800899322 /* SDL_events.c in Sources */,
   2.287 +				5C2EF6FB1FC9EE64003F5197 /* SDL_egl.c in Sources */,
   2.288  				AA41F88014B8F1F500993C4F /* SDL_dropevents.c in Sources */,
   2.289  				04BD026712E6671800899322 /* SDL_gesture.c in Sources */,
   2.290  				04BD026912E6671800899322 /* SDL_keyboard.c in Sources */,
   2.291 @@ -2614,12 +2696,15 @@
   2.292  				04BD031212E6671800899322 /* SDL_cocoakeyboard.m in Sources */,
   2.293  				04BD031412E6671800899322 /* SDL_cocoamodes.m in Sources */,
   2.294  				04BD031612E6671800899322 /* SDL_cocoamouse.m in Sources */,
   2.295 +				5C2EF6A31FC98B38003F5197 /* SDL_yuv.c in Sources */,
   2.296 +				5C2EF6F11FC9D181003F5197 /* SDL_cocoaopengles.m in Sources */,
   2.297  				04BD031812E6671800899322 /* SDL_cocoaopengl.m in Sources */,
   2.298  				04BD031A12E6671800899322 /* SDL_cocoashape.m in Sources */,
   2.299  				04BD031C12E6671800899322 /* SDL_cocoavideo.m in Sources */,
   2.300  				04BD031E12E6671800899322 /* SDL_cocoawindow.m in Sources */,
   2.301  				04BD033112E6671800899322 /* SDL_nullevents.c in Sources */,
   2.302  				04BD033512E6671800899322 /* SDL_nullvideo.c in Sources */,
   2.303 +				5C2EF6A51FC98B6B003F5197 /* yuv_rgb.c in Sources */,
   2.304  				04BD038F12E6671800899322 /* SDL_blit.c in Sources */,
   2.305  				04BD039112E6671800899322 /* SDL_blit_0.c in Sources */,
   2.306  				04BD039212E6671800899322 /* SDL_blit_1.c in Sources */,
   2.307 @@ -2639,6 +2724,7 @@
   2.308  				04BD03B512E6671800899322 /* SDL_surface.c in Sources */,
   2.309  				04BD03B712E6671800899322 /* SDL_video.c in Sources */,
   2.310  				04BD03F312E6671800899322 /* imKStoUCS.c in Sources */,
   2.311 +				5C2EF6A81FC98D2D003F5197 /* SDL_render_gles2.c in Sources */,
   2.312  				04BD03F512E6671800899322 /* SDL_x11clipboard.c in Sources */,
   2.313  				04BD03F712E6671800899322 /* SDL_x11dyn.c in Sources */,
   2.314  				04BD03F912E6671800899322 /* SDL_x11events.c in Sources */,
   2.315 @@ -2682,6 +2768,7 @@
   2.316  			files = (
   2.317  				4D16645A1EDD6235003DE88E /* SDL_cocoametalview.m in Sources */,
   2.318  				4D16645B1EDD6235003DE88E /* SDL_cocoavulkan.m in Sources */,
   2.319 +				5C2EF6AD1FC98D2E003F5197 /* SDL_shaders_gles2.c in Sources */,
   2.320  				4D1664591EDD621B003DE88E /* SDL_vulkan_utils.c in Sources */,
   2.321  				DB313FFE17554B71006C0E22 /* SDL_atomic.c in Sources */,
   2.322  				DB313FFF17554B71006C0E22 /* SDL_spinlock.c in Sources */,
   2.323 @@ -2697,6 +2784,7 @@
   2.324  				DB31400917554B71006C0E22 /* SDL_cpuinfo.c in Sources */,
   2.325  				DB31400A17554B71006C0E22 /* SDL_clipboardevents.c in Sources */,
   2.326  				DB31400B17554B71006C0E22 /* SDL_events.c in Sources */,
   2.327 +				5C2EF6FE1FC9EE65003F5197 /* SDL_egl.c in Sources */,
   2.328  				DB31400C17554B71006C0E22 /* SDL_dropevents.c in Sources */,
   2.329  				DB31400D17554B71006C0E22 /* SDL_gesture.c in Sources */,
   2.330  				DB31400E17554B71006C0E22 /* SDL_keyboard.c in Sources */,
   2.331 @@ -2736,12 +2824,15 @@
   2.332  				DB31403017554B71006C0E22 /* SDL_cocoakeyboard.m in Sources */,
   2.333  				DB31403117554B71006C0E22 /* SDL_cocoamodes.m in Sources */,
   2.334  				DB31403217554B71006C0E22 /* SDL_cocoamouse.m in Sources */,
   2.335 +				5C2EF6A41FC98B39003F5197 /* SDL_yuv.c in Sources */,
   2.336 +				5C2EF6F31FC9D182003F5197 /* SDL_cocoaopengles.m in Sources */,
   2.337  				DB31403317554B71006C0E22 /* SDL_cocoaopengl.m in Sources */,
   2.338  				DB31403417554B71006C0E22 /* SDL_cocoashape.m in Sources */,
   2.339  				DB31403517554B71006C0E22 /* SDL_cocoavideo.m in Sources */,
   2.340  				DB31403617554B71006C0E22 /* SDL_cocoawindow.m in Sources */,
   2.341  				DB31403717554B71006C0E22 /* SDL_nullevents.c in Sources */,
   2.342  				DB31403817554B71006C0E22 /* SDL_nullvideo.c in Sources */,
   2.343 +				5C2EF6A61FC98B6C003F5197 /* yuv_rgb.c in Sources */,
   2.344  				DB31403917554B71006C0E22 /* SDL_blit.c in Sources */,
   2.345  				DB31403A17554B71006C0E22 /* SDL_blit_0.c in Sources */,
   2.346  				DB31403B17554B71006C0E22 /* SDL_blit_1.c in Sources */,
   2.347 @@ -2761,6 +2852,7 @@
   2.348  				DB31404917554B71006C0E22 /* SDL_surface.c in Sources */,
   2.349  				DB31404A17554B71006C0E22 /* SDL_video.c in Sources */,
   2.350  				DB31404B17554B71006C0E22 /* imKStoUCS.c in Sources */,
   2.351 +				5C2EF6AC1FC98D2E003F5197 /* SDL_render_gles2.c in Sources */,
   2.352  				DB31404C17554B71006C0E22 /* SDL_x11clipboard.c in Sources */,
   2.353  				DB31404D17554B71006C0E22 /* SDL_x11dyn.c in Sources */,
   2.354  				DB31404E17554B71006C0E22 /* SDL_x11events.c in Sources */,
   2.355 @@ -2843,6 +2935,11 @@
   2.356  				GCC_WARN_UNINITIALIZED_AUTOS = YES;
   2.357  				GCC_WARN_UNUSED_FUNCTION = YES;
   2.358  				GCC_WARN_UNUSED_VARIABLE = YES;
   2.359 +				HEADER_SEARCH_PATHS = (
   2.360 +					/usr/X11R6/include,
   2.361 +					"$(VULKAN_SDK)/include",
   2.362 +					../../src/video/khronos,
   2.363 +				);
   2.364  				MACOSX_DEPLOYMENT_TARGET = 10.6;
   2.365  				SDKROOT = macosx;
   2.366  				STRIP_STYLE = "non-global";
   2.367 @@ -2858,10 +2955,6 @@
   2.368  				DYLIB_COMPATIBILITY_VERSION = 1.0.0;
   2.369  				DYLIB_CURRENT_VERSION = 8.0.0;
   2.370  				FRAMEWORK_VERSION = A;
   2.371 -				HEADER_SEARCH_PATHS = (
   2.372 -					/usr/X11R6/include,
   2.373 -					"$(VULKAN_SDK)/include",
   2.374 -				);
   2.375  				INFOPLIST_FILE = "Info-Framework.plist";
   2.376  				INSTALL_PATH = "@rpath";
   2.377  				OTHER_LDFLAGS = "-liconv";
   2.378 @@ -2884,10 +2977,6 @@
   2.379  					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)",
   2.380  				);
   2.381  				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
   2.382 -				HEADER_SEARCH_PATHS = (
   2.383 -					/usr/X11R6/include,
   2.384 -					"$(VULKAN_SDK)/include",
   2.385 -				);
   2.386  				PRODUCT_NAME = SDL2;
   2.387  				SKIP_INSTALL = YES;
   2.388  			};
   2.389 @@ -2934,6 +3023,11 @@
   2.390  				GCC_WARN_UNINITIALIZED_AUTOS = YES;
   2.391  				GCC_WARN_UNUSED_FUNCTION = YES;
   2.392  				GCC_WARN_UNUSED_VARIABLE = YES;
   2.393 +				HEADER_SEARCH_PATHS = (
   2.394 +					/usr/X11R6/include,
   2.395 +					"$(VULKAN_SDK)/include",
   2.396 +					../../src/video/khronos,
   2.397 +				);
   2.398  				MACOSX_DEPLOYMENT_TARGET = 10.6;
   2.399  				ONLY_ACTIVE_ARCH = YES;
   2.400  				SDKROOT = macosx;
   2.401 @@ -2950,10 +3044,6 @@
   2.402  				DYLIB_COMPATIBILITY_VERSION = 1.0.0;
   2.403  				DYLIB_CURRENT_VERSION = 8.0.0;
   2.404  				FRAMEWORK_VERSION = A;
   2.405 -				HEADER_SEARCH_PATHS = (
   2.406 -					/usr/X11R6/include,
   2.407 -					"$(VULKAN_SDK)/include",
   2.408 -				);
   2.409  				INFOPLIST_FILE = "Info-Framework.plist";
   2.410  				INSTALL_PATH = "@rpath";
   2.411  				OTHER_LDFLAGS = "-liconv";
   2.412 @@ -2976,10 +3066,6 @@
   2.413  					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)",
   2.414  				);
   2.415  				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
   2.416 -				HEADER_SEARCH_PATHS = (
   2.417 -					/usr/X11R6/include,
   2.418 -					"$(VULKAN_SDK)/include",
   2.419 -				);
   2.420  				PRODUCT_NAME = SDL2;
   2.421  				SKIP_INSTALL = YES;
   2.422  			};
   2.423 @@ -3006,10 +3092,6 @@
   2.424  					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)",
   2.425  				);
   2.426  				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
   2.427 -				HEADER_SEARCH_PATHS = (
   2.428 -					/usr/X11R6/include,
   2.429 -					"$(VULKAN_SDK)/include",
   2.430 -				);
   2.431  				INSTALL_PATH = "@rpath";
   2.432  				PRODUCT_NAME = SDL2;
   2.433  				SKIP_INSTALL = YES;
   2.434 @@ -3029,10 +3111,6 @@
   2.435  					"$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)",
   2.436  				);
   2.437  				GCC_SYMBOLS_PRIVATE_EXTERN = YES;
   2.438 -				HEADER_SEARCH_PATHS = (
   2.439 -					/usr/X11R6/include,
   2.440 -					"$(VULKAN_SDK)/include",
   2.441 -				);
   2.442  				INSTALL_PATH = "@rpath";
   2.443  				PRODUCT_NAME = SDL2;
   2.444  				SKIP_INSTALL = YES;
     3.1 --- a/include/SDL_config_macosx.h	Mon Dec 04 20:26:09 2017 -0800
     3.2 +++ b/include/SDL_config_macosx.h	Mon Dec 04 20:35:01 2017 -0800
     3.3 @@ -179,10 +179,20 @@
     3.4  #define SDL_VIDEO_RENDER_OGL    1
     3.5  #endif
     3.6  
     3.7 +#ifndef SDL_VIDEO_RENDER_OGL_ES2
     3.8 +#define SDL_VIDEO_RENDER_OGL_ES2 1
     3.9 +#endif
    3.10 +
    3.11  /* Enable OpenGL support */
    3.12  #ifndef SDL_VIDEO_OPENGL
    3.13  #define SDL_VIDEO_OPENGL    1
    3.14  #endif
    3.15 +#ifndef SDL_VIDEO_OPENGL_ES2
    3.16 +#define SDL_VIDEO_OPENGL_ES2    1
    3.17 +#endif
    3.18 +#ifndef SDL_VIDEO_OPENGL_EGL
    3.19 +#define SDL_VIDEO_OPENGL_EGL    1
    3.20 +#endif
    3.21  #ifndef SDL_VIDEO_OPENGL_CGL
    3.22  #define SDL_VIDEO_OPENGL_CGL    1
    3.23  #endif
     4.1 --- a/src/video/SDL_egl.c	Mon Dec 04 20:26:09 2017 -0800
     4.2 +++ b/src/video/SDL_egl.c	Mon Dec 04 20:35:01 2017 -0800
     4.3 @@ -65,6 +65,13 @@
     4.4  #define DEFAULT_OGL_ES_PVR "libGLES_CM.dll"
     4.5  #define DEFAULT_OGL_ES "libGLESv1_CM.dll"
     4.6  
     4.7 +#elif SDL_VIDEO_DRIVER_COCOA
     4.8 +/* EGL AND OpenGL ES support via ANGLE */
     4.9 +#define DEFAULT_EGL "libEGL.dylib"
    4.10 +#define DEFAULT_OGL_ES2 "libGLESv2.dylib"
    4.11 +#define DEFAULT_OGL_ES_PVR "libGLES_CM.dylib"   //???
    4.12 +#define DEFAULT_OGL_ES "libGLESv1_CM.dylib"     //???
    4.13 +
    4.14  #else
    4.15  /* Desktop Linux */
    4.16  #define DEFAULT_OGL "libGL.so.1"
     5.1 --- a/src/video/cocoa/SDL_cocoaopengl.m	Mon Dec 04 20:26:09 2017 -0800
     5.2 +++ b/src/video/cocoa/SDL_cocoaopengl.m	Mon Dec 04 20:35:01 2017 -0800
     5.3 @@ -25,6 +25,7 @@
     5.4  #if SDL_VIDEO_OPENGL_CGL
     5.5  #include "SDL_cocoavideo.h"
     5.6  #include "SDL_cocoaopengl.h"
     5.7 +#include "SDL_cocoaopengles.h"
     5.8  
     5.9  #include <OpenGL/CGLTypes.h>
    5.10  #include <OpenGL/OpenGL.h>
    5.11 @@ -165,8 +166,27 @@
    5.12      int glversion_minor;
    5.13  
    5.14      if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
    5.15 -        SDL_SetError ("OpenGL ES is not supported on this platform");
    5.16 +#if SDL_VIDEO_OPENGL_EGL
    5.17 +        /* Switch to EGL based functions */
    5.18 +        Cocoa_GL_UnloadLibrary(_this);
    5.19 +        _this->GL_LoadLibrary = Cocoa_GLES_LoadLibrary;
    5.20 +        _this->GL_GetProcAddress = Cocoa_GLES_GetProcAddress;
    5.21 +        _this->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary;
    5.22 +        _this->GL_CreateContext = Cocoa_GLES_CreateContext;
    5.23 +        _this->GL_MakeCurrent = Cocoa_GLES_MakeCurrent;
    5.24 +        _this->GL_SetSwapInterval = Cocoa_GLES_SetSwapInterval;
    5.25 +        _this->GL_GetSwapInterval = Cocoa_GLES_GetSwapInterval;
    5.26 +        _this->GL_SwapWindow = Cocoa_GLES_SwapWindow;
    5.27 +        _this->GL_DeleteContext = Cocoa_GLES_DeleteContext;
    5.28 +        
    5.29 +        if (Cocoa_GLES_LoadLibrary(_this, NULL) != 0) {
    5.30 +            return NULL;
    5.31 +        }
    5.32 +        return Cocoa_GLES_CreateContext(_this, window);
    5.33 +#else
    5.34 +        SDL_SetError("SDL not configured with EGL support");
    5.35          return NULL;
    5.36 +#endif
    5.37      }
    5.38      if ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) && !lion_or_later) {
    5.39          SDL_SetError ("OpenGL Core Profile is not supported on this platform version");
     6.1 --- a/src/video/cocoa/SDL_cocoavideo.m	Mon Dec 04 20:26:09 2017 -0800
     6.2 +++ b/src/video/cocoa/SDL_cocoavideo.m	Mon Dec 04 20:35:01 2017 -0800
     6.3 @@ -121,6 +121,16 @@
     6.4      device->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval;
     6.5      device->GL_SwapWindow = Cocoa_GL_SwapWindow;
     6.6      device->GL_DeleteContext = Cocoa_GL_DeleteContext;
     6.7 +#elif SDL_VIDEO_OPENGL_EGL
     6.8 +    device->GL_LoadLibrary = Cocoa_GLES_LoadLibrary;
     6.9 +    device->GL_GetProcAddress = Cocoa_GLES_GetProcAddress;
    6.10 +    device->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary;
    6.11 +    device->GL_CreateContext = Cocoa_GLES_CreateContext;
    6.12 +    device->GL_MakeCurrent = Cocoa_GLES_MakeCurrent;
    6.13 +    device->GL_SetSwapInterval = Cocoa_GLES_SetSwapInterval;
    6.14 +    device->GL_GetSwapInterval = Cocoa_GLES_GetSwapInterval;
    6.15 +    device->GL_SwapWindow = Cocoa_GLES_SwapWindow;
    6.16 +    device->GL_DeleteContext = Cocoa_GLES_DeleteContext;
    6.17  #endif
    6.18  
    6.19  #if SDL_VIDEO_VULKAN
     7.1 --- a/src/video/cocoa/SDL_cocoawindow.h	Mon Dec 04 20:26:09 2017 -0800
     7.2 +++ b/src/video/cocoa/SDL_cocoawindow.h	Mon Dec 04 20:35:01 2017 -0800
     7.3 @@ -25,6 +25,10 @@
     7.4  
     7.5  #import <Cocoa/Cocoa.h>
     7.6  
     7.7 +#if SDL_VIDEO_OPENGL_EGL
     7.8 +#include "../SDL_egl_c.h"
     7.9 +#endif
    7.10 +
    7.11  typedef struct SDL_WindowData SDL_WindowData;
    7.12  
    7.13  typedef enum
    7.14 @@ -114,6 +118,9 @@
    7.15      SDL_bool inWindowMove;
    7.16      Cocoa_WindowListener *listener;
    7.17      struct SDL_VideoData *videodata;
    7.18 +#if SDL_VIDEO_OPENGL_EGL
    7.19 +    EGLSurface egl_surface;
    7.20 +#endif
    7.21  };
    7.22  
    7.23  extern int Cocoa_CreateWindow(_THIS, SDL_Window * window);
     8.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Mon Dec 04 20:26:09 2017 -0800
     8.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Mon Dec 04 20:35:01 2017 -0800
     8.3 @@ -40,6 +40,7 @@
     8.4  #include "SDL_cocoamouse.h"
     8.5  #include "SDL_cocoamousetap.h"
     8.6  #include "SDL_cocoaopengl.h"
     8.7 +#include "SDL_cocoaopengles.h"
     8.8  #include "SDL_assert.h"
     8.9  
    8.10  /* #define DEBUG_COCOAWINDOW */
    8.11 @@ -1342,7 +1343,14 @@
    8.12              [contentView setWantsBestResolutionOpenGLSurface:YES];
    8.13          }
    8.14      }
    8.15 -
    8.16 +#if SDL_VIDEO_OPENGL_ES2
    8.17 +#if SDL_VIDEO_OPENGL_EGL
    8.18 +    if ((window->flags & SDL_WINDOW_OPENGL) &&
    8.19 +        _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
    8.20 +        [contentView setWantsLayer:TRUE];
    8.21 +    }
    8.22 +#endif /* SDL_VIDEO_OPENGL_EGL */
    8.23 +#endif /* SDL_VIDEO_OPENGL_ES2 */
    8.24      [nswindow setContentView:contentView];
    8.25      [contentView release];
    8.26  
    8.27 @@ -1353,6 +1361,25 @@
    8.28          [nswindow release];
    8.29          return -1;
    8.30      }
    8.31 +
    8.32 +    if (!(window->flags & SDL_WINDOW_OPENGL)) {
    8.33 +        return 0;
    8.34 +    }
    8.35 +    
    8.36 +    /* The rest of this macro mess is for OpenGL or OpenGL ES windows */
    8.37 +#if SDL_VIDEO_OPENGL_ES2
    8.38 +    if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
    8.39 +#if SDL_VIDEO_OPENGL_EGL
    8.40 +        if (Cocoa_GLES_SetupWindow(_this, window) < 0) {
    8.41 +            Cocoa_DestroyWindow(_this, window);
    8.42 +            return -1;
    8.43 +        }
    8.44 +        return 0;
    8.45 +#else
    8.46 +        return SDL_SetError("Could not create GLES window surface (EGL support not configured)");
    8.47 +#endif /* SDL_VIDEO_OPENGL_EGL */
    8.48 +    }
    8.49 +#endif /* SDL_VIDEO_OPENGL_ES2 */
    8.50      return 0;
    8.51  }}
    8.52