From 86bc97677d92f24bb66188d24b3606c1c8a186eb Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Mon, 16 Jul 2018 16:55:37 -0500 Subject: [PATCH 1/2] Initial OpenGL deprecation - Only on macOS - Only a subset of the uses are deprecated, see radar://42257568 --- src/OpenGL/CGLContext.cs | 1 + src/OpenGL/CGLEnums.cs | 3 +++ src/OpenGL/CGLPixelFormat.cs | 1 + src/appkit.cs | 5 +---- src/coreanimation.cs | 1 + src/coreimage.cs | 11 ----------- 6 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/OpenGL/CGLContext.cs b/src/OpenGL/CGLContext.cs index 421839338c7c..788b161bbd7e 100644 --- a/src/OpenGL/CGLContext.cs +++ b/src/OpenGL/CGLContext.cs @@ -32,6 +32,7 @@ using Foundation; namespace OpenGL { + [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use Metal.")] public class CGLContext : INativeObject, IDisposable { IntPtr handle; diff --git a/src/OpenGL/CGLEnums.cs b/src/OpenGL/CGLEnums.cs index 6560f32984df..425ee58c2bd8 100644 --- a/src/OpenGL/CGLEnums.cs +++ b/src/OpenGL/CGLEnums.cs @@ -21,9 +21,11 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; +using ObjCRuntime; namespace OpenGL { + [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use Metal.")] public enum CGLErrorCode : uint { NoError = 0, /* no error */ @@ -48,6 +50,7 @@ public enum CGLErrorCode : uint } + [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use Metal.")] public enum CGLPixelFormatAttribute : uint { AllRenderers = 1, diff --git a/src/OpenGL/CGLPixelFormat.cs b/src/OpenGL/CGLPixelFormat.cs index 0eda81349559..febb127749c6 100644 --- a/src/OpenGL/CGLPixelFormat.cs +++ b/src/OpenGL/CGLPixelFormat.cs @@ -32,6 +32,7 @@ using Foundation; namespace OpenGL { + [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use Metal.")] public class CGLPixelFormat : INativeObject, IDisposable { internal IntPtr handle; diff --git a/src/appkit.cs b/src/appkit.cs index e20ff2cd7b41..2dd2f5aa6c39 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -8466,10 +8466,6 @@ interface NSOpenGLPixelFormat : NSCoding { [Export ("initWithData:")] IntPtr Constructor (NSData attribs); - // TODO: wrap the CLContext and take a CLContext here instead. - //[Export ("initWithCGLPixelFormatObj:")] - //IntPtr Constructor (IntPtr cglContextHandle); - [Export ("getValues:forAttribute:forVirtualScreen:")] void GetValue (ref int /* GLint = int32_t */ vals, NSOpenGLPixelFormatAttribute attrib, int /* GLint = int32_t */ screen); @@ -26007,6 +26003,7 @@ interface NSCloudSharingValidation } #endif + [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use Metal.")] [BaseType (typeof(CAOpenGLLayer))] interface NSOpenGLLayer { diff --git a/src/coreanimation.cs b/src/coreanimation.cs index dc985e14b721..5e8bcb768a30 100644 --- a/src/coreanimation.cs +++ b/src/coreanimation.cs @@ -1465,6 +1465,7 @@ interface CAValueFunction : NSSecureCoding { } #if MONOMAC + [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use Metal.")] [BaseType (typeof (CALayer))] interface CAOpenGLLayer { [Export ("layer"), New, Static] diff --git a/src/coreimage.cs b/src/coreimage.cs index bdaa3546f65b..5ad03a98cee7 100644 --- a/src/coreimage.cs +++ b/src/coreimage.cs @@ -204,10 +204,6 @@ interface CIColor : NSSecureCoding, NSCopying { [BaseType (typeof (NSObject))] [DisableDefaultCtor] interface CIContext { - // When we bind OpenGL add these: - //[Export ("contextWithCGLContext:pixelFormat:colorSpace:options:")] - //CIContext ContextWithCGLContextpixelFormatcolorSpaceoptions (CGLContextObj ctx, CGLPixelFormatObj pf, CGColorSpaceRef cs, NSDictionary dict, ); - #if !MONOMAC || XAMCORE_2_0 [iOS (9,0)][Mac (10,11)] [Static] @@ -361,13 +357,6 @@ interface CIContext { [Export ("contextForOfflineGPUAtIndex:")] [Static] CIContext FromOfflineGpu (int gpuIndex); - - // When we bind CGLContext - //+(CIContext *)contextForOfflineGPUAtIndex:(unsigned int)index - // colorSpace:(nullable CGColorSpaceRef)colorSpace - // options:(nullable CI_DICTIONARY(NSString*,id) *)options - // sharedContext:(nullable CGLContextObj)sharedContext NS_AVAILABLE_MAC(10_10); - #endif [iOS (9,0)][Mac (10,11)] From 3f6bee2c55b1b50e94d61be225b8e34117e97d4b Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Thu, 19 Jul 2018 16:26:01 -0500 Subject: [PATCH 2/2] Update deprecation messages --- src/OpenGL/CGLContext.cs | 2 +- src/OpenGL/CGLEnums.cs | 4 ++-- src/OpenGL/CGLPixelFormat.cs | 2 +- src/appkit.cs | 2 +- src/coreanimation.cs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/OpenGL/CGLContext.cs b/src/OpenGL/CGLContext.cs index 788b161bbd7e..0a0c229da499 100644 --- a/src/OpenGL/CGLContext.cs +++ b/src/OpenGL/CGLContext.cs @@ -32,7 +32,7 @@ using Foundation; namespace OpenGL { - [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use Metal.")] + [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use 'Metal' Framework instead.")] public class CGLContext : INativeObject, IDisposable { IntPtr handle; diff --git a/src/OpenGL/CGLEnums.cs b/src/OpenGL/CGLEnums.cs index 425ee58c2bd8..21fca472e521 100644 --- a/src/OpenGL/CGLEnums.cs +++ b/src/OpenGL/CGLEnums.cs @@ -25,7 +25,7 @@ namespace OpenGL { - [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use Metal.")] + [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use 'Metal' Framework instead.")] public enum CGLErrorCode : uint { NoError = 0, /* no error */ @@ -50,7 +50,7 @@ public enum CGLErrorCode : uint } - [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use Metal.")] + [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use 'Metal' Framework instead.")] public enum CGLPixelFormatAttribute : uint { AllRenderers = 1, diff --git a/src/OpenGL/CGLPixelFormat.cs b/src/OpenGL/CGLPixelFormat.cs index febb127749c6..8c6ecca7f7fb 100644 --- a/src/OpenGL/CGLPixelFormat.cs +++ b/src/OpenGL/CGLPixelFormat.cs @@ -32,7 +32,7 @@ using Foundation; namespace OpenGL { - [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use Metal.")] + [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use 'Metal' Framework instead.")] public class CGLPixelFormat : INativeObject, IDisposable { internal IntPtr handle; diff --git a/src/appkit.cs b/src/appkit.cs index 2dd2f5aa6c39..29d4913c635d 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -26003,7 +26003,7 @@ interface NSCloudSharingValidation } #endif - [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use Metal.")] + [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use 'Metal' Framework instead.")] [BaseType (typeof(CAOpenGLLayer))] interface NSOpenGLLayer { diff --git a/src/coreanimation.cs b/src/coreanimation.cs index 5e8bcb768a30..86f600c9e807 100644 --- a/src/coreanimation.cs +++ b/src/coreanimation.cs @@ -1465,7 +1465,7 @@ interface CAValueFunction : NSSecureCoding { } #if MONOMAC - [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use Metal.")] + [Deprecated (PlatformName.MacOSX, 10, 14, message : "Use 'Metal' Framework instead.")] [BaseType (typeof (CALayer))] interface CAOpenGLLayer { [Export ("layer"), New, Static]