<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 27.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalFX",
  "identifier" : "/documentation/MetalFX/MTLFXSpatialScalerBase",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "MetalFX"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLFXSpatialScalerBase"
  },
  "title" : "MTLFXSpatialScalerBase"
}
-->

# MTLFXSpatialScalerBase

An upscaling effect that generates a higher resolution texture in a render pass by spatially analyzing an input texture.

```
protocol MTLFXSpatialScalerBase : NSObjectProtocol
```

## Overview

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`](/documentation/MetalFX/MTLFXSpatialScaler) instance following these steps:

1. Create and configure an [`MTLFXSpatialScalerDescriptor`](/documentation/MetalFX/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`](/documentation/MetalFX/MTLFXSpatialScalerBase/colorTexture) property to the input texture.
2. Set the scaler’s [`inputContentWidth`](/documentation/MetalFX/MTLFXSpatialScalerBase/inputContentWidth) and [`inputContentHeight`](/documentation/MetalFX/MTLFXSpatialScalerBase/inputContentHeight) properties.
3. Set the scaler’s [`outputTexture`](/documentation/MetalFX/MTLFXSpatialScalerBase/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`](/documentation/MetalFX/MTLFXSpatialScalerBase/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`](/documentation/MetalFX/MTLFXSpatialScalerDescriptor) descriptor instance that creates the scaler instance.

## Topics

### Instance Properties

[`var colorProcessingMode: MTLFXSpatialScalerColorProcessingMode`](/documentation/MetalFX/MTLFXSpatialScalerBase/colorProcessingMode)

The color processing mode you set in this spatial scaler’s descriptor.

[`var colorTexture: (any MTLTexture)?`](/documentation/MetalFX/MTLFXSpatialScalerBase/colorTexture)

Input color texture you set for the scaler that supports the correct color texture usage options.

[`var colorTextureFormat: MTLPixelFormat`](/documentation/MetalFX/MTLFXSpatialScalerBase/colorTextureFormat)

The pixel format of the input color texture for this this scaler.

[`var colorTextureUsage: MTLTextureUsage`](/documentation/MetalFX/MTLFXSpatialScalerBase/colorTextureUsage)

The minimal texture usage options that your app’s input color texture needs in order to support this scaler.

[`var fence: (any MTLFence)?`](/documentation/MetalFX/MTLFXSpatialScalerBase/fence)

An optional fence that you provide to synchronize your app’s untracked resources.

[`var inputContentHeight: Int`](/documentation/MetalFX/MTLFXSpatialScalerBase/inputContentHeight)

The height, in pixels, of the region within the color texture the scaler uses as its input.

[`var inputContentWidth: Int`](/documentation/MetalFX/MTLFXSpatialScalerBase/inputContentWidth)

The width, in pixels, of the region within the color texture the scaler uses as its input.

[`var inputHeight: Int`](/documentation/MetalFX/MTLFXSpatialScalerBase/inputHeight)

The height, in pixels, of the input color texture for this scaler.

[`var inputWidth: Int`](/documentation/MetalFX/MTLFXSpatialScalerBase/inputWidth)

The width, in pixels, of the input color texture for this scaler.

[`var outputHeight: Int`](/documentation/MetalFX/MTLFXSpatialScalerBase/outputHeight)

The height, in pixels, of the output color texture for this scaler.

[`var outputTexture: (any MTLTexture)?`](/documentation/MetalFX/MTLFXSpatialScalerBase/outputTexture)

The output texture into which this scaler writes its output.

[`var outputTextureFormat: MTLPixelFormat`](/documentation/MetalFX/MTLFXSpatialScalerBase/outputTextureFormat)

The pixel format of the output color texture for this this scaler.

[`var outputTextureUsage: MTLTextureUsage`](/documentation/MetalFX/MTLFXSpatialScalerBase/outputTextureUsage)

The minimal texture usage options that your app’s output color texture needs in order to support this scaler.

[`var outputWidth: Int`](/documentation/MetalFX/MTLFXSpatialScalerBase/outputWidth)

The width, in pixels, of the output color texture for this scaler.

## Relationships

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

### Inherited By

[`MTLFXSpatialScaler`](/documentation/MetalFX/MTLFXSpatialScaler)

[`MTL4FXSpatialScaler`](/documentation/MetalFX/MTL4FXSpatialScaler)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)