Contents

MTLFXTemporalScalerBase

An upscaling effect that generates a higher resolution texture in a render pass by analyzing multiple input textures over time.

Declaration

protocol MTLFXTemporalScalerBase : MTLFXFrameInterpolatableScaler

Overview

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 encode(commandBuffer:) 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.

Topics

Instance Properties