Proposal: serve the title's FidelityFX upscaler with MetalFX on Apple hosts (and MetalFX frame interpolation later) #375

Open
opened 2026-11-27 14:35:02 +00:00 by Hayyan612 · 4 comments
Hayyan612 commented 2026-11-27 14:35:02 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Hayyan612 on 2026-11-27T14:35:02Z.


Proposal, not claimed. Writing it down for discussion before anyone builds it; I can't verify it in a game run yet.

Idea

modules/fidelityfx.rs already intercepts the title's FidelityFX API (ffxCreateContext / ffxConfigure / ffxQuery / ffxDispatch) and passes it to a PC FidelityFX build when VICTORY_FIDELITYFX_DIR names one. On Apple hosts, the same seam could serve the upscale with MetalFX Temporal (MTLFXTemporalScaler) instead, from the inputs the dispatch already carries: colour, depth and motion vectors (host copies via victory_gpu::external), jitter, motion-vector scale, render and output sizes, reset.

Why it may help on Macs:

  • FSR's upscale passes are large compute shaders that go through translation (wave64 on 32-lane GPUs, refusals); MetalFX runs natively on the GPU.
  • With a lower render size, it is a frame-rate lever for 16 GB / base-chip Macs, not only image quality.

Frame generation (later)

The module refuses FidelityFX frame generation today. macOS/iPadOS 26 have MetalFX frame interpolation (MTLFXFrameInterpolator), fed by the same depth, motion and camera values. Another project reports this on its own title (God of War III on Apple Silicon, M4 Pro): 53 fps native, 67 with MetalFX Temporal, about 117 shown with interpolation. Different game, so only an indication.

Prior art

  • OptiScaler (GPL-3.0) swaps upscalers behind the FSR/DLSS/XeSS APIs on PC, the same technique.
  • WickedEngine (MIT) has a small reference integration of MTLFXFrameInterpolator.

Open questions

  1. Which FidelityFX API version and descriptor chain the title uses (upscale only, or frame generation too), and whether it supplies a reactive / transparency mask.
  2. Jitter and motion-vector conventions: MetalFX expects jitter in pixels and motion in render-target pixels; FSR's sign and scale differ.
  3. Where the HUD is composited (before or after the upscale), which decides whether interpolation smears it.
  4. Whether this belongs behind an opt-in variable first (VICTORY_METALFX=1), as VICTORY_FIDELITYFX_DIR is.

