MTLFXSpatialScaler
An upscaling effect that generates a higher resolution texture in a render pass by spatially analyzing an input texture.
Declaration
protocol MTLFXSpatialScaler : MTLFXSpatialScalerBaseOverview
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:
Create and configure an MTLFXSpatialScalerDescriptor instance.
Call the descriptor’s makeSpatialScaler(device:) method.
Upscale a rendering by following these steps for every render pass:
Set the spatial scaler’s
MTLFXSpatialScaler/colorTextureproperty to the input texture.Set the scaler’s
MTLFXSpatialScaler/inputContentWidthandMTLFXSpatialScaler/inputContentHeightproperties.Set the scaler’s
MTLFXSpatialScaler/outputTextureproperty to your destination texture.Encode the upscale commands to an MTLCommandBuffer by calling the spatial scaler’s encode(commandBuffer:) method.