Title: [251510] trunk/Source/ThirdParty/ANGLE
Revision
251510
Author
[email protected]
Date
2019-10-23 16:37:35 -0700 (Wed, 23 Oct 2019)

Log Message

[ANGLE] Improve compile-time macOS guards and avoid ObjC if possible
https://bugs.webkit.org/show_bug.cgi?id=203343

Reviewed by Simon Fraser.

Use the more official compile-time detection of Apple platforms, so that
it will be easier to differentiate between macOS and iOS. Also move some
.mm files to .cpp where possible.

* ANGLE.xcodeproj/project.pbxproj:
* src/gpu_info_util/SystemInfo_mac.cpp: Renamed from Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.mm.
(angle::GetSystemInfo):
* src/libANGLE/renderer/gl/cgl/DeviceCGL.cpp:
* src/libANGLE/renderer/gl/cgl/DisplayCGL.mm:
* src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp: Renamed from Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.mm.
* src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.cpp: Renamed from Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.mm.
* src/libANGLE/renderer/gl/cgl/RendererCGL.cpp: Renamed from Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/RendererCGL.mm.
* src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj (251509 => 251510)


--- trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj	2019-10-23 23:25:31 UTC (rev 251509)
+++ trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj	2019-10-23 23:37:35 UTC (rev 251510)
@@ -523,11 +523,11 @@
 		5CCD596C2284F7960018F2D8 /* MemoryObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CCD595E2284F7960018F2D8 /* MemoryObject.h */; };
 		5CCD596D2284F7960018F2D8 /* validationESEXT.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CCD595F2284F7960018F2D8 /* validationESEXT.h */; };
 		5CCD596E2284F9510018F2D8 /* DisplayCGL.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB3014A1DE39F4700D2C405 /* DisplayCGL.mm */; };
-		5CCD596F2284F9550018F2D8 /* PbufferSurfaceCGL.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB3014C1DE39F4700D2C405 /* PbufferSurfaceCGL.mm */; };
+		5CCD596F2284F9550018F2D8 /* PbufferSurfaceCGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CB3014C1DE39F4700D2C405 /* PbufferSurfaceCGL.cpp */; };
 		5CCD59772284FA830018F2D8 /* IOSurfaceSurfaceCGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CCD59712284FA820018F2D8 /* IOSurfaceSurfaceCGL.h */; };
 		5CCD59782284FA830018F2D8 /* ContextCGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD59722284FA820018F2D8 /* ContextCGL.cpp */; };
-		5CCD59792284FA830018F2D8 /* IOSurfaceSurfaceCGL.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD59732284FA820018F2D8 /* IOSurfaceSurfaceCGL.mm */; };
-		5CCD597A2284FA830018F2D8 /* RendererCGL.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD59742284FA820018F2D8 /* RendererCGL.mm */; };
+		5CCD59792284FA830018F2D8 /* IOSurfaceSurfaceCGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD59732284FA820018F2D8 /* IOSurfaceSurfaceCGL.cpp */; };
+		5CCD597A2284FA830018F2D8 /* RendererCGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD59742284FA820018F2D8 /* RendererCGL.cpp */; };
 		5CCD597B2284FA830018F2D8 /* ContextCGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CCD59752284FA820018F2D8 /* ContextCGL.h */; };
 		5CCD597C2284FA830018F2D8 /* RendererCGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CCD59762284FA830018F2D8 /* RendererCGL.h */; };
 		5CCD59802284FB900018F2D8 /* QueryImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD597D2284FB8F0018F2D8 /* QueryImpl.cpp */; };
@@ -542,7 +542,7 @@
 		5CCD59932284FC400018F2D8 /* imageformats.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CCD598B2284FC400018F2D8 /* imageformats.h */; };
 		5CCD59942284FC400018F2D8 /* generatemip.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CCD598C2284FC400018F2D8 /* generatemip.h */; };
 		5CCD59952284FC400018F2D8 /* loadimage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD598D2284FC400018F2D8 /* loadimage.cpp */; };
-		5CCD599A2284FC750018F2D8 /* SystemInfo_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD59972284FC750018F2D8 /* SystemInfo_mac.mm */; };
+		5CCD599A2284FC750018F2D8 /* SystemInfo_mac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD59972284FC750018F2D8 /* SystemInfo_mac.cpp */; };
 		5CCD599B2284FC750018F2D8 /* SystemInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD59982284FC750018F2D8 /* SystemInfo.cpp */; };
 		5CCD599C2284FC750018F2D8 /* SystemInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CCD59992284FC750018F2D8 /* SystemInfo.h */; };
 		5CCD599E2284FCDE0018F2D8 /* Context_gles_1_0.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD599D2284FCDD0018F2D8 /* Context_gles_1_0.cpp */; };
@@ -1196,7 +1196,7 @@
 		5CB301491DE39F4700D2C405 /* DisplayCGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayCGL.h; sourceTree = "<group>"; };
 		5CB3014A1DE39F4700D2C405 /* DisplayCGL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DisplayCGL.mm; sourceTree = "<group>"; };
 		5CB3014B1DE39F4700D2C405 /* PbufferSurfaceCGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PbufferSurfaceCGL.h; sourceTree = "<group>"; };
-		5CB3014C1DE39F4700D2C405 /* PbufferSurfaceCGL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PbufferSurfaceCGL.mm; sourceTree = "<group>"; };
+		5CB3014C1DE39F4700D2C405 /* PbufferSurfaceCGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PbufferSurfaceCGL.cpp; sourceTree = "<group>"; };
 		5CB3048B1DE4143500D2C405 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
 		5CB3048D1DE4144400D2C405 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
 		5CB3048F1DE4145500D2C405 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
@@ -1269,8 +1269,8 @@
 		5CCD595F2284F7960018F2D8 /* validationESEXT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = validationESEXT.h; sourceTree = "<group>"; };
 		5CCD59712284FA820018F2D8 /* IOSurfaceSurfaceCGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOSurfaceSurfaceCGL.h; sourceTree = "<group>"; };
 		5CCD59722284FA820018F2D8 /* ContextCGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContextCGL.cpp; sourceTree = "<group>"; };
-		5CCD59732284FA820018F2D8 /* IOSurfaceSurfaceCGL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IOSurfaceSurfaceCGL.mm; sourceTree = "<group>"; };
-		5CCD59742284FA820018F2D8 /* RendererCGL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RendererCGL.mm; sourceTree = "<group>"; };
+		5CCD59732284FA820018F2D8 /* IOSurfaceSurfaceCGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IOSurfaceSurfaceCGL.cpp; sourceTree = "<group>"; };
+		5CCD59742284FA820018F2D8 /* RendererCGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RendererCGL.cpp; sourceTree = "<group>"; };
 		5CCD59752284FA820018F2D8 /* ContextCGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextCGL.h; sourceTree = "<group>"; };
 		5CCD59762284FA830018F2D8 /* RendererCGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RendererCGL.h; sourceTree = "<group>"; };
 		5CCD597D2284FB8F0018F2D8 /* QueryImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QueryImpl.cpp; sourceTree = "<group>"; };
@@ -1285,7 +1285,7 @@
 		5CCD598B2284FC400018F2D8 /* imageformats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imageformats.h; sourceTree = "<group>"; };
 		5CCD598C2284FC400018F2D8 /* generatemip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = generatemip.h; sourceTree = "<group>"; };
 		5CCD598D2284FC400018F2D8 /* loadimage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = loadimage.cpp; sourceTree = "<group>"; };
-		5CCD59972284FC750018F2D8 /* SystemInfo_mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SystemInfo_mac.mm; sourceTree = "<group>"; };
+		5CCD59972284FC750018F2D8 /* SystemInfo_mac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SystemInfo_mac.cpp; sourceTree = "<group>"; };
 		5CCD59982284FC750018F2D8 /* SystemInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SystemInfo.cpp; sourceTree = "<group>"; };
 		5CCD59992284FC750018F2D8 /* SystemInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemInfo.h; sourceTree = "<group>"; };
 		5CCD599D2284FCDD0018F2D8 /* Context_gles_1_0.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Context_gles_1_0.cpp; sourceTree = "<group>"; };
@@ -2040,6 +2040,7 @@
 			isa = PBXGroup;
 			children = (
 				5CB301481DE39F3600D2C405 /* cgl */,
+				313BCE272360F78900FC39E5 /* eagl */,
 				5CB300E01DE39F1A00D2C405 /* BlitGL.cpp */,
 				5CB300E11DE39F1A00D2C405 /* BlitGL.h */,
 				5CB300E21DE39F1A00D2C405 /* BufferGL.cpp */,
@@ -2116,12 +2117,12 @@
 				6E31A0A2234EEED400C84784 /* DeviceCGL.h */,
 				5CB301491DE39F4700D2C405 /* DisplayCGL.h */,
 				5CB3014A1DE39F4700D2C405 /* DisplayCGL.mm */,
+				5CCD59732284FA820018F2D8 /* IOSurfaceSurfaceCGL.cpp */,
 				5CCD59712284FA820018F2D8 /* IOSurfaceSurfaceCGL.h */,
-				5CCD59732284FA820018F2D8 /* IOSurfaceSurfaceCGL.mm */,
+				5CB3014C1DE39F4700D2C405 /* PbufferSurfaceCGL.cpp */,
 				5CB3014B1DE39F4700D2C405 /* PbufferSurfaceCGL.h */,
-				5CB3014C1DE39F4700D2C405 /* PbufferSurfaceCGL.mm */,
+				5CCD59742284FA820018F2D8 /* RendererCGL.cpp */,
 				5CCD59762284FA830018F2D8 /* RendererCGL.h */,
-				5CCD59742284FA820018F2D8 /* RendererCGL.mm */,
 				A31B6181230B747E001610D7 /* WindowSurfaceCGL.h */,
 				A31B6182230B747F001610D7 /* WindowSurfaceCGL.mm */,
 			);
@@ -2332,7 +2333,8 @@
 			children = (
 				5CCD59982284FC750018F2D8 /* SystemInfo.cpp */,
 				5CCD59992284FC750018F2D8 /* SystemInfo.h */,
-				5CCD59972284FC750018F2D8 /* SystemInfo_mac.mm */,
+				313BCE442360F9AD00FC39E5 /* SystemInfo_internal.h */,
+				5CCD59972284FC750018F2D8 /* SystemInfo_mac.cpp */,
 			);
 			name = gpuinfoutil;
 			path = gpu_info_util;