Refs #8 (memory and frame rate on 16 GB Macs), #179 (world frame rate).

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6648497213 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/375). Originally posted by [Hayyan612](https://github.com/Hayyan612) on 2026-11-27T14:35:02Z. --- **Proposal, not claimed.** Writing it down for discussion before anyone builds it; I can't verify it in a game run yet. ## Idea `modules/fidelityfx.rs` already intercepts the title's FidelityFX API (`ffxCreateContext` / `ffxConfigure` / `ffxQuery` / `ffxDispatch`) and passes it to a PC FidelityFX build when `VICTORY_FIDELITYFX_DIR` names one. On Apple hosts, the same seam could serve the upscale with **MetalFX Temporal** (`MTLFXTemporalScaler`) instead, from the inputs the dispatch already carries: colour, depth and motion vectors (host copies via `victory_gpu::external`), jitter, motion-vector scale, render and output sizes, reset. Why it may help on Macs: - FSR's upscale passes are large compute shaders that go through translation (wave64 on 32-lane GPUs, refusals); MetalFX runs natively on the GPU. - With a lower render size, it is a frame-rate lever for 16 GB / base-chip Macs, not only image quality. ## Frame generation (later) The module refuses FidelityFX frame generation today. macOS/iPadOS 26 have **MetalFX frame interpolation** (`MTLFXFrameInterpolator`), fed by the same depth, motion and camera values. Another project reports this on its own title (God of War III on Apple Silicon, M4 Pro): 53 fps native, 67 with MetalFX Temporal, about 117 shown with interpolation. Different game, so only an indication. ## Prior art - OptiScaler (GPL-3.0) swaps upscalers behind the FSR/DLSS/XeSS APIs on PC, the same technique. - WickedEngine (MIT) has a small reference integration of `MTLFXFrameInterpolator`. ## Open questions 1. Which FidelityFX API version and descriptor chain the title uses (upscale only, or frame generation too), and whether it supplies a reactive / transparency mask. 2. Jitter and motion-vector conventions: MetalFX expects jitter in pixels and motion in render-target pixels; FSR's sign and scale differ. 3. Where the HUD is composited (before or after the upscale), which decides whether interpolation smears it. 4. Whether this belongs behind an opt-in variable first (`VICTORY_METALFX=1`), as `VICTORY_FIDELITYFX_DIR` is. Refs #8 (memory and frame rate on 16 GB Macs), #179 (world frame rate).
wz11wz commented 2026-11-27 14:50:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by wz11wz on 2026-11-27T14:50:16Z.


Claiming. Plan, grounded in the current code:

ffxDispatch already resolves all seven resources (colour, depth, motion, exposure, reactive, transparent, output) to host textures via external::host_texture, and DispatchUpscale is fully decoded (0x1b0; rest[18] = jitter, mv scale, sizes, sharpening, frame time, pre-exposure, reset, camera, flags - pass-through today). So an Apple provider replaces only the backend, not the interception.

  1. Spike - objc2-metal-fx into victory-metal; one MTLFXTemporalScaler frame over synthetic textures, output dumped and diffed. Settles the API surface and format support set with no title needed.
  2. Context - behind VICTORY_METALFX=1: CREATE_UPSCALE builds an MTLFXTemporalScalerDescriptor from CreateUpscale (max sizes; flags -> auto-exposure / reactive / transparent).
  3. Dispatch - map the seven resources. Expected friction: motion-vector conventions and scale (verified with a dump-and-compare harness first), MetalFX's narrow format set (Metal view casting where possible, once! refuse otherwise), auto vs texture exposure. Jitter/sizes/reset from rest[18]; sharpening has no MetalFX equivalent.
  4. Verify in a real run - I have the game and can run it, which the proposal notes is missing today: VICTORY_DUMP_TARGETS FSR vs MetalFX on the same frames, frame meter, 10+ min stability.
  5. PR - docs/native-host.md entry, parity notes, gate green (#370). Frame interpolation is out of scope here; the seam stays open for it. Implemented from Apple's MetalFX docs only; OptiScaler is prior art for the idea, not code.

Corrections welcome before I start.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7221291065 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/375#issuecomment-7221291065). Originally posted by [wz11wz](https://github.com/wz11wz) on 2026-11-27T14:50:16Z. --- Claiming. Plan, grounded in the current code: `ffxDispatch` already resolves all seven resources (colour, depth, motion, exposure, reactive, transparent, output) to host textures via `external::host_texture`, and `DispatchUpscale` is fully decoded (0x1b0; `rest[18]` = jitter, mv scale, sizes, sharpening, frame time, pre-exposure, reset, camera, flags - pass-through today). So an Apple provider replaces only the backend, not the interception. 1. **Spike** - `objc2-metal-fx` into `victory-metal`; one `MTLFXTemporalScaler` frame over synthetic textures, output dumped and diffed. Settles the API surface and format support set with no title needed. 2. **Context** - behind `VICTORY_METALFX=1`: `CREATE_UPSCALE` builds an `MTLFXTemporalScalerDescriptor` from `CreateUpscale` (max sizes; flags -> auto-exposure / reactive / transparent). 3. **Dispatch** - map the seven resources. Expected friction: motion-vector conventions and scale (verified with a dump-and-compare harness first), MetalFX's narrow format set (Metal view casting where possible, `once!` refuse otherwise), auto vs texture exposure. Jitter/sizes/reset from `rest[18]`; sharpening has no MetalFX equivalent. 4. **Verify in a real run** - I have the game and can run it, which the proposal notes is missing today: `VICTORY_DUMP_TARGETS` FSR vs MetalFX on the same frames, frame meter, 10+ min stability. 5. **PR** - `docs/native-host.md` entry, parity notes, gate green (#370). Frame interpolation is out of scope here; the seam stays open for it. Implemented from Apple's MetalFX docs only; OptiScaler is prior art for the idea, not code. Corrections welcome before I start.
Hayyan612 commented 2026-11-27 15:29:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Hayyan612 on 2026-11-27T15:29:16Z.


Thanks @wz11wz, that plan looks right, and a dump-and-compare against FSR on the same frames is the check it needed.

One small request: MetalFX (MTLFXTemporalScaler, and later MTLFXFrameInterpolator) also exists on iOS and iPadOS, so gating the new code on target_vendor = "apple" rather than target_os = "macos" would keep it usable on any Apple host at no cost on the Mac.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7222117003 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/375#issuecomment-7222117003). Originally posted by [Hayyan612](https://github.com/Hayyan612) on 2026-11-27T15:29:16Z. --- Thanks @wz11wz, that plan looks right, and a dump-and-compare against FSR on the same frames is the check it needed. One small request: MetalFX (`MTLFXTemporalScaler`, and later `MTLFXFrameInterpolator`) also exists on iOS and iPadOS, so gating the new code on `target_vendor = "apple"` rather than `target_os = "macos"` would keep it usable on any Apple host at no cost on the Mac.
AnastasisKon commented 2026-11-28 17:57:03 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T17:57:03Z.


/claim — starting with the piece both halves need.

What I found reading it today. victory_metal::metalfx already wraps all three objects (Spatial, Temporal, Interpolator), and each has a GPU test that encodes one and waits for the command buffer. metalfx::spatial() is even on a path (VICTORY_METALFX=spatial scales the presented plane). What is missing is not a MetalFX object but a seam: nothing outside victory-metal can hand MetalFX a title texture, because gfx::Texture's MTLTexture is private.

Where the inputs come from. The dispatch this module already parses carries exactly MetalFX's inputs, in DispatchUpscale: resources[0..7] are colour, depth, motion vectors, exposure, reactive, transparency and output, as the title's ID3D12Resource pointers, then jitter, motion-vector scale, render and output sizes, sharpening, frame time, pre-exposure and reset in rest. victory-gpu/src/native/textures.rs keys its texture registry by that same pointer (TextureInfo, texture_of, target_of), so a resource pointer is enough to reach the backend texture — no title-side identification of the depth or motion pass is needed, which is what the module's comment says is missing.

Plan, in slices.

  1. metalfx::Upscale: one scaler chosen from Mode { Spatial, Temporal } — temporal when the dispatch carries depth and motion vectors and the OS has it, spatial otherwise — with the descriptor formats derived from the textures the caller hands it. Both modes encoded, GPU-tested. This is the foundation for both halves.
  2. Serve ffxDispatch's upscale with it (SR), on the native path: the title's own FidelityFX DLL runs there today, so this is a provider in modules/fidelityfx.rs rather than the VICTORY_FIDELITYFX_DIR path, which needs a Windows DLL.
  3. Frame generation: keep the previous frame's colour and depth from slice 2, encode Interpolator between them and present the generated frame in between. The UI texture stays unset first, so a first version interpolates the HUD with the scene.

Blocker, stated up front. The folder on this machine is 66% downloaded and shaders.rpf reads as zeros (#632), so a run cannot validate anything yet. Slice 1 is verifiable here (GPU tests); slices 2 and 3 will need a run on complete data.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7243412723 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/375#issuecomment-7243412723). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T17:57:03Z. --- /claim — starting with the piece both halves need. **What I found reading it today.** `victory_metal::metalfx` already wraps all three objects (`Spatial`, `Temporal`, `Interpolator`), and each has a GPU test that encodes one and waits for the command buffer. `metalfx::spatial()` is even on a path (`VICTORY_METALFX=spatial` scales the presented plane). What is missing is not a MetalFX object but a seam: nothing outside `victory-metal` can hand MetalFX a *title* texture, because `gfx::Texture`'s `MTLTexture` is private. **Where the inputs come from.** The dispatch this module already parses carries exactly MetalFX's inputs, in `DispatchUpscale`: `resources[0..7]` are colour, depth, motion vectors, exposure, reactive, transparency and output, as the title's `ID3D12Resource` pointers, then jitter, motion-vector scale, render and output sizes, sharpening, frame time, pre-exposure and reset in `rest`. `victory-gpu/src/native/textures.rs` keys its texture registry by that same pointer (`TextureInfo`, `texture_of`, `target_of`), so a resource pointer is enough to reach the backend texture — no title-side identification of the depth or motion pass is needed, which is what the module's comment says is missing. **Plan, in slices.** 1. `metalfx::Upscale`: one scaler chosen from `Mode { Spatial, Temporal }` — temporal when the dispatch carries depth and motion vectors and the OS has it, spatial otherwise — with the descriptor formats derived from the textures the caller hands it. Both modes encoded, GPU-tested. This is the foundation for both halves. 2. Serve `ffxDispatch`'s upscale with it (SR), on the native path: the title's own FidelityFX DLL runs there today, so this is a provider in `modules/fidelityfx.rs` rather than the `VICTORY_FIDELITYFX_DIR` path, which needs a Windows DLL. 3. Frame generation: keep the previous frame's colour and depth from slice 2, encode `Interpolator` between them and present the generated frame in between. The UI texture stays unset first, so a first version interpolates the HUD with the scene. **Blocker, stated up front.** The folder on this machine is 66% downloaded and `shaders.rpf` reads as zeros (#632), so a run cannot validate anything yet. Slice 1 is verifiable here (GPU tests); slices 2 and 3 will need a run on complete data.
github-actions[bot] commented 2026-11-28 17:57:12 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T17:57:12Z.


Claimed by @AnastasisKon. Open a draft pull request with Refs #375 in its description within 24 hours, or the claim expires.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7243414597 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/375#issuecomment-7243414597). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T17:57:12Z. --- Claimed by @AnastasisKon. Open a draft pull request with `Refs #375` in its description within 24 hours, or the claim expires.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS#375
No description provided.