Skip to content

MetalFX macOS xcode14.0 beta1

Alex Soto edited this page Jun 7, 2022 · 1 revision

#MetalFX.framework

diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MFXSpatialScalingEffect.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MFXSpatialScalingEffect.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MFXSpatialScalingEffect.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MFXSpatialScalingEffect.h	2022-05-31 15:04:32.000000000 -0400
@@ -0,0 +1,82 @@
+//
+//  MFXSpatialScalingEffect.h
+//  MetalFX
+//
+//  Copyright (c) 2021 Apple Inc. All rights reserved.
+//
+
+#import <Metal/Metal.h>
+
+#define MFXSpatialScalingEffectVersionStart (0x10000)
+
+typedef NS_ENUM(NSUInteger, MFXSpatialScalingEffectVersion) {
+    MFXSpatialScalingEffectVersion_1 = MFXSpatialScalingEffectVersionStart,
+} API_AVAILABLE(macos(13.0), ios(16.0));
+
+typedef NS_ENUM(NSUInteger, MFXSpatialScalingColorProcessingMode) {
+    MFXSpatialScalingColorProcessingMode_Perceptual = 0,      /* This should be used when the input and output textures are already in an sRGB or otherwise perceptual 0-1 encoding. */
+    MFXSpatialScalingColorProcessingMode_Linear = 1,    /* This should be used when the input and output textures will contain light linear data in the 0-1 range. */
+    MFXSpatialScalingColorProcessingMode_HDR = 2,       /* This should be used when the input and output texture will contain light linear data outside the 0-1 range.  In
+                                                       this case a reversible tonemapping operation will be done internally to convert to a 0-1 range. */
+} API_AVAILABLE(macos(13.0), ios(16.0));
+
+// Forward declaration.
+@protocol MFXSpatialScalingEffect;
+
+API_AVAILABLE(macos(13.0), ios(16.0))
+@interface MFXSpatialScalingEffectDescriptor : NSObject
+
+// These properties must be set to the respective Metal pixel formats for each texture that will be used with the scaling effect encoder.
+@property MTLPixelFormat colorTextureFormat;
+@property MTLPixelFormat outputTextureFormat;
+@property NSUInteger inputWidth;
+@property NSUInteger inputHeight;
+@property NSUInteger outputWidth;
+@property NSUInteger outputHeight;
+
+/* The default for colorProcessingMode is MFXSpatialScalingColorProcessingMode_Perceptual */
+@property (nonatomic) MFXSpatialScalingColorProcessingMode colorProcessingMode;
+
+@property enum MFXSpatialScalingEffectVersion version;
+
+// The following method is used to instantiate the effect encoder for a given
+// Metal device.
+- (id <MFXSpatialScalingEffect>)newSpatialScalingEffectWithDevice:(id<MTLDevice>)device;
+
+@end
+
+// This is the object that gets created from the descriptor
+API_AVAILABLE(macos(13.0), ios(16.0))
+@protocol MFXSpatialScalingEffect <NSObject>
+
+// Properties return the minimum required MTLTextureUsage bits required
+@property (nonatomic, readonly) MTLTextureUsage colorTextureUsage;
+@property (nonatomic, readonly) MTLTextureUsage outputTextureUsage;
+
+// Dynamic resolution property
+@property (nonatomic) NSUInteger inputContentWidth;
+@property (nonatomic) NSUInteger inputContentHeight;
+
+// These would be all of the "state" needed that is allowed to change on a frame by
+// frame basis.   We don't care about the textures assigned except that they must
+// match the required MTLTextureUsage flags.
+@property (nonatomic, retain) id<MTLTexture> colorTexture;
+@property (nonatomic, retain) id<MTLTexture> outputTexture;
+
+// Read-only immutable properties of effect
+@property (nonatomic, readonly) MTLPixelFormat colorTextureFormat;
+@property (nonatomic, readonly) MTLPixelFormat outputTextureFormat;
+@property (nonatomic, readonly) NSUInteger inputWidth;
+@property (nonatomic, readonly) NSUInteger inputHeight;
+@property (nonatomic, readonly) NSUInteger outputWidth;
+@property (nonatomic, readonly) NSUInteger outputHeight;
+@property (nonatomic, readonly) MFXSpatialScalingColorProcessingMode colorProcessingMode;
+
+// Property for synchronization when using untracked resources
+@property (nonatomic, retain) id<MTLFence> fence;
+
+// Method to encode the effect to a command buffer
+- (void)encodeToCommandBuffer:(id<MTLCommandBuffer>)commandBuffer;
+
+@end
+
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MFXTemporalScalingEffect.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MFXTemporalScalingEffect.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MFXTemporalScalingEffect.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MFXTemporalScalingEffect.h	2022-05-31 14:53:12.000000000 -0400
@@ -0,0 +1,110 @@
+//
+//  MFXTemporalScalingEffect.h
+//  MetalFX
+//
+//  Copyright (c) 2021-2022 Apple Inc. All rights reserved.
+//
+
+#import <Metal/Metal.h>
+#import <simd/simd.h>
+#import <CoreGraphics/CoreGraphics.h>
+
+#define MFXTemporalScalingEffectVersionStart (0x10000)
+
+typedef NS_ENUM(NSUInteger, MFXTemporalScalingEffectVersion) {
+    MFXTemporalScalingEffectVersion_1 = MFXTemporalScalingEffectVersionStart,
+} API_AVAILABLE(macos(13.0), ios(16.0));
+
+// Forward declaration.
+@protocol MFXTemporalScalingEffect;
+
+API_AVAILABLE(macos(13.0), ios(16.0))
+@interface MFXTemporalScalingEffectDescriptor : NSObject
+
+// These properties must be set to the respective Metal pixel formats for each texture that will be used with the scaling effect encoder.
+@property MTLPixelFormat colorTextureFormat;
+@property MTLPixelFormat depthTextureFormat;
+@property MTLPixelFormat motionTextureFormat;
+@property MTLPixelFormat outputTextureFormat;
+
+@property NSUInteger inputWidth;
+@property NSUInteger inputHeight;
+@property NSUInteger outputWidth;
+@property NSUInteger outputHeight;
+
+// Dynamic Resolution properties
+// Set enableInputContentProperties to NO to indicate not using dynamic resolution
+// Scale value represents output resolution / input content resolution for either
+// width or height dimension. It's assumed that aspect ratio of input/output is
+// always the same. 
+@property BOOL enableInputContentProperties;
+@property float inputContentMinScale;
+@property float inputContentMaxScale;
+
+@property enum MFXTemporalScalingEffectVersion version;
+
+// The following method is used to instantiate the effect encoder for a given
+// Metal device.
+- (id <MFXTemporalScalingEffect>)newTemporalScalingEffectWithDevice:(id<MTLDevice>)device;
+
+@end
+
+// This is the object that gets created from the descriptor
+API_AVAILABLE(macos(13.0), ios(16.0))
+@protocol MFXTemporalScalingEffect <NSObject>
+
+// Properties return the minimum required MTLTextureUsage bits required
+@property (nonatomic, readonly) MTLTextureUsage colorTextureUsage;
+@property (nonatomic, readonly) MTLTextureUsage depthTextureUsage;
+@property (nonatomic, readonly) MTLTextureUsage motionTextureUsage;
+@property (nonatomic, readonly) MTLTextureUsage outputTextureUsage;
+
+// Dynamic Resolution property
+@property (nonatomic) NSUInteger inputContentWidth;
+@property (nonatomic) NSUInteger inputContentHeight;
+
+// These would be all of the "state" needed that is allowed to change on a frame by
+// frame basis.   We don't care about the textures assigned except that they must
+// match the originally specified dimensions and pixel formats.
+@property (nonatomic, retain) id<MTLTexture> colorTexture;
+@property (nonatomic, retain) id<MTLTexture> depthTexture;
+@property (nonatomic, retain) id<MTLTexture> motionTexture;
+@property (nonatomic, retain) id<MTLTexture> outputTexture;
+
+// The jitter offset property indicates the pixel offset to sample in order to
+// return to the frame's reference frame.
+@property (nonatomic) CGPoint jitterOffset;
+
+// Scale factor to be applied to motion vectors to convert to pixel/fragment
+// coordinates in the input data.  The expectation for a 1.0 scale factor is
+// that each pixel's motion vector will point to where that pixel was in the
+// prior frame.  Assuming standard Metal device coordinates (0,0 is upper left
+// in the framebuffer), the motion vectors for an object that moved down and
+// to the right in the framebuffer texture by 10 pixels would be -10,-10.
+@property (nonatomic) CGPoint motionVectorScale;
+
+// Reset.  Set to true when history is invalid (scene cut, etc.)
+@property (nonatomic) BOOL reset;
+
+// Set whether the depth buffer uses reversed depth or not. Defaults to YES.
+@property (nonatomic) BOOL reversedDepth;
+
+// Read-only immutable properties of effect
+@property (nonatomic, readonly) MTLPixelFormat colorTextureFormat;
+@property (nonatomic, readonly) MTLPixelFormat depthTextureFormat;
+@property (nonatomic, readonly) MTLPixelFormat motionTextureFormat;
+@property (nonatomic, readonly) MTLPixelFormat outputTextureFormat;
+@property (nonatomic, readonly) NSUInteger inputWidth;
+@property (nonatomic, readonly) NSUInteger inputHeight;
+@property (nonatomic, readonly) NSUInteger outputWidth;
+@property (nonatomic, readonly) NSUInteger outputHeight;
+@property (nonatomic, readonly) float inputContentMinScale;
+@property (nonatomic, readonly) float inputContentMaxScale;
+
+// Property for synchronization when using untracked resources
+@property (nonatomic, retain) id<MTLFence> fence;
+
+// Method to encode the effect to a command buffer
+- (void)encodeToCommandBuffer:(id<MTLCommandBuffer>)commandBuffer;
+
+@end
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MetalFX.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MetalFX.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MetalFX.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MetalFX.h	2022-05-22 23:27:02.000000000 -0400
@@ -0,0 +1,10 @@
+//
+//  MetalFX.h
+//  Metal
+//
+//  Copyright (c) 2021 Apple Inc. All rights reserved.
+//
+
+#import <MetalFX/MFXTemporalScalingEffect.h>
+#import <MetalFX/MFXSpatialScalingEffect.h>
+
Clone this wiki locally