@@ -2541,6 +2543,7 @@
 				5C1DBDE31B0438D300235552 /* Context.h in Headers */,
 				A30307272305F7C4002DA972 /* Context.inl.h in Headers */,
 				5CCD597B2284FA830018F2D8 /* ContextCGL.h in Headers */,
+				313BCE3D2360F78A00FC39E5 /* ContextEAGL.h in Headers */,
 				5CB3011D1DE39F1A00D2C405 /* ContextGL.h in Headers */,
 				5CB304DE1DE4164800D2C405 /* ContextImpl.h in Headers */,
 				5CCD598E2284FC400018F2D8 /* copyimage.h in Headers */,
@@ -2551,6 +2554,7 @@
 				5C55D68922826B9F00B5BA2C /* DeferGlobalInitializers.h in Headers */,
 				5C1DBDE71B0438D300235552 /* Device.h in Headers */,
 				6E31A0A4234EEED400C84784 /* DeviceCGL.h in Headers */,
+				313BCE432360F78A00FC39E5 /* DeviceEAGL.h in Headers */,
 				5CB304E01DE4164800D2C405 /* DeviceImpl.h in Headers */,
 				31012E2718B97B9B0039062F /* Diagnostics.h in Headers */,
 				A264F8AD16974DED006FAA5A /* DiagnosticsBase.h in Headers */,
@@ -2560,6 +2564,7 @@
 				315EBDBC1FCE44BF00AC7A89 /* DispatchTableGL_autogen.h in Headers */,
 				5C1DBDE91B0438D300235552 /* Display.h in Headers */,
 				5CB3014F1DE39F4700D2C405 /* DisplayCGL.h in Headers */,
+				313BCE3B2360F78A00FC39E5 /* DisplayEAGL.h in Headers */,
 				5CB3011F1DE39F1A00D2C405 /* DisplayGL.h in Headers */,
 				5CB304E21DE4164800D2C405 /* DisplayImpl.h in Headers */,
 				315EBDC91FCE44E400AC7A89 /* driver_utils.h in Headers */,
@@ -2658,6 +2663,7 @@
 				5C55D70822826CB300B5BA2C /* IntermNodePatternMatcher.h in Headers */,
 				5C55D70122826CB300B5BA2C /* IntermTraverse.h in Headers */,
 				5CCD59772284FA830018F2D8 /* IOSurfaceSurfaceCGL.h in Headers */,
+				313BCE412360F78A00FC39E5 /* IOSurfaceSurfaceEAGL.h in Headers */,
 				315EBD8E1FCE443600AC7A89 /* IsASTDepthBelowLimit.h in Headers */,
 				A264F8CD169762AA006FAA5A /* khrplatform.h in Headers */,
 				5C1DBC321B04375F00235552 /* length_limits.h in Headers */,
@@ -2698,6 +2704,7 @@
 				5CB3012E1DE39F1A00D2C405 /* PathGL.h in Headers */,
 				5CB304F11DE4164800D2C405 /* PathImpl.h in Headers */,
 				5CB301511DE39F4700D2C405 /* PbufferSurfaceCGL.h in Headers */,
+				313BCE3C2360F78A00FC39E5 /* PbufferSurfaceEAGL.h in Headers */,
 				5C1DBBF51B0436EC00235552 /* platform.h in Headers */,
 				315EBE291FCF808C00AC7A89 /* PMurHash.h in Headers */,
 				5C55D7272282747700B5BA2C /* PoolAlloc.h in Headers */,
@@ -2736,6 +2743,7 @@
 				5CB304F51DE4164800D2C405 /* RenderbufferImpl_mock.h in Headers */,
 				5CB304F81DE4164800D2C405 /* renderer_utils.h in Headers */,
 				5CCD597C2284FA830018F2D8 /* RendererCGL.h in Headers */,
+				313BCE3E2360F78A00FC39E5 /* RendererEAGL.h in Headers */,
 				5CB301381DE39F1A00D2C405 /* RendererGL.h in Headers */,
 				5CB301361DE39F1A00D2C405 /* renderergl_utils.h in Headers */,
 				A30307072305F636002DA972 /* ReplaceShadowingVariables.h in Headers */,
@@ -2800,6 +2808,7 @@
 				31A331C71EA5ED5F00FD2203 /* system_utils.h in Headers */,
 				5C55D72B2282747700B5BA2C /* system_utils_unittest_helper.h in Headers */,
 				5CCD599C2284FC750018F2D8 /* SystemInfo.h in Headers */,
+				313BCE452360F9AD00FC39E5 /* SystemInfo_internal.h in Headers */,
 				5C1DBF311B0438D300235552 /* Texture.h in Headers */,
 				315EBD9E1FCE443600AC7A89 /* TextureFunctionHLSL.h in Headers */,
 				5CB301421DE39F1A00D2C405 /* TextureGL.h in Headers */,
@@ -2877,6 +2886,7 @@
 				5C1DBF421B0438D300235552 /* VertexAttribute.h in Headers */,
 				5C55D70022826CB300B5BA2C /* Visit.h in Headers */,
 				A31B6183230B747F001610D7 /* WindowSurfaceCGL.h in Headers */,
+				313BCE372360F78A00FC39E5 /* WindowSurfaceEAGL.h in Headers */,
 				315EBDFA1FCE452D00AC7A89 /* WorkerThread.h in Headers */,
 				5C55D67522826B9F00B5BA2C /* WrapSwitchStatementsInBlocks.h in Headers */,
 				5CCD59512284ECD10018F2D8 /* xxhash.h in Headers */,
@@ -3084,7 +3094,7 @@
 				5C55D70922826CB300B5BA2C /* IntermNode_util.cpp in Sources */,
 				5C55D70422826CB300B5BA2C /* IntermNodePatternMatcher.cpp in Sources */,
 				5C55D70222826CB300B5BA2C /* IntermTraverse.cpp in Sources */,
-				5CCD59792284FA830018F2D8 /* IOSurfaceSurfaceCGL.mm in Sources */,
+				5CCD59792284FA830018F2D8 /* IOSurfaceSurfaceCGL.cpp in Sources */,
 				315EBD9C1FCE443600AC7A89 /* IsASTDepthBelowLimit.cpp in Sources */,
 				A264F8B616974DED006FAA5A /* Lexer.cpp in Sources */,
 				5CB304EF1DE4164800D2C405 /* load_functions_table_autogen.cpp in Sources */,
@@ -3118,7 +3128,7 @@
 				31012E5418B97B9B0039062F /* ParseContext.cpp in Sources */,
 				5CCD817A1DBFE999006066B8 /* Path.cpp in Sources */,
 				5CB3012D1DE39F1A00D2C405 /* PathGL.cpp in Sources */,
-				5CCD596F2284F9550018F2D8 /* PbufferSurfaceCGL.mm in Sources */,
+				5CCD596F2284F9550018F2D8 /* PbufferSurfaceCGL.cpp in Sources */,
 				5C1DBDFE1B0438D300235552 /* Platform.cpp in Sources */,
 				315EBE281FCF808C00AC7A89 /* PMurHash.cpp in Sources */,
 				31012E5618B97B9B0039062F /* PoolAlloc.cpp in Sources */,
@@ -3149,7 +3159,7 @@
 				5C1DBE071B0438D300235552 /* Renderbuffer.cpp in Sources */,
 				5CB301331DE39F1A00D2C405 /* RenderbufferGL.cpp in Sources */,
 				5CB304F71DE4164800D2C405 /* renderer_utils.cpp in Sources */,
-				5CCD597A2284FA830018F2D8 /* RendererCGL.mm in Sources */,
+				5CCD597A2284FA830018F2D8 /* RendererCGL.cpp in Sources */,
 				5CB301371DE39F1A00D2C405 /* RendererGL.cpp in Sources */,
 				5CB301351DE39F1A00D2C405 /* renderergl_utils.cpp in Sources */,
 				A30307052305F636002DA972 /* ReplaceShadowingVariables.cpp in Sources */,
@@ -3202,7 +3212,7 @@
 				5C55D7302282747700B5BA2C /* system_utils_posix.cpp in Sources */,
 				5C55D7202282747700B5BA2C /* system_utils_unittest_helper.cpp in Sources */,
 				5CCD599B2284FC750018F2D8 /* SystemInfo.cpp in Sources */,
-				5CCD599A2284FC750018F2D8 /* SystemInfo_mac.mm in Sources */,
+				5CCD599A2284FC750018F2D8 /* SystemInfo_mac.cpp in Sources */,
 				5C1DBF301B0438D300235552 /* Texture.cpp in Sources */,
 				315EBD991FCE443600AC7A89 /* TextureFunctionHLSL.cpp in Sources */,
 				5CB301411DE39F1A00D2C405 /* TextureGL.cpp in Sources */,

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (251509 => 251510)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2019-10-23 23:25:31 UTC (rev 251509)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2019-10-23 23:37:35 UTC (rev 251510)
@@ -1,5 +1,26 @@
 2019-10-23  Dean Jackson  <[email protected]>
 
+        [ANGLE] Improve compile-time macOS guards and avoid ObjC if possible
+        https://bugs.webkit.org/show_bug.cgi?id=203343
+
+        Reviewed by Simon Fraser.
+
+        Use the more official compile-time detection of Apple platforms, so that
+        it will be easier to differentiate between macOS and iOS. Also move some
+        .mm files to .cpp where possible.
+
+        * ANGLE.xcodeproj/project.pbxproj:
+        * src/gpu_info_util/SystemInfo_mac.cpp: Renamed from Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.mm.
+        (angle::GetSystemInfo):
+        * src/libANGLE/renderer/gl/cgl/DeviceCGL.cpp:
+        * src/libANGLE/renderer/gl/cgl/DisplayCGL.mm:
+        * src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp: Renamed from Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.mm.
+        * src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.cpp: Renamed from Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.mm.
+        * src/libANGLE/renderer/gl/cgl/RendererCGL.cpp: Renamed from Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/RendererCGL.mm.
+        * src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm:
+
+2019-10-23  Dean Jackson  <[email protected]>
+
         Don't try to compile .inc files in ANGLE
         https://bugs.webkit.org/show_bug.cgi?id=203315
 

