Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0.1xx] [MetalFX] Add the framework (which was added in Xcode 14) and add xcode 15 support. #19301

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/build/generator-frameworks.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ partial class Frameworks {
"Messages",
"MessageUI",
"Metal",
"MetalFX",
"MetalKit",
"MetalPerformanceShaders",
"MetalPerformanceShadersGraph",
Expand Down Expand Up @@ -219,6 +220,7 @@ partial class Frameworks {
"MediaPlayer",
"MediaToolbox",
"Metal",
"MetalFX",
"MetalKit",
"MetalPerformanceShaders",
"MetalPerformanceShadersGraph",
Expand Down Expand Up @@ -640,6 +642,7 @@ partial class Frameworks {
bool? _Messages;
bool? _MessageUI;
bool? _Metal;
bool? _MetalFX;
bool? _MetalKit;
bool? _MetalPerformanceShaders;
bool? _MetalPerformanceShadersGraph;
Expand Down Expand Up @@ -805,6 +808,7 @@ partial class Frameworks {
public bool HaveMessages { get { if (!_Messages.HasValue) _Messages = GetValue ("Messages"); return _Messages.Value; } }
public bool HaveMessageUI { get { if (!_MessageUI.HasValue) _MessageUI = GetValue ("MessageUI"); return _MessageUI.Value; } }
public bool HaveMetal { get { if (!_Metal.HasValue) _Metal = GetValue ("Metal"); return _Metal.Value; } }
public bool HaveMetalFX { get { if (!_MetalFX.HasValue) _MetalFX = GetValue ("MetalFX"); return _MetalFX.Value; } }
public bool HaveMetalKit { get { if (!_MetalKit.HasValue) _MetalKit = GetValue ("MetalKit"); return _MetalKit.Value; } }
public bool HaveMetalPerformanceShaders { get { if (!_MetalPerformanceShaders.HasValue) _MetalPerformanceShaders = GetValue ("MetalPerformanceShaders"); return _MetalPerformanceShaders.Value; } }
public bool HaveMetalPerformanceShadersGraph { get { if (!_MetalPerformanceShadersGraph.HasValue) _MetalPerformanceShadersGraph = GetValue ("MetalPerformanceShadersGraph"); return _MetalPerformanceShadersGraph.Value; } }
Expand Down
5 changes: 5 additions & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,9 @@ METAL_SOURCES = \
Metal/MTLResourceStatePassSampleBufferAttachmentDescriptorArray.cs \
Metal/MTLVertexDescriptor.cs \

# MetalFX


# MetalKit

METALKIT_SOURCES = \
Expand Down Expand Up @@ -2084,6 +2087,7 @@ MACOS_FRAMEWORKS = \
MediaPlayer \
MediaToolbox \
Metal \
MetalFX \
MetalKit \
MetalPerformanceShaders \
MetalPerformanceShadersGraph \
Expand Down Expand Up @@ -2200,6 +2204,7 @@ IOS_FRAMEWORKS = \
Messages \
MessageUI \
Metal \
MetalFX \
MetalKit \
MetalPerformanceShaders \
MetalPerformanceShadersGraph \
Expand Down
309 changes: 309 additions & 0 deletions src/metalfx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,309 @@
using System;
using System.ComponentModel;

using CoreFoundation;
using Foundation;
using Metal;
using ObjCRuntime;

#if !NET
using NativeHandle = System.IntPtr;
#endif


namespace MetalFX {

[Mac (13, 0), iOS (16, 0), MacCatalyst (16, 0)]
[Native]
public enum MTLFXSpatialScalerColorProcessingMode : long {
Perceptual = 0,
Linear = 1,
Hdr = 2,
}

interface IMTLFXSpatialScaler { }

[Mac (13, 0), iOS (16, 0), MacCatalyst (16, 0)]
[Protocol]
interface MTLFXSpatialScaler {
[Abstract]
[Export ("colorTextureUsage")]
MTLTextureUsage ColorTextureUsage { get; }

[Abstract]
[Export ("outputTextureUsage")]
MTLTextureUsage OutputTextureUsage { get; }

[Abstract]
[Export ("inputContentWidth")]
nuint InputContentWidth { get; set; }

[Abstract]
[Export ("inputContentHeight")]
nuint InputContentHeight { get; set; }

[Abstract]
[NullAllowed, Export ("colorTexture", ArgumentSemantic.Retain)]
IMTLTexture ColorTexture { get; set; }

[Abstract]
[NullAllowed, Export ("outputTexture", ArgumentSemantic.Retain)]
IMTLTexture OutputTexture { get; set; }

[Abstract]
[Export ("colorTextureFormat")]
MTLPixelFormat ColorTextureFormat { get; }

[Abstract]
[Export ("outputTextureFormat")]
MTLPixelFormat OutputTextureFormat { get; }

[Abstract]
[Export ("inputWidth")]
nuint InputWidth { get; }

[Abstract]
[Export ("inputHeight")]
nuint InputHeight { get; }

[Abstract]
[Export ("outputWidth")]
nuint OutputWidth { get; }

[Abstract]
[Export ("outputHeight")]
nuint OutputHeight { get; }

[Abstract]
[Export ("colorProcessingMode")]
MTLFXSpatialScalerColorProcessingMode ColorProcessingMode { get; }

[Abstract]
[NullAllowed, Export ("fence", ArgumentSemantic.Retain)]
IMTLFence Fence { get; set; }

[Abstract]
[Export ("encodeToCommandBuffer:")]
void Encode (IMTLCommandBuffer commandBuffer);
}

interface IMTLFXTemporalScaler { }

[Mac (13, 0), iOS (16, 0)]
[Protocol]
interface MTLFXTemporalScaler {
[Abstract]
[Export ("colorTextureUsage")]
MTLTextureUsage ColorTextureUsage { get; }

[Abstract]
[Export ("depthTextureUsage")]
MTLTextureUsage DepthTextureUsage { get; }

[Abstract]
[Export ("motionTextureUsage")]
MTLTextureUsage MotionTextureUsage { get; }

[Abstract]
[Export ("outputTextureUsage")]
MTLTextureUsage OutputTextureUsage { get; }

[Abstract]
[Export ("inputContentWidth")]
nuint InputContentWidth { get; set; }

[Abstract]
[Export ("inputContentHeight")]
nuint InputContentHeight { get; set; }

[Abstract]
[NullAllowed, Export ("colorTexture", ArgumentSemantic.Retain)]
IMTLTexture ColorTexture { get; set; }

[Abstract]
[NullAllowed, Export ("depthTexture", ArgumentSemantic.Retain)]
IMTLTexture DepthTexture { get; set; }

[Abstract]
[NullAllowed, Export ("motionTexture", ArgumentSemantic.Retain)]
IMTLTexture MotionTexture { get; set; }

[Abstract]
[NullAllowed, Export ("outputTexture", ArgumentSemantic.Retain)]
IMTLTexture OutputTexture { get; set; }

[Abstract]
[NullAllowed, Export ("exposureTexture", ArgumentSemantic.Retain)]
IMTLTexture ExposureTexture { get; set; }

[Abstract]
[Export ("preExposure")]
float PreExposure { get; set; }

[Abstract]
[Export ("jitterOffsetX")]
float JitterOffsetX { get; set; }

[Abstract]
[Export ("jitterOffsetY")]
float JitterOffsetY { get; set; }

[Abstract]
[Export ("motionVectorScaleX")]
float MotionVectorScaleX { get; set; }

[Abstract]
[Export ("motionVectorScaleY")]
float MotionVectorScaleY { get; set; }

[Abstract]
[Export ("reset")]
bool Reset { get; set; }

[Abstract]
[Export ("depthReversed")]
bool DepthReversed { [Bind ("isDepthReversed")] get; set; }

[Abstract]
[Export ("colorTextureFormat")]
MTLPixelFormat ColorTextureFormat { get; }

[Abstract]
[Export ("depthTextureFormat")]
MTLPixelFormat DepthTextureFormat { get; }

[Abstract]
[Export ("motionTextureFormat")]
MTLPixelFormat MotionTextureFormat { get; }

[Abstract]
[Export ("outputTextureFormat")]
MTLPixelFormat OutputTextureFormat { get; }

[Abstract]
[Export ("inputWidth")]
nuint InputWidth { get; }

[Abstract]
[Export ("inputHeight")]
nuint InputHeight { get; }

[Abstract]
[Export ("outputWidth")]
nuint OutputWidth { get; }

[Abstract]
[Export ("outputHeight")]
nuint OutputHeight { get; }

[Abstract]
[Export ("inputContentMinScale")]
float InputContentMinScale { get; }

[Abstract]
[Export ("inputContentMaxScale")]
float InputContentMaxScale { get; }

[Abstract]
[NullAllowed, Export ("fence", ArgumentSemantic.Retain)]
IMTLFence Fence { get; set; }

[Abstract]
[Export ("encodeToCommandBuffer:")]
void Encode (IMTLCommandBuffer commandBuffer);
}

[Mac (13, 0), iOS (16, 0), MacCatalyst (16, 0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface MTLFXSpatialScalerDescriptor {
[Export ("colorTextureFormat", ArgumentSemantic.Assign)]
MTLPixelFormat ColorTextureFormat { get; set; }

[Export ("outputTextureFormat", ArgumentSemantic.Assign)]
MTLPixelFormat OutputTextureFormat { get; set; }

[Export ("inputWidth")]
nuint InputWidth { get; set; }

[Export ("inputHeight")]
nuint InputHeight { get; set; }

[Export ("outputWidth")]
nuint OutputWidth { get; set; }

[Export ("outputHeight")]
nuint OutputHeight { get; set; }

[Export ("colorProcessingMode", ArgumentSemantic.Assign)]
MTLFXSpatialScalerColorProcessingMode ColorProcessingMode { get; set; }

[Export ("newSpatialScalerWithDevice:")]
[return: NullAllowed, Release]
IMTLFXSpatialScaler Create (IMTLDevice device);

[Static]
[Export ("supportsDevice:")]
bool SupportsDevice (IMTLDevice device);
}

[Mac (13, 0), iOS (16, 0), MacCatalyst (16, 0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface MTLFXTemporalScalerDescriptor {
[Export ("colorTextureFormat", ArgumentSemantic.Assign)]
MTLPixelFormat ColorTextureFormat { get; set; }

[Export ("depthTextureFormat", ArgumentSemantic.Assign)]
MTLPixelFormat DepthTextureFormat { get; set; }

[Export ("motionTextureFormat", ArgumentSemantic.Assign)]
MTLPixelFormat MotionTextureFormat { get; set; }

[Export ("outputTextureFormat", ArgumentSemantic.Assign)]
MTLPixelFormat OutputTextureFormat { get; set; }

[Export ("inputWidth")]
nuint InputWidth { get; set; }

[Export ("inputHeight")]
nuint InputHeight { get; set; }

[Export ("outputWidth")]
nuint OutputWidth { get; set; }

[Export ("outputHeight")]
nuint OutputHeight { get; set; }

[Export ("autoExposureEnabled")]
bool AutoExposureEnabled { [Bind ("isAutoExposureEnabled")] get; set; }

[Export ("inputContentPropertiesEnabled")]
bool InputContentPropertiesEnabled { [Bind ("isInputContentPropertiesEnabled")] get; set; }

[Export ("inputContentMinScale")]
float InputContentMinScale { get; set; }

[Export ("inputContentMaxScale")]
float InputContentMaxScale { get; set; }

[Export ("newTemporalScalerWithDevice:")]
[return: NullAllowed, Release]
IMTLFXTemporalScaler Create (IMTLDevice device);

[Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Static]
[Export ("supportedInputContentMinScaleForDevice:")]
float GetSupportedInputContentMinScale (IMTLDevice device);

[Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Static]
[Export ("supportedInputContentMaxScaleForDevice:")]
float GetSupportedInputContentMaxScale (IMTLDevice device);

[Static]
[Export ("supportsDevice:")]
bool SupportsDevice (IMTLDevice device);
}

}
1 change: 1 addition & 0 deletions src/rsp/dotnet/ios-defines-dotnet.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
-d:HAS_MESSAGES
-d:HAS_MESSAGEUI
-d:HAS_METAL
-d:HAS_METALFX
-d:HAS_METALKIT
-d:HAS_METALPERFORMANCESHADERS
-d:HAS_METALPERFORMANCESHADERSGRAPH
Expand Down
1 change: 1 addition & 0 deletions src/rsp/dotnet/macos-defines-dotnet.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
-d:HAS_MEDIAPLAYER
-d:HAS_MEDIATOOLBOX
-d:HAS_METAL
-d:HAS_METALFX
-d:HAS_METALKIT
-d:HAS_METALPERFORMANCESHADERS
-d:HAS_METALPERFORMANCESHADERSGRAPH
Expand Down
1 change: 1 addition & 0 deletions src/rsp/ios-defines.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
-d:HAS_MESSAGES
-d:HAS_MESSAGEUI
-d:HAS_METAL
-d:HAS_METALFX
-d:HAS_METALKIT
-d:HAS_METALPERFORMANCESHADERS
-d:HAS_METALPERFORMANCESHADERSGRAPH
Expand Down
1 change: 1 addition & 0 deletions src/rsp/macos-defines.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
-d:HAS_MEDIAPLAYER
-d:HAS_MEDIATOOLBOX
-d:HAS_METAL
-d:HAS_METALFX
-d:HAS_METALKIT
-d:HAS_METALPERFORMANCESHADERS
-d:HAS_METALPERFORMANCESHADERSGRAPH
Expand Down
Loading
Loading