Skip to main content

Crate bevy_metalfx

Crate bevy_metalfx 

Source
Expand description

Bevy plugin for Apple MetalFX upscaling and frame interpolation.

Uses objc2-metal-fx for MetalFX framework bindings and integrates as a render graph node replacing Bevy’s built-in upscaling.

If you are reading this on docs.rs, you are seeing the non-macOS stub.

Almost everything here is #[cfg(target_os = "macos")], and docs.rs builds on Linux. The present and gpu_timing modules are missing from the rendered page entirely, and MetalFxPlugin shows two of its four fields.

Pinning docs.rs to an Apple target does not work: it cross-compiles from a Linux container and must still build the dependency graph, and blake3 (via bevy_asset) has a C build script that needs an Apple toolchain. That was tried in 0.2.0 and produced no docs page at all.

For the real API: cargo doc --open -p bevy_metalfx --all-features on a Mac, or read the source.

§Supported Modes

  • Spatial: Single-frame ML upscaling (macOS 13+)
  • Temporal: Multi-frame temporal upscaling with motion vectors (macOS 13+)
  • FrameInterpolation: Generate intermediate frames (macOS 26+, Metal 4)

Each mode has a matching cargo feature, and the features are cumulative: frame-interpolation implies temporal implies spatial. They gate both this crate’s encode paths and the objc2-metal-fx bindings behind them, so a narrower feature set really does compile a narrower surface.

§What is and is not verified

Spatial and temporal upscaling are complete and stable. Frame interpolation computes a correct intermediate frame and, with present::MetalFxDualPresent enabled, presents it — at twice the accepted-present rate of a single present, with the render rate unchanged. Whether the extra frame reaches the display is unverified: see the present module for what that depends on.

(Deliberately not intra-doc links: present is macOS-only, and docs.rs renders this page from a Linux build where the link target does not exist.)

Structs§

AdaptiveScaleState
Adaptive render scale state — tracks frame times and manages scale transitions.
MetalFxConfig
Render-world configuration (stub for non-macOS platforms).
MetalFxLabel
Render graph label for the MetalFX upscale node.
MetalFxModeResource
Main-world resource reporting the MetalFX mode actually in effect.
MetalFxPlugin
Configuration for the MetalFX plugin.
MetalFxRenderScale
Main-world resource holding the render scale for resolution override systems.
MetalFxUpscaleNode
Render graph node (stub for non-macOS platforms — does nothing).

Enums§

MetalFxMode
MetalFX operating mode.

Functions§

is_available
Check whether MetalFX is available on this system at runtime.
probe_spatial_scaler
Probe whether a spatial scaler can be created for the given render device.