Copied: trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.cpp (from rev 251509, trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.mm) (0 => 251510)


--- trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.cpp	                        (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.cpp	2019-10-23 23:37:35 UTC (rev 251510)
@@ -0,0 +1,248 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SystemInfo_mac.cpp: implementation of the Mac-specific parts of SystemInfo.h
+
+#if defined(__APPLE__)
+#include <TargetConditionals.h>
+#if TARGET_OS_OSX
+
+#include "gpu_info_util/SystemInfo_internal.h"
+
+#include <CoreGraphics/CGDirectDisplay.h>
+#include <IOKit/IOKitLib.h>
+#include <OpenGL/OpenGL.h>
+
+namespace angle
+{
+
+namespace
+{
+
+using PlatformDisplayID = uint32_t;
+
+constexpr CGLRendererProperty kCGLRPRegistryIDLow  = static_cast<CGLRendererProperty>(140);
+constexpr CGLRendererProperty kCGLRPRegistryIDHigh = static_cast<CGLRendererProperty>(141);
+
+// Code from WebKit to get the active GPU's ID given a display ID.
+uint64_t GetGpuIDFromDisplayID(PlatformDisplayID displayID)
+{
+    GLuint displayMask              = CGDisplayIDToOpenGLDisplayMask(displayID);
+    GLint numRenderers              = 0;
+    CGLRendererInfoObj rendererInfo = nullptr;
+    CGLError error = CGLQueryRendererInfo(displayMask, &rendererInfo, &numRenderers);
+    if (!numRenderers || !rendererInfo || error != kCGLNoError)
+        return 0;
+
+    // The 0th renderer should not be the software renderer.
+    GLint isAccelerated;
+    error = CGLDescribeRenderer(rendererInfo, 0, kCGLRPAccelerated, &isAccelerated);
+    if (!isAccelerated || error != kCGLNoError)
+    {
+        CGLDestroyRendererInfo(rendererInfo);
+        return 0;
+    }
+
+    GLint gpuIDLow  = 0;
+    GLint gpuIDHigh = 0;
+
+    error = CGLDescribeRenderer(rendererInfo, 0, kCGLRPRegistryIDLow, &gpuIDLow);
+
+    if (error != kCGLNoError || gpuIDLow < 0)
+    {
+        CGLDestroyRendererInfo(rendererInfo);
+        return 0;
+    }
+
+    error = CGLDescribeRenderer(rendererInfo, 0, kCGLRPRegistryIDHigh, &gpuIDHigh);
+    if (error != kCGLNoError || gpuIDHigh < 0)
+    {
+        CGLDestroyRendererInfo(rendererInfo);
+        return 0;
+    }
+
+    CGLDestroyRendererInfo(rendererInfo);
+    return static_cast<uint64_t>(gpuIDHigh) << 32 | gpuIDLow;
+}
+
+std::string GetMachineModel()
+{
+    io_service_t platformExpert = IOServiceGetMatchingService(
+        kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
+
+    if (platformExpert == IO_OBJECT_NULL)
+    {
+        return "";
+    }
+
+    CFDataRef modelData = static_cast<CFDataRef>(
+        IORegistryEntryCreateCFProperty(platformExpert, CFSTR("model"), kCFAllocatorDefault, 0));
+    if (modelData == nullptr)
+    {
+        IOObjectRelease(platformExpert);
+        return "";
+    }
+
+    std::string result = reinterpret_cast<const char *>(CFDataGetBytePtr(modelData));
+
+    IOObjectRelease(platformExpert);
+    CFRelease(modelData);
+
+    return result;
+}
+
+// Extracts one integer property from a registry entry.
+bool GetEntryProperty(io_registry_entry_t entry, CFStringRef name, uint32_t *value)
+{
+    *value = 0;
+
+    CFDataRef data = ""
+        IORegistryEntrySearchCFProperty(entry, kIOServicePlane, name, kCFAllocatorDefault,
+                                        kIORegistryIterateRecursively | kIORegistryIterateParents));
+
+    if (data == nullptr)
+    {
+        return false;
+    }
+
+    const uint32_t *valuePtr = reinterpret_cast<const uint32_t *>(CFDataGetBytePtr(data));
+
+    if (valuePtr == nullptr)
+    {
+        CFRelease(data);
+        return false;
+    }
+
+    *value = *valuePtr;
+    CFRelease(data);
+    return true;
+}
+
+// Gathers the vendor and device IDs for the PCI GPUs
+bool GetPCIDevices(std::vector<GPUDeviceInfo> *devices)
+{
+    // matchDictionary will be consumed by IOServiceGetMatchingServices, no need to release it.
+    CFMutableDictionaryRef matchDictionary = IOServiceMatching("IOPCIDevice");
+
+    io_iterator_t entryIterator;
+    if (IOServiceGetMatchingServices(kIOMasterPortDefault, matchDictionary, &entryIterator) !=
+        kIOReturnSuccess)
+    {
+        return false;
+    }
+
+    io_registry_entry_t entry = IO_OBJECT_NULL;
+
+    while ((entry = IOIteratorNext(entryIterator)) != IO_OBJECT_NULL)
+    {
+        constexpr uint32_t kClassCodeDisplayVGA = 0x30000;
+        uint32_t classCode;
+        GPUDeviceInfo info;
+
+        if (GetEntryProperty(entry, CFSTR("class-code"), &classCode) &&
+            classCode == kClassCodeDisplayVGA &&
+            GetEntryProperty(entry, CFSTR("vendor-id"), &info.vendorId) &&
+            GetEntryProperty(entry, CFSTR("device-id"), &info.deviceId))
+        {
+            devices->push_back(info);
+        }
+
+        IOObjectRelease(entry);
+    }
+    IOObjectRelease(entryIterator);
+
+    return true;
+}
+
+void SetActiveGPUIndex(SystemInfo *info)
+{
+    VendorID activeVendor;
+    DeviceID activeDevice;
+
+    uint64_t gpuID = GetGpuIDFromDisplayID(kCGDirectMainDisplay);
+
+    if (gpuID == 0)
+        return;
+
+    CFMutableDictionaryRef matchDictionary = IORegistryEntryIDMatching(gpuID);
+    io_service_t gpuEntry = IOServiceGetMatchingService(kIOMasterPortDefault, matchDictionary);
+
+    if (gpuEntry == IO_OBJECT_NULL)
+    {
+        IOObjectRelease(gpuEntry);
+        return;
+    }
+
+    if (!(GetEntryProperty(gpuEntry, CFSTR("vendor-id"), &activeVendor) &&
+          GetEntryProperty(gpuEntry, CFSTR("device-id"), &activeDevice)))
+    {
+        IOObjectRelease(gpuEntry);
+        return;
+    }
+
+    IOObjectRelease(gpuEntry);
+
+    for (size_t i = 0; i < info->gpus.size(); ++i)
+    {
+        if (info->gpus[i].vendorId == activeVendor && info->gpus[i].deviceId == activeDevice)
+        {
+            info->activeGPUIndex = static_cast<int>(i);
+            break;
+        }
+    }
+}
+
+}  // anonymous namespace
+
+bool GetSystemInfo(SystemInfo *info)
+{
+    {
+        int32_t major = 0;
+        int32_t minor = 0;
+        ParseMacMachineModel(GetMachineModel(), &info->machineModelName, &major, &minor);
+        info->machineModelVersion = std::to_string(major) + "." + std::to_string(minor);
+    }
+
+    if (!GetPCIDevices(&(info->gpus)))
+    {
+        return false;
+    }
+
+    if (info->gpus.empty())
+    {
+        return false;
+    }
+
+    // Call the generic GetDualGPUInfo function to initialize info fields
+    // such as isOptimus, isAMDSwitchable, and the activeGPUIndex
+    GetDualGPUInfo(info);
+
+    // Then override the activeGPUIndex field of info to reflect the current
+    // GPU instead of the non-intel GPU
+    // TODO(dino): Use sysctl to detect OS version.
+    //    if (@available(macOS 10.13, *))
+    SetActiveGPUIndex(info);
+
+    // Figure out whether this is a dual-GPU system.
+    //
+    // TODO(kbr): this code was ported over from Chromium, and its correctness
+    // could be improved - need to use Mac-specific APIs to determine whether
+    // offline renderers are allowed, and whether these two GPUs are really the
+    // integrated/discrete GPUs in a laptop.
+    if (info->gpus.size() == 2 &&
+        ((IsIntel(info->gpus[0].vendorId) && !IsIntel(info->gpus[1].vendorId)) ||
+         (!IsIntel(info->gpus[0].vendorId) && IsIntel(info->gpus[1].vendorId))))
+    {
+        info->isMacSwitchable = true;
+    }
+
+    return true;
+}
+
+}  // namespace angle
+
+#endif  // TARGET_OS_OSX
+#endif  // __APPLE__

Property changes: trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.cpp


Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Author Id Revision HeadURL \ No newline at end of property

Deleted: trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.mm (251509 => 251510)


--- trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.mm	2019-10-23 23:25:31 UTC (rev 251509)
+++ trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.mm	2019-10-23 23:37:35 UTC (rev 251510)
@@ -1,245 +0,0 @@
-//
-// Copyright 2017 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// SystemInfo_mac.cpp: implementation of the Mac-specific parts of SystemInfo.h
-
-#if __has_include(<Cocoa/Cocoa.h>)
-
-#    include "gpu_info_util/SystemInfo_internal.h"
-
-#    import <Cocoa/Cocoa.h>
-#    import <IOKit/IOKitLib.h>
-
-namespace angle
-{
-
-namespace
-{
-
-using PlatformDisplayID = uint32_t;
-
-constexpr CGLRendererProperty kCGLRPRegistryIDLow  = static_cast<CGLRendererProperty>(140);
-constexpr CGLRendererProperty kCGLRPRegistryIDHigh = static_cast<CGLRendererProperty>(141);
-
-// Code from WebKit to get the active GPU's ID given a display ID.
-uint64_t GetGpuIDFromDisplayID(PlatformDisplayID displayID)
-{
-    GLuint displayMask              = CGDisplayIDToOpenGLDisplayMask(displayID);
-    GLint numRenderers              = 0;
-    CGLRendererInfoObj rendererInfo = nullptr;
-    CGLError error = CGLQueryRendererInfo(displayMask, &rendererInfo, &numRenderers);
-    if (!numRenderers || !rendererInfo || error != kCGLNoError)
-        return 0;
-
-    // The 0th renderer should not be the software renderer.
-    GLint isAccelerated;
-    error = CGLDescribeRenderer(rendererInfo, 0, kCGLRPAccelerated, &isAccelerated);
-    if (!isAccelerated || error != kCGLNoError)
-    {
-        CGLDestroyRendererInfo(rendererInfo);
-        return 0;
-    }
-
-    GLint gpuIDLow  = 0;
-    GLint gpuIDHigh = 0;
-
-    error = CGLDescribeRenderer(rendererInfo, 0, kCGLRPRegistryIDLow, &gpuIDLow);
-
-    if (error != kCGLNoError || gpuIDLow < 0)
-    {
-        CGLDestroyRendererInfo(rendererInfo);
-        return 0;
-    }
-
-    error = CGLDescribeRenderer(rendererInfo, 0, kCGLRPRegistryIDHigh, &gpuIDHigh);
-    if (error != kCGLNoError || gpuIDHigh < 0)
-    {
-        CGLDestroyRendererInfo(rendererInfo);
-        return 0;
-    }
-
-    CGLDestroyRendererInfo(rendererInfo);
-    return static_cast<uint64_t>(gpuIDHigh) << 32 | gpuIDLow;
-}
-
-std::string GetMachineModel()
-{
-    io_service_t platformExpert = IOServiceGetMatchingService(
-        kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
-
-    if (platformExpert == IO_OBJECT_NULL)
-    {
-        return "";
-    }
-
-    CFDataRef modelData = static_cast<CFDataRef>(
-        IORegistryEntryCreateCFProperty(platformExpert, CFSTR("model"), kCFAllocatorDefault, 0));
-    if (modelData == nullptr)
-    {
-        IOObjectRelease(platformExpert);
-        return "";
-    }
-
-    std::string result = reinterpret_cast<const char *>(CFDataGetBytePtr(modelData));
-
-    IOObjectRelease(platformExpert);
-    CFRelease(modelData);
-
-    return result;
-}
-
-// Extracts one integer property from a registry entry.
-bool GetEntryProperty(io_registry_entry_t entry, CFStringRef name, uint32_t *value)
-{
-    *value = 0;
-
-    CFDataRef data = ""
-        IORegistryEntrySearchCFProperty(entry, kIOServicePlane, name, kCFAllocatorDefault,
-                                        kIORegistryIterateRecursively | kIORegistryIterateParents));
-
-    if (data == nullptr)
-    {
-        return false;
-    }
-
-    const uint32_t *valuePtr = reinterpret_cast<const uint32_t *>(CFDataGetBytePtr(data));
-
-    if (valuePtr == nullptr)
-    {
-        CFRelease(data);
-        return false;
-    }
-
-    *value = *valuePtr;
-    CFRelease(data);
-    return true;
-}
-
-// Gathers the vendor and device IDs for the PCI GPUs
-bool GetPCIDevices(std::vector<GPUDeviceInfo> *devices)
-{
-    // matchDictionary will be consumed by IOServiceGetMatchingServices, no need to release it.
-    CFMutableDictionaryRef matchDictionary = IOServiceMatching("IOPCIDevice");
-
-    io_iterator_t entryIterator;
-    if (IOServiceGetMatchingServices(kIOMasterPortDefault, matchDictionary, &entryIterator) !=
-        kIOReturnSuccess)
-    {
-        return false;
-    }
-
-    io_registry_entry_t entry = IO_OBJECT_NULL;
-
-    while ((entry = IOIteratorNext(entryIterator)) != IO_OBJECT_NULL)
-    {
-        constexpr uint32_t kClassCodeDisplayVGA = 0x30000;
-        uint32_t classCode;
-        GPUDeviceInfo info;
-
-        if (GetEntryProperty(entry, CFSTR("class-code"), &classCode) &&
-            classCode == kClassCodeDisplayVGA &&
-            GetEntryProperty(entry, CFSTR("vendor-id"), &info.vendorId) &&
-            GetEntryProperty(entry, CFSTR("device-id"), &info.deviceId))
-        {
-            devices->push_back(info);
-        }
-
-        IOObjectRelease(entry);
-    }
-    IOObjectRelease(entryIterator);
-
-    return true;
-}
-
-void SetActiveGPUIndex(SystemInfo *info)
-{
-    VendorID activeVendor;
-    DeviceID activeDevice;
-
-    uint64_t gpuID = GetGpuIDFromDisplayID(kCGDirectMainDisplay);
-
-    if (gpuID == 0)
-        return;
-
-    CFMutableDictionaryRef matchDictionary = IORegistryEntryIDMatching(gpuID);
-    io_service_t gpuEntry = IOServiceGetMatchingService(kIOMasterPortDefault, matchDictionary);
-
-    if (gpuEntry == IO_OBJECT_NULL)
-    {
-        IOObjectRelease(gpuEntry);
-        return;
-    }
-
-    if (!(GetEntryProperty(gpuEntry, CFSTR("vendor-id"), &activeVendor) &&
-          GetEntryProperty(gpuEntry, CFSTR("device-id"), &activeDevice)))
-    {
-        IOObjectRelease(gpuEntry);
-        return;
-    }
-
-    IOObjectRelease(gpuEntry);
-
-    for (size_t i = 0; i < info->gpus.size(); ++i)
-    {
-        if (info->gpus[i].vendorId == activeVendor && info->gpus[i].deviceId == activeDevice)
-        {
-            info->activeGPUIndex = static_cast<int>(i);
-            break;
-        }
-    }
-}
-
-}  // anonymous namespace
-
-bool GetSystemInfo(SystemInfo *info)
-{
-    {
-        int32_t major = 0;
-        int32_t minor = 0;
-        ParseMacMachineModel(GetMachineModel(), &info->machineModelName, &major, &minor);
-        info->machineModelVersion = std::to_string(major) + "." + std::to_string(minor);
-    }
-
-    if (!GetPCIDevices(&(info->gpus)))
-    {
-        return false;
-    }
-
-    if (info->gpus.empty())
-    {
-        return false;
-    }
-
-    // Call the generic GetDualGPUInfo function to initialize info fields
-    // such as isOptimus, isAMDSwitchable, and the activeGPUIndex
-    GetDualGPUInfo(info);
-
-    // Then override the activeGPUIndex field of info to reflect the current
-    // GPU instead of the non-intel GPU
-    if (@available(macOS 10.13, *))
-    {
-        SetActiveGPUIndex(info);
-    }
-
-    // Figure out whether this is a dual-GPU system.
-    //
-    // TODO(kbr): this code was ported over from Chromium, and its correctness
-    // could be improved - need to use Mac-specific APIs to determine whether
-    // offline renderers are allowed, and whether these two GPUs are really the
-    // integrated/discrete GPUs in a laptop.
-    if (info->gpus.size() == 2 &&
-        ((IsIntel(info->gpus[0].vendorId) && !IsIntel(info->gpus[1].vendorId)) ||
-         (!IsIntel(info->gpus[0].vendorId) && IsIntel(info->gpus[1].vendorId))))
-    {
-        info->isMacSwitchable = true;
-    }
-
-    return true;
-}
-
-}  // namespace angle
-
-#endif  // __has_include(<Cocoa/Cocoa.h>)

Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/DeviceCGL.cpp (251509 => 251510)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/DeviceCGL.cpp	2019-10-23 23:25:31 UTC (rev 251509)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/DeviceCGL.cpp	2019-10-23 23:37:35 UTC (rev 251510)
@@ -6,13 +6,16 @@
 
 // DeviceCGL.cpp: CGL implementation of egl::Device
 
-#if __has_include(<Cocoa/Cocoa.h>)
+#if defined(__APPLE__)
+#include <TargetConditionals.h>
+#if TARGET_OS_OSX
 
-#    include "libANGLE/renderer/gl/cgl/DeviceCGL.h"
+#include "libANGLE/renderer/gl/cgl/DeviceCGL.h"
 
-#    include <EGL/eglext.h>
-#    include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
+#include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
 
+#include <EGL/eglext.h>
+
 namespace rx
 {
 
@@ -56,4 +59,5 @@
 
 }  // namespace rx
 
-#endif  // __has_include(<Cocoa/Cocoa.h>)
+#endif  // TARGET_OS_OSX
+#endif  // __APPLE__

Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/DisplayCGL.mm (251509 => 251510)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/DisplayCGL.mm	2019-10-23 23:25:31 UTC (rev 251509)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/DisplayCGL.mm	2019-10-23 23:37:35 UTC (rev 251510)
@@ -4,25 +4,28 @@
 // found in the LICENSE file.
 //
 
-// DisplayCGL.mm: CGL implementation of egl::Display
+// DisplayCGL.cpp: CGL implementation of egl::Display
 
-#if __has_include(<Cocoa/Cocoa.h>)
+#if defined(__APPLE__)
+#include <TargetConditionals.h>
+#if TARGET_OS_OSX
 
-#    include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
+#import "libANGLE/renderer/gl/cgl/DisplayCGL.h"
 
-#    import <Cocoa/Cocoa.h>
-#    include <EGL/eglext.h>
-#    include <dlfcn.h>
+#import "common/debug.h"
+#import "gpu_info_util/SystemInfo.h"
+#import "libANGLE/Display.h"
+#import "libANGLE/renderer/gl/cgl/ContextCGL.h"
+#import "libANGLE/renderer/gl/cgl/DeviceCGL.h"
+#import "libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.h"
+#import "libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h"
+#import "libANGLE/renderer/gl/cgl/RendererCGL.h"
+#import "libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h"
 
-#    include "common/debug.h"
-#    include "gpu_info_util/SystemInfo.h"
-#    include "libANGLE/Display.h"
-#    include "libANGLE/renderer/gl/cgl/ContextCGL.h"
-#    include "libANGLE/renderer/gl/cgl/DeviceCGL.h"
-#    include "libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.h"
-#    include "libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h"
-#    include "libANGLE/renderer/gl/cgl/RendererCGL.h"
-#    include "libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h"
+#import <Foundation/Foundation.h>
+#import <OpenGL/OpenGL.h>
+#import <QuartzCore/QuartzCore.h>
+#import <dlfcn.h>
 
 namespace
 {
@@ -446,4 +449,5 @@
 }
 }
 
