Skip to content

MetalFX iOS xcode26.0 b1

Rolf Bjarne Kvinge edited this page Jul 29, 2025 · 3 revisions

#MetalFX.framework https://github.com/dotnet/macios/pull/23426

diff -ruN /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXFrameInterpolator.h /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXFrameInterpolator.h --- /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXFrameInterpolator.h	1969-12-31 19:00:00 +++ /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXFrameInterpolator.h	2025-05-23 06:41:45 @@ -0,0 +1,37 @@ +// +// MTL4FXFrameInterpolator.h +// MetalFX +// +// Copyright (c) 2025 Apple Inc. All rights reserved. +// + +#import <Metal/Metal.h> + + +#import <MetalFX/MTLFXFrameInterpolator.h> + +/// An effect that generates textures by interpolating two input textures. +/// +/// You create instances of this class by calling ``MTLFXFrameInterpolatorDescriptor/newFrameInterpolatorWithDevice:compiler:``. +/// +/// When using instances of objects conforming to this protocol, you configure the different properties it +/// inherits from protocol ``MTLFXFrameInterpolatorBase`` and then call ``encodeToCommandBuffer:`` to +/// encode its work into a Metal command buffer. +/// +/// See ``MTLFXFrameInterpolatorBase`` for more details on configuring and using frame interpolators. +/// +API_AVAILABLE(macos(26.0), ios(26.0)) +#if defined(TARGET_OS_VISION) && TARGET_OS_VISION +API_UNAVAILABLE(visionos) +#endif +@protocol MTL4FXFrameInterpolator <MTLFXFrameInterpolatorBase> + +/// Encode this frame interpolator's work into a command buffer. +/// +/// - Parameters: +/// - commandBuffer: A command buffer into which this frame interpolator encodes work. +/// +- (void)encodeToCommandBuffer:(nonnull id<MTL4CommandBuffer>)commandBuffer; + +@end + diff -ruN /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXSpatialScaler.h /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXSpatialScaler.h --- /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXSpatialScaler.h	1969-12-31 19:00:00 +++ /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXSpatialScaler.h	2025-05-23 06:41:45 @@ -0,0 +1,34 @@ +// +// MTL4FXSpatialScaler.h +// MetalFX +// +// Copyright (c) 2025 Apple Inc. All rights reserved. +// + + +#import <Metal/Metal.h> +#import <Metal/MTL4Compiler.h> +#import <MetalFX/MTLFXSpatialScaler.h> + +/// An upscaling effect that generates a higher resolution texture in a render pass by spatially analyzing an input texture. +/// +/// You create instances of this class by calling ``MTLFXSpatialScalerDescriptor/newSpatialScalerWithDevice:compiler:``. +/// +/// When using instances of objects conforming to this protocol, you configure the different properties it +/// inherits from protocol ``MTLFXSpatialScalerBase`` and then call ``encodeToCommandBuffer:`` to +/// encode its work into a Metal command buffer. +/// +/// See ``MTLFXSpatialScalerBase`` for more details on configuring and using spatial scalers. +/// +API_AVAILABLE(macos(26.0), ios(26.0)) +@protocol MTL4FXSpatialScaler <MTLFXSpatialScalerBase> + +/// Encode this spatial scaler work into a command buffer. +/// +/// - Parameters: +/// - commandBuffer: A command buffer into which this spatial scaler encodes work. +/// +- (void)encodeToCommandBuffer:(nonnull id<MTL4CommandBuffer>)commandBuffer; + +@end + diff -ruN /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXTemporalDenoisedScaler.h /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXTemporalDenoisedScaler.h --- /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXTemporalDenoisedScaler.h	1969-12-31 19:00:00 +++ /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXTemporalDenoisedScaler.h	2025-05-23 06:41:44 @@ -0,0 +1,35 @@ +// +// MTL4FXTemporalDenoiserScaler.h +// MetalFX +// +// Copyright (c) 2025 Apple Inc. All rights reserved. +// + +#import <Metal/Metal.h> +#import <Metal/MTL4Compiler.h> +#import <MetalFX/MTLFXTemporalDenoisedScaler.h> + +/// An upscaling effect that generates a higher resolution texture in a render pass by analyzing multiple input textures +/// over time and removing noise. +/// +/// You create instances of this class by calling ``MTLFXTemporalDenoisedScalerDescriptor/newTemporalDenoisedScalerWithDevice:compiler:``. +/// +/// When using instances of objects conforming to this protocol, you configure the different properties it +/// inherits from protocol ``MTLFXTemporalDenoisedScalerBase`` and then call ``encodeToCommandBuffer:`` to +/// encode its work into a Metal command buffer. +/// +/// See ``MTLFXTemporalDenoisedScalerBase`` for more details on configuring and using denoiser scalers. +/// +API_AVAILABLE(macos(26.0), ios(26.0)) +#if defined(TARGET_OS_VISION) && TARGET_OS_VISION +API_UNAVAILABLE(visionos) +#endif +@protocol MTL4FXTemporalDenoisedScaler <MTLFXTemporalDenoisedScalerBase> + +/// Encode this scaler denoiser's work into a command buffer. +/// +/// - Parameters: +/// - commandBuffer: A command buffer into which this scaler denoiser encodes work. +/// +- (void)encodeToCommandBuffer:(nonnull id<MTL4CommandBuffer>)commandBuffer; +@end diff -ruN /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXTemporalScaler.h /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXTemporalScaler.h --- /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXTemporalScaler.h	1969-12-31 19:00:00 +++ /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTL4FXTemporalScaler.h	2025-05-23 06:41:45 @@ -0,0 +1,36 @@ +// +// MTL4FXTemporalScaler.h +// MetalFX +// +// Copyright (c) 2025 Apple Inc. All rights reserved. +// + +#import <Metal/Metal.h> +#import <Metal/MTL4Compiler.h> +#import <MetalFX/MTLFXTemporalScaler.h> + +/// An upscaling effect that generates a higher resolution texture in a render pass by analyzing multiple input textures over time. +/// +/// You create instances of this class by calling ``MTLFXTemporalScalerDescriptor/newTemporalScalerWithDevice:compiler:``. +/// +/// When using instances of objects conforming to this protocol, you configure the different properties it +/// inherits from protocol ``MTLFXTemporalScalerBase`` and then call ``encodeToCommandBuffer:`` to +/// encode its work into a Metal command buffer. +/// +/// See ``MTLFXTemporalScalerBase`` for more details on configuring and using spatial scalers. +/// +API_AVAILABLE(macos(26.0), ios(26.0)) +#if defined(TARGET_OS_VISION) && TARGET_OS_VISION +API_UNAVAILABLE(visionos) +#endif +@protocol MTL4FXTemporalScaler <MTLFXTemporalScalerBase> + +/// Encode this spatial scaler work into a command buffer. +/// +/// - Parameters: +/// - commandBuffer: A command buffer into which this spatial scaler encodes work. +/// +- (void)encodeToCommandBuffer:(nonnull id<MTL4CommandBuffer>)commandBuffer; + +@end + diff -ruN /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXFrameInterpolator.h /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXFrameInterpolator.h --- /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXFrameInterpolator.h	1969-12-31 19:00:00 +++ /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXFrameInterpolator.h	2025-05-23 06:20:01 @@ -0,0 +1,327 @@ +// +// MTLFXFrameInterpolator.h +// MetalFX +// +// Copyright (c) 2024 Apple Inc. All rights reserved. +// + +#import <Metal/Metal.h> + + +#import <Metal/MTL4Compiler.h> + +// Forward declaration of Metal4FX interpolator and scaler. +@protocol MTL4FXFrameInterpolator; +@protocol MTL4FXTemporalScaler; +@protocol MTL4FXTemporalDenoisedScaler; +// Forward declaration. +@protocol MTLFXFrameInterpolator; +@protocol MTLFXTemporalScaler; +@protocol MTLFXTemporalDenoisedScaler; + +#if defined(TARGET_OS_VISION) && TARGET_OS_VISION +API_UNAVAILABLE(visionos) +#endif +/// A set of properties that configure a frame interpolator, and a factory method that creates the effect. +/// +/// A frame interpolator inspects two frames your game or app renders and, based on their properties, generates +/// an extra frame at a fraction of the cost, helping you to increase your frame rate. +/// +/// When you configure this descriptor, set the properties that determine the pixel format for each texture to the +/// respective format of the texture you later assign to the scaler. For example, make sure that the format to which +/// you set the ``colorTextureFormat`` property matches the format of the texture you later assign to the interpolator's +/// ``MTLFXFrameInterpolatorDescriptor/colorTexture`` property. +API_AVAILABLE(macos(26.0), ios(26.0)) +@interface MTLFXFrameInterpolatorDescriptor : NSObject <NSCopying> + +/// The pixel format of the input color texture for the frame interpolator you create with this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat colorTextureFormat; + +/// The pixel format of the output color texture for the frame interpolator you create with this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat outputTextureFormat; + +/// The pixel format of the input depth texture for the frame interpolator you create with this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat depthTextureFormat; + +/// The pixel format of the input motion texture for the frame interpolator you create with this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat motionTextureFormat; +/// The pixel format for the frame interpolator of an input texture containing your game's custom UI. +@property (readwrite, nonatomic, setter=setUITextureFormat:) MTLPixelFormat uiTextureFormat; + +/// An optional temporal scaler for the frame interpolator you create from this descriptor. +@property (nonatomic, retain, nullable) id<MTLFXTemporalScaler> scaler; + +/// An optional denoiser scaler for the frame interpolator you create from this descriptor. +@property (nonatomic, retain, nullable) id<MTLFXTemporalDenoisedScaler> denoiserScaler; +/// An optional temporal scaler for the frame interpolator you create from this descriptor. +@property (nonatomic, retain, nullable) id<MTL4FXTemporalScaler> scaler4; +/// An optional denoiser scaler for the frame interpolator you create from this descriptor. +@property (nonatomic, retain, nullable) id<MTL4FXTemporalDenoisedScaler> denoiserScaler4; +/// The width, in pixels, of the input color texture for the frame interpolator. +@property (readwrite, nonatomic) NSUInteger inputWidth; +/// The height, in pixels, of the input color texture for the frame interpolator. +@property (readwrite, nonatomic) NSUInteger inputHeight; +/// The width, in pixels, of the output color texture for the frame interpolator. +@property (readwrite, nonatomic) NSUInteger outputWidth; +/// The height, in pixels, of the output color texture for the frame interpolator. +@property (readwrite, nonatomic) NSUInteger outputHeight; + +/// Creates a frame interpolator instance for a Metal device. +/// +/// - Parameters: +/// - device: The Metal device that creates the frame interpolator. +/// - Returns: +/// A new frame interpolator instance upon success, or `nil` otherwise. +- (nullable id <MTLFXFrameInterpolator>)newFrameInterpolatorWithDevice:(nonnull id<MTLDevice>)device; + +/// Creates a frame interpolator instance for a Metal device. +/// +/// - Parameters: +/// - device: The Metal device that creates the frame interpolator. +/// - compiler: A compiler instance this method can use to build pipeline state objects. +/// - Returns: +/// A new frame interpolator instance upon success, or `nil` otherwise. +- (nullable id <MTL4FXFrameInterpolator>)newFrameInterpolatorWithDevice:(nonnull id<MTLDevice>)device compiler:(nonnull id<MTL4Compiler>)compiler; + +/// Queries whether a Metal device supports frame interpolation compatible with a Metal 4 command buffer. +/// +/// - Parameters: +/// - device: The GPU device for which this methods tests support. +/// +/// - Returns: <doc://com.apple.documentation/documentation/swift/true> if the device supports frame interpolation for +/// Metal 4, <doc://com.apple.documentation/documentation/swift/false> otherwise. ++ (BOOL)supportsMetal4FX:(nonnull id<MTLDevice>)device; + +/// Queries whether a Metal device supports frame interpolation. +/// +/// - Parameters: +/// - device: The GPU device for which this methods tests support. +/// +/// - Returns: <doc://com.apple.documentation/documentation/swift/true> if the device supports frame interpolation, +/// <doc://com.apple.documentation/documentation/swift/false> otherwise. ++ (BOOL)supportsDevice:(nonnull id<MTLDevice>)device; + +@end + +/// A common abstraction to all frame interpolators. +/// +/// This protocol defines properties common to all frame interpolators. You access these properties through +/// any frame interpolator instance you create by calling construction methods such as +/// ``MTLFXFrameInterpolatorDescriptor/newFrameInterpolatorWithDevice:``. +/// +/// ## Conforming to texture usage requirements +///  +/// Frame interpolator instances expose properties, such as ``colorTextureUsage``, that indicate requirements for +/// your textures to be compatible with it. These properties indicate the minimum set of ``MTLTextureUsage`` bits +/// that you are responsible for setting in your texture descriptors for this frame interpolator to use them. +/// +/// Your game or app can set extra usage bits on your textures without losing compatibility, as long at its maintains +/// the minimum set the interpolator requests. +/// +/// ## Assigning input and output textures +/// +/// When you use an instance of a class that conforms to this protocol, you typically set its input and output textures, +/// as well as other properties, and then encode its work to a command buffer. +/// +/// MetalFX doesn't track that you assign the same texture instances to each property across different batches of work, +/// the only requirement is that you provide textures that match the pixel formats and dimensions you specify in the +/// ``MTLFXFrameInterpolatorDescriptor`` descriptor instance that creates the scaler instance. +/// +/// ## Encoding work +/// +/// Once you configure all properties for the current frame of your game or app, you indicate to the scaler instance +/// into which command buffer it encodes its work. You achieve this by calling, for example, +/// ``MTLFXFrameInterpolator/encodeToCommandBuffer:``. +/// +@protocol MTLFXFrameInterpolatorBase <NSObject> + +/// The minimal texture usage options that your app’s input color texture needs in order to support this frame interpolator. +@property (nonatomic, readonly) MTLTextureUsage colorTextureUsage; +/// The minimal texture usage options that your app’s output color texture needs in order to support this frame interpolator. +@property (nonatomic, readonly) MTLTextureUsage outputTextureUsage; +/// The minimal texture usage options that your app’s input depth texture needs in order to support this frame interpolator. +@property (nonatomic, readonly) MTLTextureUsage depthTextureUsage; +/// The minimal texture usage options that your app’s input motion texture needs in order to support this frame interpolator. +@property (nonatomic, readonly) MTLTextureUsage motionTextureUsage; +/// The minimal texture usage options that your app’s input UI texture needs in order to support this frame interpolator. +@property (nonatomic, readonly) MTLTextureUsage uiTextureUsage; + +/// The pixel format of the input color texture for this frame interpolator. +@property (nonatomic, readonly) MTLPixelFormat colorTextureFormat; +/// The pixel format of the input depth texture for this frame interpolator. +@property (nonatomic, readonly) MTLPixelFormat depthTextureFormat; +/// The pixel format of the input motion texture for this frame interpolator. +@property (nonatomic, readonly) MTLPixelFormat motionTextureFormat; +/// The pixel format of the output color texture for this frame interpolator. +@property (nonatomic, readonly) MTLPixelFormat outputTextureFormat; + +/// The width, in pixels, of the input color texture for the frame interpolator. +@property (nonatomic, readonly) NSUInteger inputWidth; +/// The height, in pixels, of the input color texture for the frame interpolator. +@property (nonatomic, readonly) NSUInteger inputHeight; +/// The width, in pixels, of the output color texture for the frame interpolator. +@property (nonatomic, readonly) NSUInteger outputWidth; +/// The height, in pixels, of the output color texture for the frame interpolator. +@property (nonatomic, readonly) NSUInteger outputHeight; +/// The pixel format of the input UI texture for the frame interpolator. +@property (nonatomic, readonly) MTLPixelFormat uiTextureFormat; + +/// The color texture that this frame interpolator evaluates. +/// +/// You are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``colorTextureUsage`` requests and the pixel format that ``colorTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> colorTexture; + +/// The previous color texture for this frame interpolator during the last call to encode work into a command buffer. +/// +/// The frame interpolator typically uses the previous color texture as part of its operation. When you call +/// ``MTLFXFrameInterpolator/encodeToCommandBuffer:`` and its ``shouldResetHistory`` property is +/// <doc://com.apple.documentation/documentation/swift/false>, then you are responsible for assigning to this property +/// the data that in ``colorTexture`` from the previous call to ``MTLFXFrameInterpolator/encodeToCommandBuffer:``. +/// +/// Additionally, you are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``colorTextureUsage`` requests and the pixel format that ``colorTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> prevColorTexture; + + +/// The depth texture this frame interpolator evaluates. +/// +/// You are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``depthTextureUsage`` requests and the pixel format that ``depthTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> depthTexture; + +/// The motion texture this frame interpolator evaluates. +/// +/// You are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``motionTextureUsage`` requests and the pixel format that ``motionTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> motionTexture; + +/// The horizontal scale factor the frame interpolator applies to the input motion texture. +/// +/// The frame interpolator converts the horizontal component of each value in ``motionTexture`` into fragment (pixel) +/// coordinates by multiplying it by this property’s value. +/// +/// If you set this property's value to `1.0`, this interpolator expects that each pixel's motion vector points +/// to the location where that pixel is in the ``prevColorTexture``. For example, in Metal's standard device coordinates +/// where `(0,0)` represents the upper-left corner of the framebuffer, the motion vectors for an object that moves down +/// and to the right in the ``colorTexture`` by `10` pixels would be `(-10,-10)`. +@property (nonatomic) float motionVectorScaleX; + +/// The vertical scale factor the frame interpolator applies to the input motion texture. +/// +/// The frame interpolator converts the horizontal component of each value in ``motionTexture`` into fragment (pixel) +/// coordinates by multiplying it by this property’s value. +/// +/// If you set this property's value to `1.0`, this interpolator expects that each pixel's motion vector points +/// to the location where that pixel is in the ``prevColorTexture``. For example, in Metal's standard device coordinates +/// where `(0,0)` represents the upper-left corner of the framebuffer, the motion vectors for an object that moves down +/// and to the right in the ``colorTexture`` by `10` pixels would be `(-10,-10)`. +@property (nonatomic) float motionVectorScaleY; + + +/// The length of the time interval, in seconds, between time of current and previous frame. +@property (readwrite, nonatomic) float deltaTime; + +/// The near plane distance that corresponds to the frustrum that renders the scene into the color buffer. +@property (readwrite, nonatomic) float nearPlane; + +/// The far plane distance that corresponds to the frustrum that renders the scene into the color buffer. +@property (readwrite, nonatomic) float farPlane; + +/// The vertical field of view angle, in degrees, of the camera that renders the scene into the color buffer. +/// +/// In a 3D game, you set this value to the field of view you use to create your perspective matrix. +@property (readwrite, nonatomic) float fieldOfView; + +/// The ratio between width and height of the screen. +/// +/// In a 3D game, you set this value to the same aspect ratio you use to create your perspective matrix, which is +/// typically `width/height`. +@property (readwrite, nonatomic) float aspectRatio; + +/// An optional texture containing your game's custom UI that this frame interpolator evaluates. +/// +/// The frame interpolator uses this property to overlay your custom UI on any frame data it produces into ``outputTexture``. +/// +/// Use property ``uiTextureComposited`` to indicate to this frame interpolator if ``colorTexture`` contains a precomposition +/// of this UI to avoid it producing incorrect results for the overlay. +@property (nonatomic, retain, nullable, setter=setUITexture:) id<MTLTexture> uiTexture; + + +/// The horizontal component of the subpixel sampling coordinate you use to generate the color texture input. +/// +/// This property indicates the horizontal pixel offset this interpolator samples to return to the frame's reference frame. +@property (nonatomic) float jitterOffsetX; + +/// The vertical component of the subpixel sampling coordinate you use to generate the color texture input. +/// +/// This property indicates the vertical pixel offset this interpolator samples to return to the frame's reference frame. +@property (nonatomic) float jitterOffsetY; + + +/// A Boolean value that controls whether this frame interpolator interprets the color texture to include your game's custom UI. +/// +/// Set this property to <doc://com.apple.documentation/documentation/swift/true> when property ``uiTexture`` contains +/// a precomposition of any custom UI image on top of the color image. +/// +/// When you enable this property, the frame interpolator decomposites the color image ``colorTexture`` references from +/// the UI ``uiTexture`` references before compositing the UI on to the ``outputTexture``. +/// +/// This property's default value is <doc://com.apple.documentation/documentation/swift/false>. +@property (readwrite, nonatomic, getter=isUITextureComposited, setter=setIsUITextureComposited:) BOOL uiTextureComposited; + + + +/// A Boolean property indicating whether to reset history. +/// +/// Set this property to <doc://com.apple.documentation/documentation/swift/true> to invalidate history, for example +/// when there is a scene cut in your game. +/// +/// When you set this property to <doc://com.apple.documentation/documentation/swift/false>, you are responsible for +/// ensuring the property ``prevColorTexture`` contains frame data corresponding to that in ``colorTexture`` during +/// your previous call to ``MTLFXFrameInterpolator/encodeToCommandBuffer:``. +@property (nonatomic) BOOL shouldResetHistory; + +/// The output texture into which this frame interpolator writes its output. +/// +/// You are responsible for providing a texture with a private `storageMode` to this property. +@property (nonatomic, retain, nullable) id<MTLTexture> outputTexture; + +/// An optional fence that this frame interpolator waits for and updates. +/// +/// Use this property for synchronizing access to untracked resources. +@property (nonatomic, retain, nullable) id<MTLFence> fence; + +/// A Boolean value that indicates whether the depth texture uses zero to represent the farthest distance. +/// +/// This property's default value is <doc://com.apple.documentation/documentation/swift/true>. +@property (readwrite, nonatomic, getter=isDepthReversed) BOOL depthReversed; + +@end + +/// An effect that generates textures by interpolating two input textures. +/// +/// You create instances of this class by calling ``MTLFXFrameInterpolatorDescriptor/newFrameInterpolatorWithDevice:``. +/// +/// When using instances of objects conforming to this protocol, you configure the different properties it +/// inherits from protocol ``MTLFXFrameInterpolatorBase`` and then call ``encodeToCommandBuffer:`` to +/// encode its work into a Metal command buffer. +/// +/// See ``MTLFXFrameInterpolatorBase`` for more details on configuring and using frame interpolators. +/// +API_AVAILABLE(macos(26.0), ios(26.0)) +#if defined(TARGET_OS_VISION) && TARGET_OS_VISION +API_UNAVAILABLE(visionos) +#endif +@protocol MTLFXFrameInterpolator <MTLFXFrameInterpolatorBase> + +/// Encode this frame interpolator's work into a command buffer. +/// +/// - Parameters: +/// - commandBuffer: A command buffer into which this frame interpolator encodes work. +///  +- (void)encodeToCommandBuffer:(nonnull id<MTLCommandBuffer>)commandBuffer; + +@end + + diff -ruN /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXSpatialScaler.h /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXSpatialScaler.h --- /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXSpatialScaler.h	2025-04-19 04:28:15 +++ /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXSpatialScaler.h	2025-05-23 06:41:44 @@ -6,72 +6,189 @@ // #import <Metal/Metal.h> +#import <Metal/MTL4Compiler.h> +// Forward declaration of Metal4FX scaler. +@protocol MTL4FXTemporalScaler; +// Forward declaration. +@protocol MTL4FXSpatialScaler; + +/// The color space modes for the input and output textures you use with a spatial scaling effect instance. typedef NS_ENUM(NSInteger, MTLFXSpatialScalerColorProcessingMode) { - MTLFXSpatialScalerColorProcessingModePerceptual NS_SWIFT_NAME(perceptual) = 0, /* This should be used when the input and output textures are already in an sRGB or otherwise perceptual 0-1 encoding. */ - MTLFXSpatialScalerColorProcessingModeLinear NS_SWIFT_NAME(linear) = 1, /* This should be used when the input and output textures will contain light linear data in the 0-1 range. */ - MTLFXSpatialScalerColorProcessingModeHDR NS_SWIFT_NAME(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. */ +  + /// Indicates your input and output textures use a perceptual color space (sRGB). + MTLFXSpatialScalerColorProcessingModePerceptual NS_SWIFT_NAME(perceptual) = 0, +  + /// Indicates your input and output textures use a linear color space in the `[0,1]` range. + MTLFXSpatialScalerColorProcessingModeLinear NS_SWIFT_NAME(linear) = 1, +  + /// Indicates your input and output textures use a high dynamic range color space, beyond the `[0,1]` range. + /// + /// When you configure this mode, MetalFX performs a reversible tone mapping operation to convert your data to the `[0,1]` range. + MTLFXSpatialScalerColorProcessingModeHDR NS_SWIFT_NAME(hdr) = 2, } API_AVAILABLE(macos(13.0), ios(16.0)); // Forward declaration. @protocol MTLFXSpatialScaler; + +/// A set of properties that configure a spatial scaling effect, and a factory method that creates the effect. API_AVAILABLE(macos(13.0), ios(16.0)) @interface MTLFXSpatialScalerDescriptor : NSObject <NSCopying> -// These properties must be set to the respective Metal pixel formats for each texture that will be used with the scaler. +/// The pixel format of the input color texture for the spatial scaler you create with this descriptor. @property (readwrite, nonatomic) MTLPixelFormat colorTextureFormat; + +/// The pixel format of the output texture for the spatial scaler you create with this descriptor. @property (readwrite, nonatomic) MTLPixelFormat outputTextureFormat; + +/// The width of the input color texture for the spatial scaler you create with this descriptor. @property (readwrite, nonatomic) NSUInteger inputWidth; + +/// The height of the input color texture for the spatial scaler you create with this descriptor. @property (readwrite, nonatomic) NSUInteger inputHeight; + +/// The width of the output color texture for the spatial scaler you create with this descriptor. @property (readwrite, nonatomic) NSUInteger outputWidth; + +/// The height of the output color texture for the spatial scaler you create with this descriptor. @property (readwrite, nonatomic) NSUInteger outputHeight; -/* The default for colorProcessingMode is MTLFXSpatialScalerColorProcessingMode_Perceptual */ +/// The color space of the input color texture for the spatial scaler you create with this descriptor. +/// +/// This property's default value is ``MTLFXSpatialScalerColorProcessingMode/MTLFXSpatialScalerColorProcessingModePerceptual``. @property (readwrite, nonatomic) MTLFXSpatialScalerColorProcessingMode colorProcessingMode; -// The following method is used to instantiate the effect encoder for a given -// Metal device. +/// Creates a spatial scaler instance for a Metal device. +/// +/// - Parameters: +/// - device: The Metal device that creates the spatial scaler. +/// - Returns: +/// A new spatial scaler instance upon success, or `nil` otherwise. - (nullable id <MTLFXSpatialScaler>)newSpatialScalerWithDevice:(nonnull id<MTLDevice>)device; -// Class method for determining support +/// Creates a spatial scaler instance for a Metal device. +/// +/// - Parameters: +/// - device: The Metal device that creates the spatial scaler. +/// - compiler: A compiler instance this method can use to build pipeline state objects. +/// - Returns: +/// A new spatial scaler instance upon success, or `nil` otherwise. +- (nullable id <MTL4FXSpatialScaler>)newSpatialScalerWithDevice:(nonnull id<MTLDevice>)device compiler:(nonnull id<MTL4Compiler>)compiler API_AVAILABLE(macos(26.0), ios(26.0)); + +/// Queries whether a Metal device supports spatial scaling compatible with Metal 4. +/// +/// - Parameters: +/// - device: The GPU device for which this methods tests support. +/// +/// - Returns: <doc://com.apple.documentation/documentation/swift/true> if the device supports spatial scaling with +/// Metal 4, <doc://com.apple.documentation/documentation/swift/false> otherwise. ++ (BOOL)supportsMetal4FX:(nonnull id<MTLDevice>)device API_AVAILABLE(macos(26.0), ios(26.0)); + +/// Returns a Boolean value that indicates whether the spatial scaler works with a GPU. +/// +/// - Parameters: +/// - device: An ``MTLDevice`` instance that represents a GPU. +/// +/// - Returns: <doc://com.apple.documentation/documentation/swift/true> if the device supports spatial scaling, +/// <doc://com.apple.documentation/documentation/swift/false> otherwise. + (BOOL)supportsDevice:(nonnull id<MTLDevice>)device; @end -// This is the object that gets created from the descriptor -API_AVAILABLE(macos(13.0), ios(16.0)) -@protocol MTLFXSpatialScaler <NSObject> +/// An upscaling effect that generates a higher resolution texture in a render pass by spatially analyzing an input texture. +/// +/// The MetalFX spatial scaler increases the size of your input texture to a larger output texture. You can use the +/// scaler to upscale every frame of your app’s scene or rendering in real time. With a scaler, you can draw more +/// complicated scenes in less time by intentionally rendering to a lower resolution to save time before upscaling. +/// +/// Create an ``MTLFXSpatialScaler`` instance following these steps: +/// 1. Create and configure an ``MTLFXSpatialScalerDescriptor`` instance. +/// 2. Call the descriptor’s ``newSpatialScalerWithDevice:`` method. +/// +/// Upscale a rendering by following these steps for every render pass: +/// 1. Set the spatial scaler’s ``colorTexture`` property to the input texture. +/// 2. Set the scaler’s ``inputContentWidth`` and ``inputContentHeight`` properties. +/// 3. Set the scaler’s ``outputTexture`` property to your destination texture. +/// +/// Encode the upscale commands to a command buffer by calling the spatial scaler’s ``encodeToCommandBuffer:`` method. +/// +/// ## Conforming to texture usage requirements +/// +/// Spatial scalers expose properties, such as ``colorTextureUsage``, that indicate requirements for +/// your textures to be compatible with it. These properties indicate the minimum set of ``MTLTextureUsage`` bits +/// that you are responsible for setting in your texture descriptors for this spatial scaler to use them. +/// +/// Your game or app can set extra usage bits on your textures without losing compatibility, as long at its maintains +/// the minimum set the scaler requests. +/// +/// ## Assigning input and output textures +/// +/// When you use an instance of a class that conforms to this protocol, you typically set its input and output textures, +/// as well as other properties, and then encode its work to a command buffer. +/// +/// MetalFX doesn't track that you assign the same texture instances to each property across different batches of work, +/// the only requirement is that you provide textures that match the pixel formats and dimensions you specify in the +/// ``MTLFXSpatialScalerDescriptor`` descriptor instance that creates the scaler instance. +/// +@protocol MTLFXSpatialScalerBase <NSObject> -// Properties return the minimum required MTLTextureUsage bits required +/// The minimal texture usage options that your app’s input color texture needs in order to support this scaler. @property (nonatomic, readonly) MTLTextureUsage colorTextureUsage; +/// The minimal texture usage options that your app’s output color texture needs in order to support this scaler. @property (nonatomic, readonly) MTLTextureUsage outputTextureUsage; -// Dynamic resolution property +/// The width, in pixels, of the region within the color texture the scaler uses as its input. @property (nonatomic) NSUInteger inputContentWidth; +/// The height, in pixels, of the region within the color texture the scaler uses as its input. @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. +/// Input color texture you set for the scaler that supports the correct color texture usage options. @property (nonatomic, retain, nullable) id<MTLTexture> colorTexture; -// outputTexture is required to have MTLStorageModePrivate for storageMode + +/// The output texture into which this scaler writes its output. +/// +/// You are responsible for providing a texture with a private `storageMode` to this property. @property (nonatomic, retain, nullable) id<MTLTexture> outputTexture; -// Read-only immutable properties of effect +/// The pixel format of the input color texture for this this scaler. @property (nonatomic, readonly) MTLPixelFormat colorTextureFormat; +/// The pixel format of the output color texture for this this scaler. @property (nonatomic, readonly) MTLPixelFormat outputTextureFormat; +/// The width, in pixels, of the input color texture for this scaler. @property (nonatomic, readonly) NSUInteger inputWidth; +/// The height, in pixels, of the input color texture for this scaler. @property (nonatomic, readonly) NSUInteger inputHeight; +/// The width, in pixels, of the output color texture for this scaler. @property (nonatomic, readonly) NSUInteger outputWidth; +/// The height, in pixels, of the output color texture for this scaler. @property (nonatomic, readonly) NSUInteger outputHeight; +/// The color processing mode you set in this spatial scaler’s descriptor. @property (nonatomic, readonly) MTLFXSpatialScalerColorProcessingMode colorProcessingMode; -// Property for synchronization when using untracked resources +/// An optional fence that you provide to synchronize your app’s untracked resources. @property (nonatomic, retain, nullable) id<MTLFence> fence; -// Method to encode the effect to a command buffer +@end + +/// An upscaling effect that generates a higher resolution texture in a render pass by spatially analyzing an input texture. +/// +/// You create instances of this class by calling ``MTLFXSpatialScalerDescriptor/newSpatialScalerWithDevice:``. +/// +/// When using instances of objects conforming to this protocol, you configure the different properties it +/// inherits from protocol ``MTLFXSpatialScalerBase`` and then call ``encodeToCommandBuffer:`` to +/// encode its work into a Metal command buffer. +/// +/// See ``MTLFXSpatialScalerBase`` for more details on configuring and using spatial scalers. +/// +API_AVAILABLE(macos(13.0), ios(16.0)) +@protocol MTLFXSpatialScaler <MTLFXSpatialScalerBase> + +/// Encode this spatial scaler work into a command buffer. +/// +/// - Parameters: +/// - commandBuffer: A command buffer into which this spatial scaler encodes work. +/// - (void)encodeToCommandBuffer:(nonnull id<MTLCommandBuffer>)commandBuffer; @end diff -ruN /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXTemporalDenoisedScaler.h /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXTemporalDenoisedScaler.h --- /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXTemporalDenoisedScaler.h	1969-12-31 19:00:00 +++ /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXTemporalDenoisedScaler.h	2025-05-23 06:41:45 @@ -0,0 +1,482 @@ +// +// MTLFXTemporalDenoisedScaler.h +// MetalFX +// +// Copyright (c) 2021-2022 Apple Inc. All rights reserved. +// + +#import <Metal/Metal.h> +#import <simd/simd.h> + +#import <Metal/MTL4Compiler.h> +// Forward declaration of Metal4FX scaler. +@protocol MTL4FXTemporalDenoisedScaler; +// Forward declaration. +@protocol MTLFXTemporalDenoisedScaler; + +/// A set of properties that configure a denoiser scaler, and a factory method that creates the effect. +/// +/// A denoiser scaler helps reduce noise in an image. You typically use this in situations where your pixels are +/// expensive to produce, such as elaborate ray or path tracing situations, to save processing time by producing a +/// noisy image that this scaler then cleans up before presentation. +/// +/// When you configure this descriptor, set the properties that determine the pixel format for each texture to the +/// respective format of the texture you later assign to the scaler. For example, make sure that the format to which +/// you set the ``colorTextureFormat`` property matches the format of the texture you later assign to the scaler's +/// ``MTLFXTemporalDenoisedScalerDescriptor/colorTexture`` property. +API_AVAILABLE(macos(26.0), ios(18.0)) +#if defined(TARGET_OS_VISION) && TARGET_OS_VISION +API_UNAVAILABLE(visionos) +#endif +@interface MTLFXTemporalDenoisedScalerDescriptor : NSObject <NSCopying> + +/// The pixel format of the input color texture for the scaler you create with this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat colorTextureFormat; + +/// The pixel format of the input depth texture for the scaler you create with this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat depthTextureFormat; + +/// The pixel format of the input motion texture for the scaler you create with this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat motionTextureFormat; + +/// The pixel format of the input diffuse albedo texture for the scaler you create with this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat diffuseAlbedoTextureFormat; + +/// The pixel format of the input specular albedo texture for the scaler you create with this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat specularAlbedoTextureFormat; + +/// The pixel format of the input normal texture for the scaler you create with this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat normalTextureFormat; + +/// The pixel format of the input roughness texture for the scaler you create with this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat roughnessTextureFormat; + +/// The pixel format of the input specular hit texture for the scaler you create with this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat specularHitDistanceTextureFormat; +/// The pixel format of the input denoise strength mask texture for the scaler you create with this descriptor. +/// +/// You typically set this to a single-channel texture format. +@property (readwrite, nonatomic) MTLPixelFormat denoiseStrengthMaskTextureFormat; +/// The pixel format of the input transparency overlay texture for the scaler you create with this descriptor. +/// +/// You typically set this to a 4-channel RGBA texture format. +@property (readwrite, nonatomic) MTLPixelFormat transparencyOverlayTextureFormat; + +/// The pixel format of the output color texture for the scaler you create with this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat outputTextureFormat; + +/// The width, in pixels, of the input color texture for the denoiser scaler. +@property (readwrite, nonatomic) NSUInteger inputWidth; +/// The height, in pixels, of the input color texture for the denoiser scaler. +@property (readwrite, nonatomic) NSUInteger inputHeight; + +/// The width, in pixels, of the output color texture for the denoiser scaler. +@property (readwrite, nonatomic) NSUInteger outputWidth; +/// The height, in pixels, of the input color texture for the denoiser scaler. +@property (readwrite, nonatomic) NSUInteger outputHeight; + +/// A Boolean value that indicates whether MetalFX compiles a temporal scaling effect’s underlying upscaler as it +/// creates the instance. +/// +/// This property gives you the option to decide when it’s better for your app to give MetalFX the time it needs to +/// compile the underlying upscaler of the temporal scaling effect. The two choices are: +/// +/// * As you create the effect +/// * After you create the effect, likely when your app needs to upscale the initial textures +/// +/// You can create a temporal denoised scaler instance that can denoise and upscale textures at its best speed +/// immediately after you create it by setting this property to <doc://com.apple.documentation/documentation/swift/true> +/// and then calling an initialization method like ``newTemporalDenoisedScalerWithDevice:``. However, it may take MetalFX +/// more time for that method to return while it creates the denoiser scaler and compiles its underlying pipelines. +/// +/// By default, the property is equal to <doc://com.apple.documentation/documentation/swift/false>, which tells MetalFX +/// to quickly create and return the temporal scaling-effect instance, and then compile a faster upscaler in the background. +/// However, this means the effect can take more time to upscale textures while the framework compiles the underlying upscaler. +/// When the framework finishes compiling, the effect runs just as fast as if you set the property to +/// <doc://com.apple.documentation/documentation/swift/true>. +/// +/// * Note: The image quality of the effect’s output texture is consistent, whether it’s using the slower interim upscaler +/// or the final, faster upscaler. +/// +@property (readwrite, nonatomic) BOOL requiresSynchronousInitialization; + +/// A Boolean value that indicates whether MetalFX calculates the exposure for each frame. +/// +/// Set this property to <doc://com.apple.documentation/documentation/swift/true> to create a scaler that automatically +/// calculates the exposure level for each image it scales. +/// +/// * Note: Denoiser scaler instances that use auto exposure ignore their ``MTLFXTemporalScalerBase/exposureTexture`` +/// property. +/// +/// This property's default value is <doc://com.apple.documentation/documentation/swift/false>. +@property (readwrite, nonatomic, getter=isAutoExposureEnabled) BOOL autoExposureEnabled; + +/// A Boolean value that indicates whether a scaler you create from this descriptor applies a reactive mask. +@property (readwrite, nonatomic, getter=isReactiveMaskTextureEnabled) BOOL reactiveMaskTextureEnabled; + +/// The pixel format of the reactive mask input texture for a scaler you create from this descriptor. +@property (readwrite, nonatomic) MTLPixelFormat reactiveMaskTextureFormat; + +/// A Boolean value indicating whether the scaler evaluates a specular hit distance texture as part of its operation. +@property (readwrite, nonatomic, getter=isSpecularHitDistanceTextureEnabled) BOOL specularHitDistanceTextureEnabled; + +/// A Boolean value indicating whether the scaler evaluates a denoise strength mask texture as part of its operation. +@property (readwrite, nonatomic, getter=isDenoiseStrengthMaskTextureEnabled) BOOL denoiseStrengthMaskTextureEnabled; +/// A Boolean value indicating whether the scaler evaluates a transparency overlay texture as part of its operation. +@property (readwrite, nonatomic, getter=isTransparencyOverlayTextureEnabled) BOOL transparencyOverlayTextureEnabled; + +/// Creates a denoiser scaler instance for a Metal device. +/// +/// - Parameters: +/// - device: The Metal device that creates the denoiser scaler. +/// - Returns: +/// A denoiser scaler instance upon success, or `nil` otherwise. +- (nullable id <MTLFXTemporalDenoisedScaler>)newTemporalDenoisedScalerWithDevice:(nonnull id<MTLDevice>)device; + +/// Creates a denoiser scaler instance for a Metal device. +/// +/// - Parameters: +/// - device: The Metal device that creates the denoiser scaler. +/// - compiler: A compiler instance this method can use to build pipeline state objects. +/// - Returns: +/// A denoiser scaler instance upon success, or `nil` otherwise. +-(nullable id <MTL4FXTemporalDenoisedScaler>)newTemporalDenoisedScalerWithDevice:(nonnull id<MTLDevice>)device compiler:(nonnull id<MTL4Compiler>)compiler; + +/// Returns the smallest temporal scaling factor the device supports as a floating-point value. +/// +/// - Parameters: +/// - device: The Metal device for which this method checks the minimum input content scale it supports. +/// +/// - Returns: the minimum input content scale the GPU device supports. ++ (float)supportedInputContentMinScaleForDevice:(nonnull id<MTLDevice>)device; + +/// Returns the largest temporal scaling factor the device supports as a floating-point value. +/// +/// - Parameters: +/// - device: The Metal device for which this method checks the maximum input content scale it supports. +/// +/// - Returns: the maximum input content scale the GPU device supports. ++ (float)supportedInputContentMaxScaleForDevice:(nonnull id<MTLDevice>)device; + +/// Queries whether a Metal device supports denosing scaling compatible on Metal 4. +/// +/// - Parameters: +/// - device: The GPU device for which this methods tests support. +/// +/// - Returns: <doc://com.apple.documentation/documentation/swift/true> if the device supports denoising scaling for +/// Metal 4, <doc://com.apple.documentation/documentation/swift/false> otherwise. ++ (BOOL)supportsMetal4FX:(nonnull id<MTLDevice>)device; + +/// Queries whether a Metal device supports denoising scaling. +/// +/// - Parameters: +/// - device: The GPU device for which this methods tests support. +/// +/// - Returns: <doc://com.apple.documentation/documentation/swift/true> if the device supports denoising scaling, +/// <doc://com.apple.documentation/documentation/swift/false> otherwise. ++ (BOOL)supportsDevice:(nonnull id<MTLDevice>)device; + +@end + +/// A common abstraction to all denoiser scalers. +/// +/// This protocol defines properties common to all denoiser scalers. You access these properties through +/// any denoiser scaler instance you create by calling construction methods such as +/// ``MTLFXTemporalDenoisedScalerDescriptor/newTemporalDenoisedScalerWithDevice:``. +/// +/// ### Conforming to texture usage requirements +/// +/// Denoiser scaler instances expose properties, such as ``colorTextureUsage``, that indicate requirements for +/// your textures to be compatible with it. These properties indicate the minimum set of ``MTLTextureUsage`` bits +/// that you are responsible for setting in your texture descriptors for this denoise scaler to use them. +/// +/// Your game or app can set extra usage bits on your textures without losing compatibility, as long at its maintains +/// the minimum set the denoiser scaler requests. +/// +/// ### Assigning input and output textures +/// +/// When you use an instance of a class that conforms to this protocol, you typically set its input and output textures, +/// as well as other properties, and then encode its work to a command buffer. +/// +/// MetalFX doesn't track that you assign the same texture instances to each property across different batches of work, +/// the only requirement is that you provide textures that match the pixel formats and dimensions you specify in the +/// ``MTLFXTemporalDenoisedScalerDescriptor`` descriptor instance that creates the scaler instance. +/// +/// ### Encoding work +/// +/// Once you configure all properties for the current frame of your game or app, you indicate to the scaler instance +/// into which command buffer it encodes its work. You achieve this by calling, for example, +/// ``MTLFXTemporalDenoisedScaler/encodeToCommandBuffer:``. +/// +@protocol MTLFXTemporalDenoisedScalerBase <NSObject> + +/// The minimal texture usage options that your app’s input color texture needs in order to support this denoiser scaler. +@property (nonatomic, readonly) MTLTextureUsage colorTextureUsage; + +/// The minimal texture usage options that your app’s input depth texture needs in order to support this denoiser scaler. +@property (nonatomic, readonly) MTLTextureUsage depthTextureUsage; + +/// The minimal texture usage options that your app’s input motion texture needs in order to support this denoiser scaler. +@property (nonatomic, readonly) MTLTextureUsage motionTextureUsage; + +/// The minimal texture usage options that your app’s input reactive texture needs in order to support this denoiser scaler. +@property (nonatomic, readonly) MTLTextureUsage reactiveTextureUsage; + +/// The minimal texture usage options that your app’s input diffuse albedo texture needs in order to support this denoiser scaler. +@property (nonatomic, readonly) MTLTextureUsage diffuseAlbedoTextureUsage; + +/// The minimal texture usage options that your app’s input specular albedo texture needs in order to support this denoiser scaler. +@property (nonatomic, readonly) MTLTextureUsage specularAlbedoTextureUsage; + +/// The minimal texture usage options that your app’s input normal texture needs in order to support this denoiser scaler. +@property (nonatomic, readonly) MTLTextureUsage normalTextureUsage; + +/// The minimal texture usage options that your app’s input roughness texture needs in order to support this denoiser scaler. +@property (nonatomic, readonly) MTLTextureUsage roughnessTextureUsage; + +/// The minimal texture usage options that your app’s input specular hit texture needs in order to support this denoiser scaler. +@property (nonatomic, readonly) MTLTextureUsage specularHitDistanceTextureUsage; + +/// The minimal texture usage options that your app’s input denoise strength texture needs in order to support this denoiser scaler. +@property (nonatomic, readonly) MTLTextureUsage denoiseStrengthMaskTextureUsage; +/// The minimal texture usage options that your app’s input transparency overlay texture needs in order to support this denoiser scaler. +@property (nonatomic, readonly) MTLTextureUsage transparencyOverlayTextureUsage; + +/// The minimal texture usage options that your app’s output texture needs in order to support this denoiser scaler. +@property (nonatomic, readonly) MTLTextureUsage outputTextureUsage; + +/// Assigns the color texture this scaler evaluates. +/// +/// You are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``colorTextureUsage`` requests and the pixel format that +/// ``MTLFXTemporalDenoisedScalerDescriptor/colorTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> colorTexture; + +/// The depth texture this scaler evaluates. +/// +/// You are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``depthTextureUsage`` requests and the pixel format that +/// ``MTLFXTemporalDenoisedScalerDescriptor/depthTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> depthTexture; + +/// The motion texture this scaler evaluates. +/// +/// You are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``motionTextureUsage`` requests and the pixel format that +/// ``MTLFXTemporalDenoisedScalerDescriptor/motionTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> motionTexture; + +/// The diffuse albedo texture this scaler evaluates. +/// +/// You are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``diffuseAlbedoTextureUsage`` requests and the pixel format that +/// ``MTLFXTemporalDenoisedScalerDescriptor/diffuseAlbedoTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> diffuseAlbedoTexture; + +/// The specular albedo texture this scaler evaluates. +/// +/// You are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``specularAlbedoTextureUsage`` requests and the pixel format that +/// ``MTLFXTemporalDenoisedScalerDescriptor/specularAlbedoTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> specularAlbedoTexture; + +/// The normal texture this scaler evaluates. +/// +/// You are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``normalTextureUsage`` requests and the pixel format that +/// ``MTLFXTemporalDenoisedScalerDescriptor/normalTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> normalTexture; + +/// The roughness texture this scaler evaluates. +/// +/// You are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``roughnessTextureUsage`` requests and the pixel format that +/// ``MTLFXTemporalDenoisedScalerDescriptor/roughnessTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> roughnessTexture; + +/// The specular hit texture this scaler evaluates. +/// +/// You are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``specularHitDistanceTextureUsage`` requests and the pixel format that +/// ``MTLFXTemporalDenoisedScalerDescriptor/specularHitDistanceTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> specularHitDistanceTexture; + +/// The denoise strength mask texture this scaler evaluates. +/// +/// Use this single-channel texture to mark, at a per-pixel level, areas that this denoiser ignores. To configure a pixel +/// that the denoiser ignores, provide `1.0` as the value at that pixel's corresponding location on this texture. +/// +/// You are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``denoiseStrengthMaskTextureUsage`` requests and the pixel format that +/// ``MTLFXTemporalDenoisedScalerDescriptor/denoiseStrengthMaskTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> denoiseStrengthMaskTexture; + +/// The transparency overlay texture that this scaler evaluates. +/// +/// Use this RGBA texture to provide to the denoiser an overlay with your transparent pixels, such as the output +/// of your particle systems. MetalFX interprets this to be a texture in linear color space, with the RGB channels +/// ranging between `0` and infinity, and the alpha channel in the range `[0,1]`, representing the opacity of the pixel. +/// +/// You are responsible for ensuring the usage and pixel format of the texture you assign to this property matches the +/// texture usage ``transparencyOverlayTextureUsage`` requests and the pixel format that +/// ``MTLFXTemporalDenoisedScalerDescriptor/transparencyOverlayTextureFormat`` requests. +@property (nonatomic, retain, nullable) id<MTLTexture> transparencyOverlayTexture; + + +/// The output texture into which this denoiser scaler writes its output. +/// +/// You are responsible for providing a texture with a private `storageMode` to this property. +@property (nonatomic, retain, nullable) id<MTLTexture> outputTexture; + +/// An exposure texture that this denoiser scaler evaluates. +/// +/// Create and assign a 1x1 `MTLPixelFormatR16Float` texture to assign to this property. MetalFX reads the R channel +/// of the texel at position `(0,0)` and uses it as the exposure value. It then uses this value to multiply the input color. +/// +/// For best performance, use the GPU to generate the exposure value and store it into this texture. +/// +/// * Note: The temporal scaler ignores this property if you create it with a descriptor that has its +/// ``MTLFXTemporalScalerDescriptor/autoExposureEnabled`` property set to +/// <doc://com.apple.documentation/documentation/swift/true>. +@property (nonatomic, retain, nullable) id<MTLTexture> exposureTexture; + +/// A pre-exposure value for this scaler to evaluate. +/// +/// If the input color texture you assign to ``colorTexture`` is pre-multiplied by fixed value, set this property +/// to that same fixed value so MetalFX divides input color by it. This is not a common situation and you typically +/// don't need to assign a value to this property. +@property (nonatomic) float preExposure; + + +/// A reactive-mask texture input for this scaler to evaluate. +/// +/// This texture helps guide the denoiser when objects move quickly in a scene with inaccurate motion information, +/// such as when they involve alpha blending. In these situations, you can get better results by guiding MetalFX whether +/// to favor the current frame on a per-pixel basis with a reactive mask texture. +/// +/// When providing this texture, you are responsible for ensuring each pixel is in the range `[0.0, 1.0]`, where a value: +/// * Equal to `0.0` tells MetalFX to follow its normal behavior for the corresponding pixel +/// * Equal to `1.0` tells MetalFX to ignore temporal history for the corresponding pixel +/// * In the range `(0.0, 1.0)` proportionally blends the effect for the corresponding pixel +///  +@property (nonatomic, retain, nullable) id<MTLTexture> reactiveMaskTexture; + +/// The horizontal component of the subpixel sampling coordinate you use to generate the color texture input. +/// +/// This property indicates the horizontal pixel offset this scaler samples to return to the frame's reference frame. +@property (nonatomic) float jitterOffsetX; + + +/// The vertical component of the subpixel sampling coordinate you use to generate the color texture input. +/// +/// This property indicates the vertical pixel offset this scaler samples to return to the frame's reference frame. +@property (nonatomic) float jitterOffsetY; + +/// The horizontal scale factor the denoiser scaler applies to the input motion texture. +/// +/// The scaler converts the horizontal component of each value in ``motionTexture`` into fragment (pixel) +/// coordinates by multiplying it by this property’s value. +/// +/// If you set this property's value to `1.0`, this denoiser scaler expects that each pixel's motion vector points +/// to that pixel's location in the ``colorTexture`` at the time of the last call to encode this scaler's work. For example, +/// in Metal's standard device coordinates, where `(0,0)` represents the upper-left corner of the framebuffer, the motion +/// vectors for an object that moves down and to the right in the ``colorTexture`` by `10` pixels would be `(-10,-10)`. +@property (nonatomic) float motionVectorScaleX; + +/// The vertical scale factor the denoiser scaler applies to the input motion texture. +/// +/// The scaler converts the horizontal component of each value in ``motionTexture`` into fragment (pixel) +/// coordinates by multiplying it by this property’s value. +/// +/// If you set this property's value to `1.0`, this denoiser scaler expects that each pixel's motion vector points +/// to that pixel's location in the ``colorTexture`` at the time of the last call to encode this scaler's work. For example, +/// in Metal's standard device coordinates, where `(0,0)` represents the upper-left corner of the framebuffer, the motion +/// vectors for an object that moves down and to the right in the ``colorTexture`` by `10` pixels would be `(-10,-10)`. +@property (nonatomic) float motionVectorScaleY; + +/// A Boolean property indicating whether to reset history. +/// +/// Set this property to <doc://com.apple.documentation/documentation/swift/true> to invalidate history, for example +/// when there is a scene cut in your game. +@property (nonatomic) BOOL shouldResetHistory; + +/// A Boolean value that indicates whether the depth texture uses zero to represent the farthest distance. +/// +/// This property's default value is <doc://com.apple.documentation/documentation/swift/true>. +@property (readwrite, nonatomic, getter=isDepthReversed) BOOL depthReversed; + +/// The pixel format of the input color texture for this denoiser scaler. +@property (nonatomic, readonly) MTLPixelFormat colorTextureFormat; +/// The pixel format of the input depth texture for this denoiser scaler. +@property (nonatomic, readonly) MTLPixelFormat depthTextureFormat; +/// The pixel format of the input motion texture for this denoiser scaler. +@property (nonatomic, readonly) MTLPixelFormat motionTextureFormat; +/// The pixel format of the input diffuse albedo texture for this denoiser scaler. +@property (nonatomic, readonly) MTLPixelFormat diffuseAlbedoTextureFormat; +/// The pixel format of the input specular albedo for this denoiser scaler. +@property (nonatomic, readonly) MTLPixelFormat specularAlbedoTextureFormat; +/// The pixel format of the input normal texture for this denoiser scaler. +@property (nonatomic, readonly) MTLPixelFormat normalTextureFormat; +/// The pixel format of the input normal texture for this denoiser scaler. +@property (nonatomic, readonly) MTLPixelFormat roughnessTextureFormat; +/// The pixel format of the input specular hit distance texture for this denoiser scaler. +@property (nonatomic, readonly) MTLPixelFormat specularHitDistanceTextureFormat; +/// The pixel format of the input denoise strength mask texture for this denoiser scaler. +@property (nonatomic, readonly) MTLPixelFormat denoiseStrengthMaskTextureFormat; +/// The pixel format of the input transparency overlay texture for this denoiser scaler. +@property (nonatomic, readonly) MTLPixelFormat transparencyOverlayTextureFormat; +/// The pixel format of the input reactive mask texture for this denoiser scaler. +@property (nonatomic, readonly) MTLPixelFormat reactiveMaskTextureFormat; +/// The pixel format of the output color texture for this denoiser scaler. +@property (nonatomic, readonly) MTLPixelFormat outputTextureFormat; +/// The width, in pixels, of the input color texture for the scaler. +@property (nonatomic, readonly) NSUInteger inputWidth; +/// The height, in pixels, of the input color texture for the scaler. +@property (nonatomic, readonly) NSUInteger inputHeight; +/// The width, in pixels, of the output color texture for the scaler. +@property (nonatomic, readonly) NSUInteger outputWidth; +/// The height, in pixels, of the output color texture for the scaler. +@property (nonatomic, readonly) NSUInteger outputHeight; +/// The minimum input content scale this scaler supports. +@property (nonatomic, readonly) float inputContentMinScale; +/// The maximum input content scale this scaler supports. +@property (nonatomic, readonly) float inputContentMaxScale; + +/// The world-to-view transformation matrix this scaler uses as part of its operation. +@property (nonatomic) simd_float4x4 worldToViewMatrix; +/// The view-to-clip coordinates transformation matrix this scaler uses as part of its operation. +@property (nonatomic) simd_float4x4 viewToClipMatrix; + +/// An optional fence that this denoiser scaler waits for and updates. +/// +/// Use this property for synchronizing access to untracked resources. +@property (nonatomic, retain, nullable) id<MTLFence> fence; + +@end + +/// An upscaling effect that generates a higher resolution texture in a render pass by analyzing multiple input textures +/// over time and removing noise. +/// +/// You create instances of this class by calling ``MTLFXTemporalScalerDescriptor/newTemporalScalerWithDevice:``. +/// +/// When using instances of objects conforming to this protocol, you configure the different properties it +/// inherits from protocol ``MTLFXTemporalDenoisedScalerBase`` and then call ``encodeToCommandBuffer:`` to +/// encode its work into a Metal command buffer. +/// +/// See ``MTLFXTemporalDenoisedScalerBase`` for more details on configuring and using denoiser scalers. +/// +API_AVAILABLE(macos(26.0), ios(18.0)) +#if defined(TARGET_OS_VISION) && TARGET_OS_VISION +API_UNAVAILABLE(visionos) +#endif +@protocol MTLFXTemporalDenoisedScaler <MTLFXTemporalDenoisedScalerBase> + +/// Encode this scaler denoiser's work into a command buffer. +/// +/// - Parameters: +/// - commandBuffer: A command buffer into which this scaler denoiser encodes work. +/// +- (void)encodeToCommandBuffer:(nonnull id<MTLCommandBuffer>)commandBuffer; + +@end + diff -ruN /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXTemporalScaler.h /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXTemporalScaler.h --- /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXTemporalScaler.h	2025-04-19 00:45:52 +++ /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MTLFXTemporalScaler.h	2025-05-23 06:20:02 @@ -6,143 +6,336 @@ // #import <Metal/Metal.h> - +#import <Metal/MTL4Compiler.h> +// Forward declaration of Metal4FX scaler. +@protocol MTL4FXTemporalScaler; // Forward declaration. @protocol MTLFXTemporalScaler; +/// A set of properties that configure a temporal scaling effect, and a factory method that creates the effect. API_AVAILABLE(macos(13.0), ios(16.0)) #if defined(TARGET_OS_VISION) && TARGET_OS_VISION API_UNAVAILABLE(visionos) #endif @interface MTLFXTemporalScalerDescriptor : NSObject <NSCopying> -// These properties must be set to the respective Metal pixel formats for each texture that will be used with the scaler. +/// The pixel format of the input color texture for the temporal scaler you create with this descriptor. @property (readwrite, nonatomic) MTLPixelFormat colorTextureFormat; +/// The pixel format of the input depth texture for the temporal scaler you create with this descriptor. @property (readwrite, nonatomic) MTLPixelFormat depthTextureFormat; +/// The pixel format of the input motion texture for the temporal scaler you create with this descriptor. @property (readwrite, nonatomic) MTLPixelFormat motionTextureFormat; +/// The pixel format of the output texture for the temporal scaler you create with this descriptor. @property (readwrite, nonatomic) MTLPixelFormat outputTextureFormat; +/// The width of the input color texture for the temporal scaler you create with this descriptor. @property (readwrite, nonatomic) NSUInteger inputWidth; +/// The height of the input color texture for the temporal scaler you create with this descriptor. @property (readwrite, nonatomic) NSUInteger inputHeight; + +/// The width of the output color texture for the temporal scaler you create with this descriptor. @property (readwrite, nonatomic) NSUInteger outputWidth; +/// The height of the output color texture for the temporal scaler you create with this descriptor. @property (readwrite, nonatomic) NSUInteger outputHeight; -// Auto exposure property, setting this to YES to indicate for MetalFX -// to determine exposure per frame, which will ignore exposureTexture -// property on the scaler object. +/// A Boolean value that indicates whether MetalFX calculates the exposure for each frame. +/// +/// Set this property to <doc://com.apple.documentation/documentation/swift/true> to create a scaler that automatically +/// calculates the exposure level for each image it scales. +/// +/// * Note: Temporal scaler instances that use auto exposure ignore their ``MTLFXTemporalScalerBase/exposureTexture`` +/// property. +/// +/// This property's default value is <doc://com.apple.documentation/documentation/swift/false>. @property (readwrite, nonatomic, getter=isAutoExposureEnabled) BOOL autoExposureEnabled; -// requiresSynchronousInitialization property, setting this to YES ensures -// that the effect is fully created before first use, setting it to NO -// allows the implementation to create an optimized version asynchronously, this -// can cause the performance to be submoptimal while the optimized version is created. -// Defaults to NO. +/// A Boolean value that indicates whether MetalFX compiles a temporal scaling effect’s underlying upscaler as it +/// creates the instance. +/// +/// This property gives you the option to decide when it’s better for your app to give MetalFX the time it needs to +/// compile the underlying upscaler of the temporal scaling effect. The two choices are: +/// +/// * As you create the effect +/// * After you create the effect, likely when your app needs to upscale the initial textures +/// +/// You can create a temporal scaler that can upscale textures at its best speed +/// immediately after you create it by setting this property to <doc://com.apple.documentation/documentation/swift/true> +/// and then calling an initialization method like ``newTemporalScalerWithDevice:``. However, it may take MetalFX more +/// time for that method to return while it creates the denoiser scaler and compiles its underlying pipelines. +/// +/// By default, the property is equal to <doc://com.apple.documentation/documentation/swift/false>, which tells MetalFX +/// to quickly create and return the temporal scaling-effect instance, and then compile a faster upscaler in the background. +/// However, this means the effect can take more time to upscale textures while the framework compiles the underlying upscaler. +/// When the framework finishes compiling, the effect runs just as fast as if you set the property to +/// <doc://com.apple.documentation/documentation/swift/true>. +/// +/// * Note: The image quality of the effect’s output texture is consistent, whether it’s using the slower interim upscaler +/// or the final, faster upscaler. +/// @property (readwrite, nonatomic) BOOL requiresSynchronousInitialization; -// Dynamic Resolution properties -// Set inputContentPropertiesEnabled to YES to indicate 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.  +/// A Boolean value that indicates whether the temporal scaler you create with this descriptor uses dynamic resolution. +/// +/// When you set this property to <doc://com.apple.documentation/documentation/swift/true> to enable dynamic resolution, +/// scale properties ``inputContentMinScale`` and ``inputContentMaxScale`` represent the input and output resolution +/// both the width and height. +/// +/// * Note: The scaler assumes that aspect ratio of the input and output textures doesn't change. +/// @property (readwrite, nonatomic, getter=isInputContentPropertiesEnabled) BOOL inputContentPropertiesEnabled; + +/// The smallest scale factor the temporal scaler you create with this descriptor can use to generate output textures. @property (readwrite, nonatomic) float inputContentMinScale; + +/// The largest scale factor the temporal scaler you create with this descriptor can use to generate output textures. @property (readwrite, nonatomic) float inputContentMaxScale; + +/// A Boolean value that indicates whether a temporal scaler you create with the descriptor applies a reactive mask. @property (readwrite, nonatomic, getter=isReactiveMaskTextureEnabled) BOOL reactiveMaskTextureEnabled API_AVAILABLE(macos(14.4), ios(17.4)); + +/// The pixel format of the reactive mask input texture for a temporal scaler you create with the descriptor. @property (readwrite, nonatomic) MTLPixelFormat reactiveMaskTextureFormat API_AVAILABLE(macos(14.4), ios(17.4)); -// The following method is used to instantiate the effect encoder for a given -// Metal device. +/// Creates a temporal scaler instance for a Metal device. +/// +/// - Parameters: +/// - device: The Metal device that creates the temporal scaler. +/// - Returns: +/// A new temporal scaler instance upon success, or `nil` otherwise. - (nullable id <MTLFXTemporalScaler>)newTemporalScalerWithDevice:(nonnull id<MTLDevice>)device; -// Class methods for querying supported min/max input content scale. +/// Creates a temporal scaler instance for a Metal device. +/// +/// - Parameters: +/// - device: The Metal device that creates the temporal scaler. +/// - compiler: A compiler instance this method can use to build pipeline state objects. +/// - Returns: +/// A new temporal scaler instance upon success, or `nil` otherwise. +- (nullable id <MTL4FXTemporalScaler>)newTemporalScalerWithDevice:(nonnull id<MTLDevice>)device compiler:(nonnull id<MTL4Compiler>)compiler API_AVAILABLE(macos(26.0), ios(26.0)); + +/// Returns the smallest temporal scaling factor the device supports as a floating-point value. +/// +/// - Parameters: +/// - device: The Metal device for which this method performs this check. +/// +/// - Returns: the minimum input content scale the GPU device supports. + (float)supportedInputContentMinScaleForDevice:(nonnull id<MTLDevice>)device API_AVAILABLE(macos(14.0), ios(17.0)); + +/// Returns the largest temporal scaling factor the device supports as a floating-point value. +/// +/// - Parameters: +/// - device: The Metal device for which this method performs this check. +/// +/// - Returns: the maximum input content scale the GPU device supports. + (float)supportedInputContentMaxScaleForDevice:(nonnull id<MTLDevice>)device API_AVAILABLE(macos(14.0), ios(17.0)); -// Class method for determining support +/// Returns a Boolean value that indicates whether the temporal scaler works with a GPU. +/// +/// - Parameters: +/// - device: A device instance that represents a GPU. +/// +/// - Returns: <doc://com.apple.documentation/documentation/swift/true> if the device supports temporal scaling, +/// <doc://com.apple.documentation/documentation/swift/false> otherwise. + (BOOL)supportsDevice:(nonnull id<MTLDevice>)device; +/// Queries whether a Metal device supports temporal scaling compatible with Metal 4. +/// +/// - Parameters: +/// - device: The GPU device for which this methods tests support. +/// +/// - Returns: <doc://com.apple.documentation/documentation/swift/true> if the device supports temporal scaling with +/// Metal 4, <doc://com.apple.documentation/documentation/swift/false> otherwise. ++ (BOOL)supportsMetal4FX:(nonnull id<MTLDevice>)device API_AVAILABLE(macos(26.0), ios(26.0)); + @end -// This is the object that gets created from the descriptor -API_AVAILABLE(macos(13.0), ios(16.0)) -#if defined(TARGET_OS_VISION) && TARGET_OS_VISION -API_UNAVAILABLE(visionos) -#endif -@protocol MTLFXTemporalScaler <NSObject> +/// An upscaling effect that generates a higher resolution texture in a render pass by analyzing multiple input +/// textures over time. +/// +/// The MetalFX temporal scaler increases the size of your input texture to a larger output texture. You can use the +/// scaler to upscale every frame of your app’s scene or rendering in real time. With a scaler, you can draw more +/// complicated scenes in less time by intentionally rendering to a lower resolution to save time before upscaling. +/// +/// Create an ``MTLFXTemporalScaler`` instance by following these steps: +/// 1. Create and configure an ``MTLFXTemporalScalerDescriptor`` instance. +/// 2. Call the descriptor’s ``newTemporalScalerWithDevice:`` method. +/// +/// Upscale a rendering by following these steps for every render pass: +/// 1. Set the temporal scaler’s ``colorTexture`` property to the input texture. +/// 2. Set the scaler’s ``inputContentWidth`` and ``inputContentHeight`` properties. +/// 3. Set the scaler’s ``outputTexture`` property to your destination texture. +/// 4. Encode the upscale commands to a command buffer by calling the temporal scaler’s +/// ``MTLFXTemporalScaler/encodeToCommandBuffer:`` method. +///  +/// ## Conforming to texture usage requirements +/// +/// Temporal scalers expose properties, such as ``colorTextureUsage``, that indicate requirements for +/// your textures to be compatible with it. These properties indicate the minimum set of ``MTLTextureUsage`` bits +/// that you are responsible for setting in your texture descriptors for this spatial scaler to use them. +/// +/// Your game or app can set extra usage bits on your textures without losing compatibility, as long at its maintains +/// the minimum set the scaler requests. +/// +/// ## Assigning input and output textures +/// +/// When you use an instance of a class that conforms to this protocol, you typically set its input and output textures, +/// as well as other properties, and then encode its work to a command buffer. +/// +/// MetalFX doesn't track that you assign the same texture instances to each property across different batches of work, +/// the only requirement is that you provide textures that match the pixel formats and dimensions you specify in the +/// ``MTLFXTemporalScalerDescriptor`` descriptor instance that creates the scaler instance. +/// +@protocol MTLFXTemporalScalerBase <NSObject> -// Properties return the minimum required MTLTextureUsage bits required +/// The minimal texture usage options that your app’s input color texture needs in order to support this scaler. @property (nonatomic, readonly) MTLTextureUsage colorTextureUsage; +/// The minimal texture usage options that your app’s input depth texture needs in order to support this scaler. @property (nonatomic, readonly) MTLTextureUsage depthTextureUsage; +/// The minimal texture usage options that your app’s motion texture needs in order to support this scaler. @property (nonatomic, readonly) MTLTextureUsage motionTextureUsage; -@property (nonatomic, readonly) MTLTextureUsage reactiveTextureUsage API_AVAILABLE(macos(14.4), ios(17.4)); +/// The minimal texture usage options that your app’s reactive texture needs in order to support this scaler. +@property (nonatomic, readonly) MTLTextureUsage reactiveTextureUsage; + +/// The minimal texture usage options that your output texture needs in order to support this scaler. @property (nonatomic, readonly) MTLTextureUsage outputTextureUsage; -// Dynamic Resolution property +/// The width, in pixels, of the region within the color texture the scaler uses as its input. @property (nonatomic) NSUInteger inputContentWidth; +/// The height, in pixels, of the region within the color texture the scaler uses as its input. @property (nonatomic) NSUInteger inputContentHeight; -// These can 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. +/// An input color texture you set for the scaler that supports the correct color texture usage options. @property (nonatomic, retain, nullable) id<MTLTexture> colorTexture; +/// An input depth texture you set for the scaler that supports the correct color texture usage options. @property (nonatomic, retain, nullable) id<MTLTexture> depthTexture; +/// An input motion texture you set for the scaler that supports the correct color texture usage options. @property (nonatomic, retain, nullable) id<MTLTexture> motionTexture; -// outputTexture is required to have MTLStorageModePrivate for storageMode + +/// The output texture into which this scaler writes its output. +/// +/// You are responsible for providing a texture with a private `storageMode` to this property. @property (nonatomic, retain, nullable) id<MTLTexture> outputTexture; -// Exposure properties -// Ideally this is a 1x1 R16F texture. Note that only R channel of -// the texel located at (0, 0) is used for exposure value. The value is used -// to multiply the input color, use GPU to generate the exposure value. +/// The exposure texture this scaler uses. +/// +/// Create and assign a 1x1 ``MTLPixelFormatR16Float`` texture to assign to this property. MetalFX reads the R channel +/// of the texel at position `(0,0)` and uses it as the exposure value. It then uses this value to multiply the input color. +/// +/// For best performance, use the GPU to generate the exposure value and store it into this texture. +/// +/// * Note: The temporal scaler ignores this property if you create it with a descriptor that has its +/// ``MTLFXTemporalScalerDescriptor/autoExposureEnabled`` property set to +/// <doc://com.apple.documentation/documentation/swift/true>. @property (nonatomic, retain, nullable) id<MTLTexture> exposureTexture; -// Reactive mask -// An optional single channel texture that contains values in the range -// 0.0f-1.0f. A value of 0.0f applies the default temporal effect treatment. -// A value greater than 0.0f applies a bias towards the current frame for -// the pixel. -@property (nonatomic, retain, nullable) id<MTLTexture> reactiveMaskTexture API_AVAILABLE(macos(14.4), ios(17.4)); -// If the input color is pre-multiplied by fixed value, set this value -// which MetalFX will use to divide input color, this is not common. +/// The reactive-mask texture input this scaler uses. +/// +/// This texture helps guide the denoiser when objects move quickly in a scene with inaccurate motion information, +/// such as when they involve alpha blending. In these situations, you can get better results by guiding MetalFX whether +/// to favor the current frame on a per-pixel basis with a reactive mask texture. +/// +/// When providing this texture, you are responsible for ensuring each pixel is in the range `[0.0, 1.0]`, where a value: +/// * Equal to `0.0` tells MetalFX to follow its normal behavior for the corresponding pixel +/// * Equal to `1.0` tells MetalFX to ignore temporal history for the corresponding pixel +/// * In the range `(0.0, 1.0)` proportionally blends the effect for the corresponding pixel +/// +@property (nonatomic, retain, nullable) id<MTLTexture> reactiveMaskTexture; +/// A pre-exposure value this scaler evaluates. +/// +/// If the input color texture you assign to ``colorTexture`` is pre-multiplied by fixed value, set this property +/// to that same fixed value so MetalFX divides input color by it. This is not a common situation and you typically +/// don't need to assign a value to this property. @property (nonatomic) float preExposure; -// The jitter offset property indicates the pixel offset to sample in order to -// return to the frame's reference frame. +/// The horizontal component of the subpixel sampling coordinate you use to generate the color texture input. +/// +/// This property indicates the horizontal pixel offset this scaler samples to return to the frame's reference frame. @property (nonatomic) float jitterOffsetX; + +/// The vertical component of the subpixel sampling coordinate you use to generate the color texture input. +/// +/// This property indicates the vertical pixel offset this scaler samples to return to the frame's reference frame. @property (nonatomic) float jitterOffsetY; -// 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. +/// The horizontal scale factor the scaler applies to the input motion texture. +/// +/// The scaler converts the horizontal component of each value in ``motionTexture`` into fragment (pixel) +/// coordinates by multiplying it by this property’s value. +/// +/// If you set this property's value to `1.0`, this temporal scaler expects that each pixel's motion vector points +/// to that pixel's location in the ``colorTexture`` at the time of the last call to encode this scaler's work. For example, +/// in Metal's standard device coordinates, where `(0,0)` represents the upper-left corner of the framebuffer, the motion +/// vectors for an object that moves down and to the right in the ``colorTexture`` by `10` pixels would be `(-10,-10)`. @property (nonatomic) float motionVectorScaleX; + +/// The vertical scale factor the scaler applies to the input motion texture. +/// +/// The scaler converts the horizontal component of each value in ``motionTexture`` into fragment (pixel) +/// coordinates by multiplying it by this property’s value. +/// +/// If you set this property's value to `1.0`, this temporal scaler expects that each pixel's motion vector points +/// to that pixel's location in the ``colorTexture`` at the time of the last call to encode this scaler's work. For example, +/// in Metal's standard device coordinates, where `(0,0)` represents the upper-left corner of the framebuffer, the motion +/// vectors for an object that moves down and to the right in the ``colorTexture`` by `10` pixels would be `(-10,-10)`. @property (nonatomic) float motionVectorScaleY; -// Reset. Set to true when history is invalid (scene cut, etc.) +/// A Boolean that indicates whether the temporal scaler discards historical data from previous frames. @property (nonatomic) BOOL reset; -// Set whether the depth buffer uses reversed depth or not. Defaults to YES. +/// A Boolean value that indicates whether the depth texture uses zero to represent the farthest distance. @property (readwrite, nonatomic, getter=isDepthReversed) BOOL depthReversed; -// Read-only immutable properties of effect +/// The pixel format of the input color texture for this this scaler. @property (nonatomic, readonly) MTLPixelFormat colorTextureFormat; +/// The pixel format of the input depth texture for this this scaler. @property (nonatomic, readonly) MTLPixelFormat depthTextureFormat; +/// The pixel format of the input motion texture for this this scaler. @property (nonatomic, readonly) MTLPixelFormat motionTextureFormat; +/// The pixel format of the input reactive mask texture for this this scaler. +@property (nonatomic, readonly) MTLPixelFormat reactiveMaskTextureFormat; +/// The pixel format of the output color texture for this this scaler. @property (nonatomic, readonly) MTLPixelFormat outputTextureFormat; +/// The width, in pixels, of the input color texture for this scaler. @property (nonatomic, readonly) NSUInteger inputWidth; +/// The height, in pixels, of the input color texture for this scaler. @property (nonatomic, readonly) NSUInteger inputHeight; +/// The width, in pixels, of the output color texture for this scaler. @property (nonatomic, readonly) NSUInteger outputWidth; +/// The height, in pixels, of the output color texture for this scaler. @property (nonatomic, readonly) NSUInteger outputHeight; + +/// The smallest scale factor the temporal scaler can use to generate output textures. @property (nonatomic, readonly) float inputContentMinScale; +/// The largest scale factor the temporal scaler can use to generate output textures. @property (nonatomic, readonly) float inputContentMaxScale; -// Property for synchronization when using untracked resources +/// An optional fence that you provide to synchronize your app’s untracked resources. @property (nonatomic, retain, nullable) id<MTLFence> fence; -// Method to encode the effect to a command buffer +@end + +/// An upscaling effect that generates a higher resolution texture in a render pass by analyzing multiple input textures over time. +/// +/// You create instances of this class by calling ``MTLFXTemporalScalerDescriptor/newTemporalScalerWithDevice:``. +/// +/// When using instances of objects conforming to this protocol, you configure the different properties it +/// inherits from protocol ``MTLFXTemporalScalerBase`` and then call ``encodeToCommandBuffer:`` to +/// encode its work into a Metal command buffer. +/// +/// See ``MTLFXTemporalScalerBase`` for more details on configuring and using spatial scalers. +/// +API_AVAILABLE(macos(13.0), ios(16.0)) +#if defined(TARGET_OS_VISION) && TARGET_OS_VISION +API_UNAVAILABLE(visionos) +#endif +@protocol MTLFXTemporalScaler <MTLFXTemporalScalerBase> + +/// Encode this spatial scaler work into a command buffer. +/// +/// - Parameters: +/// - commandBuffer: A command buffer into which this spatial scaler encodes work. +/// - (void)encodeToCommandBuffer:(nonnull id<MTLCommandBuffer>)commandBuffer; @end diff -ruN /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MetalFX.h /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MetalFX.h --- /Applications/Xcode_16.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MetalFX.h	2025-04-19 04:28:15 +++ /Applications/Xcode_26.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalFX.framework/Headers/MetalFX.h	2025-05-23 06:41:44 @@ -7,5 +7,10 @@ #import <MetalFX/MTLFXDefines.h> #import <MetalFX/MTLFXTemporalScaler.h> +#import <MetalFX/MTLFXTemporalDenoisedScaler.h> #import <MetalFX/MTLFXSpatialScaler.h> - +#import <MetalFX/MTLFXFrameInterpolator.h> +#import <MetalFX/MTL4FXSpatialScaler.h> +#import <MetalFX/MTL4FXTemporalScaler.h> +#import <MetalFX/MTL4FXTemporalDenoisedScaler.h> +#import <MetalFX/MTL4FXFrameInterpolator.h> 
Clone this wiki locally