Contents

MTLFXSpatialScaler

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

Declaration

protocol MTLFXSpatialScaler : MTLFXSpatialScalerBase

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 instance following these steps:

  1. Create and configure an MTLFXSpatialScalerDescriptor instance.

  2. Call the descriptor’s makeSpatialScaler(device:) method.

Upscale a rendering by following these steps for every render pass:

  1. Set the spatial scaler’s MTLFXSpatialScaler/colorTexture property to the input texture.

  2. Set the scaler’s MTLFXSpatialScaler/inputContentWidth and MTLFXSpatialScaler/inputContentHeight properties.

  3. Set the scaler’s MTLFXSpatialScaler/outputTexture property to your destination texture.

  4. Encode the upscale commands to an MTLCommandBuffer by calling the spatial scaler’s encode(commandBuffer:) method.

Topics

Encoding a spatial scaler

See Also

Spatial scaling