-#endif  // __has_include(<Cocoa/Cocoa.h>)
+#endif  // TARGET_OS_OSX
+#endif  // __APPLE__

Copied: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp (from rev 251509, trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.mm) (0 => 251510)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp	                        (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp	2019-10-23 23:37:35 UTC (rev 251510)
@@ -0,0 +1,339 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// PBufferSurfaceCGL.cpp: an implementation of PBuffers created from IOSurfaces using
+//                        EGL_ANGLE_iosurface_client_buffer
+
+#if defined(__APPLE__)
+#include <TargetConditionals.h>
+#if TARGET_OS_OSX
+
+#include "libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.h"
+
+#include "common/debug.h"
+#include "libANGLE/AttributeMap.h"
+#include "libANGLE/renderer/gl/BlitGL.h"
+#include "libANGLE/renderer/gl/FramebufferGL.h"
+#include "libANGLE/renderer/gl/FunctionsGL.h"
+#include "libANGLE/renderer/gl/RendererGL.h"
+#include "libANGLE/renderer/gl/StateManagerGL.h"
+#include "libANGLE/renderer/gl/TextureGL.h"
+#include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
+
+#include <IOSurface/IOSurface.h>
+#include <OpenGL/OpenGL.h>
+#include <OpenGL/CGLIOSurface.h>
+
+namespace rx
+{
+
+namespace
+{
+
+struct IOSurfaceFormatInfo
+{
+    GLenum internalFormat;
+    GLenum type;
+
+    size_t componentBytes;
+
+    GLenum nativeInternalFormat;
+    GLenum nativeFormat;
+    GLenum nativeType;
+};
+
+// clang-format off
+static const IOSurfaceFormatInfo kIOSurfaceFormats[] = {
+    {GL_RED,      GL_UNSIGNED_BYTE,  1, GL_RED,  GL_RED,  GL_UNSIGNED_BYTE           },
+    {GL_R16UI,    GL_UNSIGNED_SHORT, 2, GL_RED,  GL_RED,  GL_UNSIGNED_SHORT          },
+    {GL_RG,       GL_UNSIGNED_BYTE,  2, GL_RG,   GL_RG,   GL_UNSIGNED_BYTE           },
+    {GL_RGB,      GL_UNSIGNED_BYTE,  4, GL_BGRA, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV},
+    {GL_BGRA_EXT, GL_UNSIGNED_BYTE,  4, GL_BGRA, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV},
+    {GL_RGBA,     GL_HALF_FLOAT,     8, GL_RGBA, GL_RGBA, GL_HALF_FLOAT              },
+};
+// clang-format on
+
+int FindIOSurfaceFormatIndex(GLenum internalFormat, GLenum type)
+{
+    for (int i = 0; i < static_cast<int>(ArraySize(kIOSurfaceFormats)); ++i)
+    {
+        const auto &formatInfo = kIOSurfaceFormats[i];
+        if (formatInfo.internalFormat == internalFormat && formatInfo.type == type)
+        {
+            return i;
+        }
+    }
+    return -1;
+}
+
+}  // anonymous namespace
+
+IOSurfaceSurfaceCGL::IOSurfaceSurfaceCGL(const egl::SurfaceState &state,
+                                         CGLContextObj cglContext,
+                                         EGLClientBuffer buffer,
+                                         const egl::AttributeMap &attribs)
+    : SurfaceGL(state),
+      mCGLContext(cglContext),
+      mIOSurface(nullptr),
+      mWidth(0),
+      mHeight(0),
+      mPlane(0),
+      mFormatIndex(-1),
+      mAlphaInitialized(false)
+{
+    // Keep reference to the IOSurface so it doesn't get deleted while the pbuffer exists.
+    mIOSurface = reinterpret_cast<IOSurfaceRef>(buffer);
+    CFRetain(mIOSurface);
+
+    // Extract attribs useful for the call to CGLTexImageIOSurface2D
+    mWidth  = static_cast<int>(attribs.get(EGL_WIDTH));
+    mHeight = static_cast<int>(attribs.get(EGL_HEIGHT));
+    mPlane  = static_cast<int>(attribs.get(EGL_IOSURFACE_PLANE_ANGLE));
+
+    EGLAttrib internalFormat = attribs.get(EGL_TEXTURE_INTERNAL_FORMAT_ANGLE);
+    EGLAttrib type           = attribs.get(EGL_TEXTURE_TYPE_ANGLE);
+    mFormatIndex =
+        FindIOSurfaceFormatIndex(static_cast<GLenum>(internalFormat), static_cast<GLenum>(type));
+    ASSERT(mFormatIndex >= 0);
+
+    mAlphaInitialized = !hasEmulatedAlphaChannel();
+}
+
+IOSurfaceSurfaceCGL::~IOSurfaceSurfaceCGL()
+{
+    if (mIOSurface != nullptr)
+    {
+        CFRelease(mIOSurface);
+        mIOSurface = nullptr;
+    }
+}
+
+egl::Error IOSurfaceSurfaceCGL::initialize(const egl::Display *display)
+{
+    return egl::NoError();
+}
+
+egl::Error IOSurfaceSurfaceCGL::makeCurrent(const gl::Context *context)
+{
+    return egl::NoError();
+}
+
+egl::Error IOSurfaceSurfaceCGL::unMakeCurrent(const gl::Context *context)
+{
+    GetFunctionsGL(context)->flush();
+    return egl::NoError();
+}
+
+egl::Error IOSurfaceSurfaceCGL::swap(const gl::Context *context)
+{
+    return egl::NoError();
+}
+
+egl::Error IOSurfaceSurfaceCGL::postSubBuffer(const gl::Context *context,
+                                              EGLint x,
+                                              EGLint y,
+                                              EGLint width,
+                                              EGLint height)
+{
+    UNREACHABLE();
+    return egl::NoError();
+}
+
+egl::Error IOSurfaceSurfaceCGL::querySurfacePointerANGLE(EGLint attribute, void **value)
+{
+    UNREACHABLE();
+    return egl::NoError();
+}
+
+egl::Error IOSurfaceSurfaceCGL::bindTexImage(const gl::Context *context,
+                                             gl::Texture *texture,
+                                             EGLint buffer)
+{
+    StateManagerGL *stateManager = GetStateManagerGL(context);
+
+    const TextureGL *textureGL = GetImplAs<TextureGL>(texture);
+    GLuint textureID           = textureGL->getTextureID();
+    stateManager->bindTexture(gl::TextureType::Rectangle, textureID);
+
+    const auto &format = kIOSurfaceFormats[mFormatIndex];
+    CGLError error = CGLTexImageIOSurface2D(mCGLContext, GL_TEXTURE_RECTANGLE, format.nativeFormat,
+                                            mWidth, mHeight, format.nativeInternalFormat,
+                                            format.nativeType, mIOSurface, mPlane);
+
+    if (error != kCGLNoError)
+    {
+        return egl::EglContextLost() << "CGLTexImageIOSurface2D failed: " << CGLErrorString(error);
+    }
+
+    if (IsError(initializeAlphaChannel(context, textureID)))
+    {
+        return egl::EglContextLost() << "Failed to initialize IOSurface alpha channel.";
+    }
+
+    return egl::NoError();
+}
+
+egl::Error IOSurfaceSurfaceCGL::releaseTexImage(const gl::Context *context, EGLint buffer)
+{
+    const FunctionsGL *functions = GetFunctionsGL(context);
+    functions->flush();
+    return egl::NoError();
+}
+
+void IOSurfaceSurfaceCGL::setSwapInterval(EGLint interval)
+{
+    UNREACHABLE();
+}
+
+EGLint IOSurfaceSurfaceCGL::getWidth() const
+{
+    return mWidth;
+}
+
+EGLint IOSurfaceSurfaceCGL::getHeight() const
+{
+    return mHeight;
+}
+
+EGLint IOSurfaceSurfaceCGL::isPostSubBufferSupported() const
+{
+    UNREACHABLE();
+    return EGL_FALSE;
+}
+
+EGLint IOSurfaceSurfaceCGL::getSwapBehavior() const
+{
+    // N/A because you can't MakeCurrent an IOSurface, return any valid value.
+    return EGL_BUFFER_PRESERVED;
+}
+
+// static
+bool IOSurfaceSurfaceCGL::validateAttributes(EGLClientBuffer buffer,
+                                             const egl::AttributeMap &attribs)
+{
+    IOSurfaceRef ioSurface = reinterpret_cast<IOSurfaceRef>(buffer);
+
+    // The plane must exist for this IOSurface. IOSurfaceGetPlaneCount can return 0 for non-planar
+    // ioSurfaces but we will treat non-planar like it is a single plane.
+    size_t surfacePlaneCount = std::max(size_t(1), IOSurfaceGetPlaneCount(ioSurface));
+    EGLAttrib plane          = attribs.get(EGL_IOSURFACE_PLANE_ANGLE);
+    if (plane < 0 || static_cast<size_t>(plane) >= surfacePlaneCount)
+    {
+        return false;
+    }
+
+    // The width height specified must be at least (1, 1) and at most the plane size
+    EGLAttrib width  = attribs.get(EGL_WIDTH);
+    EGLAttrib height = attribs.get(EGL_HEIGHT);
+    if (width <= 0 || static_cast<size_t>(width) > IOSurfaceGetWidthOfPlane(ioSurface, plane) ||
+        height <= 0 || static_cast<size_t>(height) > IOSurfaceGetHeightOfPlane(ioSurface, plane))
+    {
+        return false;
+    }
+
+    // Find this IOSurface format
+    EGLAttrib internalFormat = attribs.get(EGL_TEXTURE_INTERNAL_FORMAT_ANGLE);
+    EGLAttrib type           = attribs.get(EGL_TEXTURE_TYPE_ANGLE);
+
+    int formatIndex =
+        FindIOSurfaceFormatIndex(static_cast<GLenum>(internalFormat), static_cast<GLenum>(type));
+
+    if (formatIndex < 0)
+    {
+        return false;
+    }
+
+    // Check that the format matches this IOSurface plane
+    if (IOSurfaceGetBytesPerElementOfPlane(ioSurface, plane) !=
+        kIOSurfaceFormats[formatIndex].componentBytes)
+    {
+        return false;
+    }
+
+    return true;
+}
+
+// Wraps a FramebufferGL to hook the destroy function to delete the texture associated with the
+// framebuffer.
+class IOSurfaceFramebuffer : public FramebufferGL
+{
+  public:
+    IOSurfaceFramebuffer(const gl::FramebufferState &data,
+                         GLuint id,
+                         GLuint textureId,
+                         bool isDefault,
+                         bool emulatedAlpha)
+        : FramebufferGL(data, id, isDefault, emulatedAlpha), mTextureId(textureId)
+    {}
+    void destroy(const gl::Context *context) override
+    {
+        GetFunctionsGL(context)->deleteTextures(1, &mTextureId);
+        FramebufferGL::destroy(context);
+    }
+
+  private:
+    GLuint mTextureId;
+};
+
+FramebufferImpl *IOSurfaceSurfaceCGL::createDefaultFramebuffer(const gl::Context *context,
+                                                               const gl::FramebufferState &state)
+{
+    const FunctionsGL *functions = GetFunctionsGL(context);
+    StateManagerGL *stateManager = GetStateManagerGL(context);
+
+    GLuint texture = 0;
+    functions->genTextures(1, &texture);
+    const auto &format = kIOSurfaceFormats[mFormatIndex];
+    stateManager->bindTexture(gl::TextureType::Rectangle, texture);
+    CGLError error = CGLTexImageIOSurface2D(mCGLContext, GL_TEXTURE_RECTANGLE, format.nativeFormat,
+                                            mWidth, mHeight, format.nativeInternalFormat,
+                                            format.nativeType, mIOSurface, mPlane);
+    if (error != kCGLNoError)
+    {
+        ERR() << "CGLTexImageIOSurface2D failed: " << CGLErrorString(error);
+    }
+    ASSERT(error == kCGLNoError);
+
+    if (IsError(initializeAlphaChannel(context, texture)))
+    {
+        ERR() << "Failed to initialize IOSurface alpha channel.";
+    }
+
+    GLuint framebuffer = 0;
+    functions->genFramebuffers(1, &framebuffer);
+    stateManager->bindFramebuffer(GL_FRAMEBUFFER, framebuffer);
+    stateManager->bindTexture(gl::TextureType::Rectangle, texture);
+    functions->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE,
+                                    texture, 0);
+
+    return new IOSurfaceFramebuffer(state, framebuffer, texture, true, hasEmulatedAlphaChannel());
+}
+
+angle::Result IOSurfaceSurfaceCGL::initializeAlphaChannel(const gl::Context *context,
+                                                          GLuint texture)
+{
+    if (mAlphaInitialized)
+    {
+        return angle::Result::Continue;
+    }
+
+    BlitGL *blitter = GetBlitGL(context);
+    ANGLE_TRY(blitter->clearRenderableTextureAlphaToOne(context, texture,
+                                                        gl::TextureTarget::Rectangle, 0));
+    mAlphaInitialized = true;
+    return angle::Result::Continue;
+}
+
+bool IOSurfaceSurfaceCGL::hasEmulatedAlphaChannel() const
+{
+    const auto &format = kIOSurfaceFormats[mFormatIndex];
+    return format.internalFormat == GL_RGB;
+}
+
+}  // namespace rx
+
+#endif  // TARGET_OS_OSX
+#endif  // __APPLE__

Property changes: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp


Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Author Id Revision HeadURL \ No newline at end of property

Deleted: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.mm (251509 => 251510)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.mm	2019-10-23 23:25:31 UTC (rev 251509)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.mm	2019-10-23 23:37:35 UTC (rev 251510)
@@ -1,336 +0,0 @@
-//
-// Copyright 2015 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// PBufferSurfaceCGL.cpp: an implementation of PBuffers created from IOSurfaces using
-//                        EGL_ANGLE_iosurface_client_buffer
-
-#if __has_include(<Cocoa/Cocoa.h>)
-
-#    include "libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.h"
-
-#    import <Cocoa/Cocoa.h>
-#    include <IOSurface/IOSurface.h>
-#    include <OpenGL/CGLIOSurface.h>
-
-#    include "common/debug.h"
-#    include "libANGLE/AttributeMap.h"
-#    include "libANGLE/renderer/gl/BlitGL.h"
-#    include "libANGLE/renderer/gl/FramebufferGL.h"
-#    include "libANGLE/renderer/gl/FunctionsGL.h"
-#    include "libANGLE/renderer/gl/RendererGL.h"
-#    include "libANGLE/renderer/gl/StateManagerGL.h"
-#    include "libANGLE/renderer/gl/TextureGL.h"
-#    include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
-
-namespace rx
-{
-
-namespace
-{
-
-struct IOSurfaceFormatInfo
-{
-    GLenum internalFormat;
-    GLenum type;
-
-    size_t componentBytes;
-
-    GLenum nativeInternalFormat;
-    GLenum nativeFormat;
-    GLenum nativeType;
-};
-
-// clang-format off
-static const IOSurfaceFormatInfo kIOSurfaceFormats[] = {
-    {GL_RED,      GL_UNSIGNED_BYTE,  1, GL_RED,  GL_RED,  GL_UNSIGNED_BYTE           },
-    {GL_R16UI,    GL_UNSIGNED_SHORT, 2, GL_RED,  GL_RED,  GL_UNSIGNED_SHORT          },
-    {GL_RG,       GL_UNSIGNED_BYTE,  2, GL_RG,   GL_RG,   GL_UNSIGNED_BYTE           },
-    {GL_RGB,      GL_UNSIGNED_BYTE,  4, GL_BGRA, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV},
-    {GL_BGRA_EXT, GL_UNSIGNED_BYTE,  4, GL_BGRA, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV},
-    {GL_RGBA,     GL_HALF_FLOAT,     8, GL_RGBA, GL_RGBA, GL_HALF_FLOAT              },
-};
-// clang-format on
-
-int FindIOSurfaceFormatIndex(GLenum internalFormat, GLenum type)
-{
-    for (int i = 0; i < static_cast<int>(ArraySize(kIOSurfaceFormats)); ++i)
-    {
-        const auto &formatInfo = kIOSurfaceFormats[i];
-        if (formatInfo.internalFormat == internalFormat && formatInfo.type == type)
-        {
-            return i;
-        }
-    }
-    return -1;
-}
-
-}  // anonymous namespace
-
-IOSurfaceSurfaceCGL::IOSurfaceSurfaceCGL(const egl::SurfaceState &state,
-                                         CGLContextObj cglContext,
-                                         EGLClientBuffer buffer,
-                                         const egl::AttributeMap &attribs)
-    : SurfaceGL(state),
-      mCGLContext(cglContext),
-      mIOSurface(nullptr),
-      mWidth(0),
-      mHeight(0),
-      mPlane(0),
-      mFormatIndex(-1),
-      mAlphaInitialized(false)
-{
-    // Keep reference to the IOSurface so it doesn't get deleted while the pbuffer exists.
-    mIOSurface = reinterpret_cast<IOSurfaceRef>(buffer);
-    CFRetain(mIOSurface);
-
-    // Extract attribs useful for the call to CGLTexImageIOSurface2D
-    mWidth  = static_cast<int>(attribs.get(EGL_WIDTH));
-    mHeight = static_cast<int>(attribs.get(EGL_HEIGHT));
-    mPlane  = static_cast<int>(attribs.get(EGL_IOSURFACE_PLANE_ANGLE));
-
-    EGLAttrib internalFormat = attribs.get(EGL_TEXTURE_INTERNAL_FORMAT_ANGLE);
-    EGLAttrib type           = attribs.get(EGL_TEXTURE_TYPE_ANGLE);
-    mFormatIndex =
-        FindIOSurfaceFormatIndex(static_cast<GLenum>(internalFormat), static_cast<GLenum>(type));
-    ASSERT(mFormatIndex >= 0);
-
-    mAlphaInitialized = !hasEmulatedAlphaChannel();
-}
-
-IOSurfaceSurfaceCGL::~IOSurfaceSurfaceCGL()
-{
-    if (mIOSurface != nullptr)
-    {
-        CFRelease(mIOSurface);
-        mIOSurface = nullptr;
-    }
-}
-
-egl::Error IOSurfaceSurfaceCGL::initialize(const egl::Display *display)
-{
-    return egl::NoError();
-}
-
-egl::Error IOSurfaceSurfaceCGL::makeCurrent(const gl::Context *context)
-{
-    return egl::NoError();
-}
-
-egl::Error IOSurfaceSurfaceCGL::unMakeCurrent(const gl::Context *context)
-{
-    GetFunctionsGL(context)->flush();
-    return egl::NoError();
-}
-
-egl::Error IOSurfaceSurfaceCGL::swap(const gl::Context *context)
-{
-    return egl::NoError();
-}
-
-egl::Error IOSurfaceSurfaceCGL::postSubBuffer(const gl::Context *context,
-                                              EGLint x,
-                                              EGLint y,
-                                              EGLint width,
-                                              EGLint height)
-{
-    UNREACHABLE();
-    return egl::NoError();
-}
-
-egl::Error IOSurfaceSurfaceCGL::querySurfacePointerANGLE(EGLint attribute, void **value)
-{
-    UNREACHABLE();
-    return egl::NoError();
-}
-
-egl::Error IOSurfaceSurfaceCGL::bindTexImage(const gl::Context *context,
-                                             gl::Texture *texture,
-                                             EGLint buffer)
-{
-    StateManagerGL *stateManager = GetStateManagerGL(context);
-
-    const TextureGL *textureGL = GetImplAs<TextureGL>(texture);
-    GLuint textureID           = textureGL->getTextureID();
-    stateManager->bindTexture(gl::TextureType::Rectangle, textureID);
-
-    const auto &format = kIOSurfaceFormats[mFormatIndex];
-    CGLError error = CGLTexImageIOSurface2D(mCGLContext, GL_TEXTURE_RECTANGLE, format.nativeFormat,
-                                            mWidth, mHeight, format.nativeInternalFormat,
-                                            format.nativeType, mIOSurface, mPlane);
-
-    if (error != kCGLNoError)
-    {
-        return egl::EglContextLost() << "CGLTexImageIOSurface2D failed: " << CGLErrorString(error);
-    }
-
-    if (IsError(initializeAlphaChannel(context, textureID)))
-    {
-        return egl::EglContextLost() << "Failed to initialize IOSurface alpha channel.";
-    }
-
-    return egl::NoError();
-}
-
-egl::Error IOSurfaceSurfaceCGL::releaseTexImage(const gl::Context *context, EGLint buffer)
-{
-    const FunctionsGL *functions = GetFunctionsGL(context);
-    functions->flush();
-    return egl::NoError();
-}
-
-void IOSurfaceSurfaceCGL::setSwapInterval(EGLint interval)
-{
-    UNREACHABLE();
-}
-
-EGLint IOSurfaceSurfaceCGL::getWidth() const
-{
-    return mWidth;
-}
-
-EGLint IOSurfaceSurfaceCGL::getHeight() const
-{
-    return mHeight;
-}
-
-EGLint IOSurfaceSurfaceCGL::isPostSubBufferSupported() const
-{
-    UNREACHABLE();
-    return EGL_FALSE;
-}
-
-EGLint IOSurfaceSurfaceCGL::getSwapBehavior() const
-{
-    // N/A because you can't MakeCurrent an IOSurface, return any valid value.
-    return EGL_BUFFER_PRESERVED;
-}
-
-// static
-bool IOSurfaceSurfaceCGL::validateAttributes(EGLClientBuffer buffer,
-                                             const egl::AttributeMap &attribs)
-{
-    IOSurfaceRef ioSurface = reinterpret_cast<IOSurfaceRef>(buffer);
-
-    // The plane must exist for this IOSurface. IOSurfaceGetPlaneCount can return 0 for non-planar
-    // ioSurfaces but we will treat non-planar like it is a single plane.
-    size_t surfacePlaneCount = std::max(size_t(1), IOSurfaceGetPlaneCount(ioSurface));
-    EGLAttrib plane          = attribs.get(EGL_IOSURFACE_PLANE_ANGLE);
-    if (plane < 0 || static_cast<size_t>(plane) >= surfacePlaneCount)
-    {
-        return false;
-    }
-
-    // The width height specified must be at least (1, 1) and at most the plane size
-    EGLAttrib width  = attribs.get(EGL_WIDTH);
-    EGLAttrib height = attribs.get(EGL_HEIGHT);
-    if (width <= 0 || static_cast<size_t>(width) > IOSurfaceGetWidthOfPlane(ioSurface, plane) ||
-        height <= 0 || static_cast<size_t>(height) > IOSurfaceGetHeightOfPlane(ioSurface, plane))
-    {
-        return false;
-    }
-
-    // Find this IOSurface format
-    EGLAttrib internalFormat = attribs.get(EGL_TEXTURE_INTERNAL_FORMAT_ANGLE);
-    EGLAttrib type           = attribs.get(EGL_TEXTURE_TYPE_ANGLE);
-
-    int formatIndex =
-        FindIOSurfaceFormatIndex(static_cast<GLenum>(internalFormat), static_cast<GLenum>(type));
-
-    if (formatIndex < 0)
-    {
-        return false;
-    }
-
-    // Check that the format matches this IOSurface plane
-    if (IOSurfaceGetBytesPerElementOfPlane(ioSurface, plane) !=
-        kIOSurfaceFormats[formatIndex].componentBytes)
-    {
-        return false;
-    }
-
-    return true;
-}
-
-// Wraps a FramebufferGL to hook the destroy function to delete the texture associated with the
-// framebuffer.
-class IOSurfaceFramebuffer : public FramebufferGL
-{
-  public:
-    IOSurfaceFramebuffer(const gl::FramebufferState &data,
-                         GLuint id,
-                         GLuint textureId,
-                         bool isDefault,
-                         bool emulatedAlpha)
-        : FramebufferGL(data, id, isDefault, emulatedAlpha), mTextureId(textureId)
-    {}
-    void destroy(const gl::Context *context) override
-    {
-        GetFunctionsGL(context)->deleteTextures(1, &mTextureId);
-        FramebufferGL::destroy(context);
-    }
-
-  private:
-    GLuint mTextureId;
-};
-
-FramebufferImpl *IOSurfaceSurfaceCGL::createDefaultFramebuffer(const gl::Context *context,
-                                                               const gl::FramebufferState &state)
-{
-    const FunctionsGL *functions = GetFunctionsGL(context);
-    StateManagerGL *stateManager = GetStateManagerGL(context);
-
-    GLuint texture = 0;
-    functions->genTextures(1, &texture);
-    const auto &format = kIOSurfaceFormats[mFormatIndex];
-    stateManager->bindTexture(gl::TextureType::Rectangle, texture);
-    CGLError error = CGLTexImageIOSurface2D(mCGLContext, GL_TEXTURE_RECTANGLE, format.nativeFormat,
-                                            mWidth, mHeight, format.nativeInternalFormat,
-                                            format.nativeType, mIOSurface, mPlane);
-    if (error != kCGLNoError)
-    {
-        ERR() << "CGLTexImageIOSurface2D failed: " << CGLErrorString(error);
-    }
-    ASSERT(error == kCGLNoError);
-
-    if (IsError(initializeAlphaChannel(context, texture)))
-    {
-        ERR() << "Failed to initialize IOSurface alpha channel.";
-    }
-
-    GLuint framebuffer = 0;
-    functions->genFramebuffers(1, &framebuffer);
-    stateManager->bindFramebuffer(GL_FRAMEBUFFER, framebuffer);
-    stateManager->bindTexture(gl::TextureType::Rectangle, texture);
-    functions->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE,
-                                    texture, 0);
-
-    return new IOSurfaceFramebuffer(state, framebuffer, texture, true, hasEmulatedAlphaChannel());
-}
-
-angle::Result IOSurfaceSurfaceCGL::initializeAlphaChannel(const gl::Context *context,
-                                                          GLuint texture)
-{
-    if (mAlphaInitialized)
-    {
-        return angle::Result::Continue;
-    }
-
-    BlitGL *blitter = GetBlitGL(context);
-    ANGLE_TRY(blitter->clearRenderableTextureAlphaToOne(context, texture,
-                                                        gl::TextureTarget::Rectangle, 0));
-    mAlphaInitialized = true;
-    return angle::Result::Continue;
-}
-
-bool IOSurfaceSurfaceCGL::hasEmulatedAlphaChannel() const
-{
-    const auto &format = kIOSurfaceFormats[mFormatIndex];
-    return format.internalFormat == GL_RGB;
-}
-
-}  // namespace rx
-
-#endif  // __has_include(<Cocoa/Cocoa.h>)

Copied: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.cpp (from rev 251509, trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.mm) (0 => 251510)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.cpp	                        (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.cpp	2019-10-23 23:37:35 UTC (rev 251510)
@@ -0,0 +1,150 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// PBufferSurfaceCGL.cpp: an implementation of egl::Surface for PBuffers for the CLG backend,
+//                      currently implemented using renderbuffers
+
+#if defined(__APPLE__)
+#include <TargetConditionals.h>
+#if TARGET_OS_OSX
+
+#include "libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h"
+
+#include "common/debug.h"
+#include "libANGLE/renderer/gl/FunctionsGL.h"
+#include "libANGLE/renderer/gl/FramebufferGL.h"
+#include "libANGLE/renderer/gl/RendererGL.h"
+#include "libANGLE/renderer/gl/StateManagerGL.h"
+
+namespace rx
+{
+
+PbufferSurfaceCGL::PbufferSurfaceCGL(const egl::SurfaceState &state,
+                                     RendererGL *renderer,
+                                     EGLint width,
+                                     EGLint height)
+    : SurfaceGL(state),
+      mWidth(width),
+      mHeight(height),
+      mFunctions(renderer->getFunctions()),
+      mStateManager(renderer->getStateManager()),
+      mColorRenderbuffer(0),
+      mDSRenderbuffer(0)
+{
+}
+
+PbufferSurfaceCGL::~PbufferSurfaceCGL()
+{
+    if (mColorRenderbuffer != 0)
+    {
+        mFunctions->deleteRenderbuffers(1, &mColorRenderbuffer);
+        mColorRenderbuffer = 0;
+    }
+    if (mDSRenderbuffer != 0)
+    {
+        mFunctions->deleteRenderbuffers(1, &mDSRenderbuffer);
+        mDSRenderbuffer = 0;
+    }
+}
+
+egl::Error PbufferSurfaceCGL::initialize(const egl::Display *display)
+{
+    mFunctions->genRenderbuffers(1, &mColorRenderbuffer);
+    mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mColorRenderbuffer);
+    mFunctions->renderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, mWidth, mHeight);
+
+    mFunctions->genRenderbuffers(1, &mDSRenderbuffer);
+    mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mDSRenderbuffer);
+    mFunctions->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, mWidth, mHeight);
+
+    return egl::NoError();
+}
+
+egl::Error PbufferSurfaceCGL::makeCurrent(const gl::Context *context)
+{
+    return egl::NoError();
+}
+
+egl::Error PbufferSurfaceCGL::swap(const gl::Context *context)
+{
+    return egl::NoError();
+}
+
+egl::Error PbufferSurfaceCGL::postSubBuffer(const gl::Context *context,
+                                            EGLint x,
+                                            EGLint y,
+                                            EGLint width,
+                                            EGLint height)
+{
+    return egl::NoError();
+}
+
+egl::Error PbufferSurfaceCGL::querySurfacePointerANGLE(EGLint attribute, void **value)
+{
+    UNIMPLEMENTED();
+    return egl::NoError();
+}
+
+egl::Error PbufferSurfaceCGL::bindTexImage(const gl::Context *context,
+                                           gl::Texture *texture,
+                                           EGLint buffer)
+{
+    UNIMPLEMENTED();
+    return egl::NoError();
+}
+
+egl::Error PbufferSurfaceCGL::releaseTexImage(const gl::Context *context, EGLint buffer)
+{
+    UNIMPLEMENTED();
+    return egl::NoError();
+}
+
+void PbufferSurfaceCGL::setSwapInterval(EGLint interval)
+{
+}
+
+EGLint PbufferSurfaceCGL::getWidth() const
+{
+    return mWidth;
+}
+
+EGLint PbufferSurfaceCGL::getHeight() const
+{
+    return mHeight;
+}
+
+EGLint PbufferSurfaceCGL::isPostSubBufferSupported() const
+{
+    UNIMPLEMENTED();
+    return EGL_FALSE;
+}
+
+EGLint PbufferSurfaceCGL::getSwapBehavior() const
+{
+    return EGL_BUFFER_PRESERVED;
+}
+
+FramebufferImpl *PbufferSurfaceCGL::createDefaultFramebuffer(const gl::Context *context,
+                                                             const gl::FramebufferState &state)
+{
+    const FunctionsGL *functions = GetFunctionsGL(context);
+    StateManagerGL *stateManager = GetStateManagerGL(context);
+
+    GLuint framebuffer = 0;
+    functions->genFramebuffers(1, &framebuffer);
+    stateManager->bindFramebuffer(GL_FRAMEBUFFER, framebuffer);
+    functions->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,
+                                       mColorRenderbuffer);
+    functions->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER,
+                                       mDSRenderbuffer);
+
+    return new FramebufferGL(state, framebuffer, true, false);
+}
+
+}  // namespace rx
+
+#endif  // TARGET_OS_OSX
+#endif  // __APPLE__

Property changes: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.cpp


Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Author Id Revision HeadURL \ No newline at end of property

Deleted: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.mm (251509 => 251510)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.mm	2019-10-23 23:25:31 UTC (rev 251509)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.mm	2019-10-23 23:37:35 UTC (rev 251510)
@@ -1,143 +0,0 @@
-//
-// Copyright 2015 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// PBufferSurfaceCGL.cpp: an implementation of egl::Surface for PBuffers for the CLG backend,
-//                      currently implemented using renderbuffers
-
-#include "libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h"
-
-#include "common/debug.h"
-#include "libANGLE/renderer/gl/FunctionsGL.h"
-#include "libANGLE/renderer/gl/FramebufferGL.h"
-#include "libANGLE/renderer/gl/RendererGL.h"
-#include "libANGLE/renderer/gl/StateManagerGL.h"
-
-namespace rx
-{
-
-PbufferSurfaceCGL::PbufferSurfaceCGL(const egl::SurfaceState &state,
-                                     RendererGL *renderer,
-                                     EGLint width,
-                                     EGLint height)
-    : SurfaceGL(state),
-      mWidth(width),
-      mHeight(height),
-      mFunctions(renderer->getFunctions()),
-      mStateManager(renderer->getStateManager()),
-      mColorRenderbuffer(0),
-      mDSRenderbuffer(0)
-{
-}
-
-PbufferSurfaceCGL::~PbufferSurfaceCGL()
-{
-    if (mColorRenderbuffer != 0)
-    {
-        mFunctions->deleteRenderbuffers(1, &mColorRenderbuffer);
-        mColorRenderbuffer = 0;
-    }
-    if (mDSRenderbuffer != 0)
-    {
-        mFunctions->deleteRenderbuffers(1, &mDSRenderbuffer);
-        mDSRenderbuffer = 0;
-    }
-}
-
-egl::Error PbufferSurfaceCGL::initialize(const egl::Display *display)
-{
-    mFunctions->genRenderbuffers(1, &mColorRenderbuffer);
-    mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mColorRenderbuffer);
-    mFunctions->renderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, mWidth, mHeight);
-
-    mFunctions->genRenderbuffers(1, &mDSRenderbuffer);
-    mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mDSRenderbuffer);
-    mFunctions->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, mWidth, mHeight);
-
-    return egl::NoError();
-}
-
-egl::Error PbufferSurfaceCGL::makeCurrent(const gl::Context *context)
-{
-    return egl::NoError();
-}
-
-egl::Error PbufferSurfaceCGL::swap(const gl::Context *context)
-{
-    return egl::NoError();
-}
-
-egl::Error PbufferSurfaceCGL::postSubBuffer(const gl::Context *context,
-                                            EGLint x,
-                                            EGLint y,
-                                            EGLint width,
-                                            EGLint height)
-{
-    return egl::NoError();
-}
-
-egl::Error PbufferSurfaceCGL::querySurfacePointerANGLE(EGLint attribute, void **value)
-{
-    UNIMPLEMENTED();
-    return egl::NoError();
-}
-
-egl::Error PbufferSurfaceCGL::bindTexImage(const gl::Context *context,
-                                           gl::Texture *texture,
-                                           EGLint buffer)
-{
-    UNIMPLEMENTED();
-    return egl::NoError();
-}
-
-egl::Error PbufferSurfaceCGL::releaseTexImage(const gl::Context *context, EGLint buffer)
-{
-    UNIMPLEMENTED();
-    return egl::NoError();
-}
-
-void PbufferSurfaceCGL::setSwapInterval(EGLint interval)
-{
-}
-
-EGLint PbufferSurfaceCGL::getWidth() const
-{
-    return mWidth;
-}
-
-EGLint PbufferSurfaceCGL::getHeight() const
-{
-    return mHeight;
-}
-
-EGLint PbufferSurfaceCGL::isPostSubBufferSupported() const
-{
-    UNIMPLEMENTED();
-    return EGL_FALSE;
-}
-
-EGLint PbufferSurfaceCGL::getSwapBehavior() const
-{
-    return EGL_BUFFER_PRESERVED;
-}
-
-FramebufferImpl *PbufferSurfaceCGL::createDefaultFramebuffer(const gl::Context *context,
-                                                             const gl::FramebufferState &state)
-{
-    const FunctionsGL *functions = GetFunctionsGL(context);
-    StateManagerGL *stateManager = GetStateManagerGL(context);
-
-    GLuint framebuffer = 0;
-    functions->genFramebuffers(1, &framebuffer);
-    stateManager->bindFramebuffer(GL_FRAMEBUFFER, framebuffer);
-    functions->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,
-                                       mColorRenderbuffer);
-    functions->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER,
-                                       mDSRenderbuffer);
-
-    return new FramebufferGL(state, framebuffer, true, false);
-}
-
-}  // namespace rx

Copied: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/RendererCGL.cpp (from rev 251509, trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/RendererCGL.mm) (0 => 251510)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/RendererCGL.cpp	                        (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/RendererCGL.cpp	2019-10-23 23:37:35 UTC (rev 251510)
@@ -0,0 +1,35 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RendererCGL.mm: Implements the class methods for RendererCGL.
+
+#if defined(__APPLE__)
+#include <TargetConditionals.h>
+#if TARGET_OS_OSX
+
+#include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
+#include "libANGLE/renderer/gl/cgl/RendererCGL.h"
+
+namespace rx
+{
+
+RendererCGL::RendererCGL(std::unique_ptr<FunctionsGL> functions,
+                         const egl::AttributeMap &attribMap,
+                         DisplayCGL *display)
+    : RendererGL(std::move(functions), attribMap, display), mDisplay(display)
+{}
+
+RendererCGL::~RendererCGL() {}
+
+WorkerContext *RendererCGL::createWorkerContext(std::string *infoLog)
+{
+    return mDisplay->createWorkerContext(infoLog);
+}
+
+}  // namespace rx
+
+#endif  // TARGET_OS_OSX
+#endif  // __APPLE__

Property changes: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/RendererCGL.cpp


Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Author Id Revision HeadURL \ No newline at end of property

Deleted: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/RendererCGL.mm (251509 => 251510)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/RendererCGL.mm	2019-10-23 23:25:31 UTC (rev 251509)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/RendererCGL.mm	2019-10-23 23:37:35 UTC (rev 251510)
@@ -1,29 +0,0 @@
-//
-// Copyright 2019 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// RendererCGL.mm: Implements the class methods for RendererCGL.
-
-#include "libANGLE/renderer/gl/cgl/RendererCGL.h"
-
-#include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
-
-namespace rx
-{
-
-RendererCGL::RendererCGL(std::unique_ptr<FunctionsGL> functions,
-                         const egl::AttributeMap &attribMap,
-                         DisplayCGL *display)
-    : RendererGL(std::move(functions), attribMap, display), mDisplay(display)
-{}
-
-RendererCGL::~RendererCGL() {}
-
-WorkerContext *RendererCGL::createWorkerContext(std::string *infoLog)
-{
-    return mDisplay->createWorkerContext(infoLog);
-}
-
-}  // namespace rx

Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm (251509 => 251510)


--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm	2019-10-23 23:25:31 UTC (rev 251509)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm	2019-10-23 23:37:35 UTC (rev 251510)
@@ -6,20 +6,21 @@
 
 // WindowSurfaceCGL.cpp: CGL implementation of egl::Surface for windows
 
-#if __has_include(<Cocoa/Cocoa.h>)
+#if defined(__APPLE__)
+#include <TargetConditionals.h>
+#if TARGET_OS_OSX
 
-#    include "libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h"
+#import "libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h"
 
-#    import <Cocoa/Cocoa.h>
-#    include <OpenGL/OpenGL.h>
-#    import <QuartzCore/QuartzCore.h>
+#import "common/debug.h"
+#import "libANGLE/Context.h"
+#import "libANGLE/renderer/gl/FramebufferGL.h"
+#import "libANGLE/renderer/gl/RendererGL.h"
+#import "libANGLE/renderer/gl/StateManagerGL.h"
+#import "libANGLE/renderer/gl/cgl/DisplayCGL.h"
 
-#    include "common/debug.h"
-#    include "libANGLE/Context.h"
-#    include "libANGLE/renderer/gl/FramebufferGL.h"
-#    include "libANGLE/renderer/gl/RendererGL.h"
-#    include "libANGLE/renderer/gl/StateManagerGL.h"
-#    include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
+#import <OpenGL/OpenGL.h>
+#import <QuartzCore/QuartzCore.h>
 
 @interface WebSwapLayer : CAOpenGLLayer {
     CGLContextObj mDisplayContext;
@@ -337,4 +338,5 @@
 
 }  // namespace rx
 
-#endif  // __has_include(<Cocoa/Cocoa.h>)
+#endif  // TARGET_OS_OSX
+#endif  // __APPLE__
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to