metal: one upscale type for MetalFX SR, and a way to hand it a title texture #640
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!640
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-636"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@AnastasisKon on GitHub · 2026-11-28 18:02 UTC · original
AnastasisKon:vibe/metalfx-upscale-seam-4f9c68→main· +32994 −2586 · 178 files · 279 commits · closed without mergingPart of #378. Builds on the first commit of this branch, which added
metalfx::UpscaleandTexture::mtl.What
A MetalFX upscale is now a pass of a submission:
Pass::MetalFx(MetalFx { color, depth, motion, out, jitter, motion_scale, reset }). The backend makes the scaler the pass needs from the sizes, formats and mode it names, keeps it (one per size and format pair, in a cache on the device) and encodes it in its place in the submission.The interesting part was ordering.
encodeToCommandBuffer:takes the whole command buffer, so a MetalFX encode can neither wait on nor update the fence the other encoders of a residency-set submission order through — and this Mac runs residency sets by default, so refusing there would have refused every upscale. Instead a MetalFX pass ends the command buffer it is in, and the submission's piece event orders the next one; that is the mechanismVICTORY_PASSES_PER_BUFFERalready uses. The encoders before it in the same buffer name their attachments, so the pass's inputs are ready when it runs.metalfx::Viewcarries the frame's jitter, its motion-vector scale and the reset.Temporal::encodeused to hard-code a motion scale of 1 and no jitter, which would have been wrong for FSR's dispatch values.Testing
cargo test -p victory-metal --target x86_64-apple-darwin --test metalfx_pass— 3 passed on this Mac's GPU:a_spatial_metalfx_pass_fills_its_output: a red 16x16 render target scaled into 32x32 reads back red (255,0,0,255 within 8).a_temporal_metalfx_pass_fills_its_output_from_depth_and_motion: the same with depth at the far plane, zero motion vectors and a[0.5, -0.5]jitter.a_metalfx_pass_into_a_texture_metalfx_may_not_write_is_refused: an output that is not a render target is refused, and the submission reports the pass it lost.cargo test -p victory-metal --target x86_64-apple-darwin --lib metalfx— 10 passed.nice -n 10 sh tools/macos/verify.sh full—== gate PASSED ==(suite-hle 554, suite-shader 593, suite-gpu 493, policy, clippy-win), so neither the Windows build nor the other backends mind the new variant.What is still missing for MetalFX in the game
Two pieces, both now mechanical rather than unknown:
victory-gpu's native list records aCmd::Metalfxat the title's dispatch and emits this pass with the four textures resolved from the resource pointers (the registry is keyed by them).modules/fidelityfx.rsanswers the title'sffxCreateContext/ffxConfigure/ffxQuery/ffxDispatchitself on the native path, gated behind a switch, instead of letting the title's own DLL run; the dispatch'srestis already the layout MetalFX needs (jitter, motion-vector scale, render and output sizes, reset).Frame generation is a third: keep the previous frame's colour and depth, and interpolate between them with
metalfx::Interpolatorthrough the same pass.I did not guess at those here: none of them can be checked without a run, and the folder on this machine is 66% downloaded (#636), so a run cannot validate anything yet.
The reason line ("a draw without a host render pipeline (refused or not translated)") does not say which pipeline was dropped, and it is logged once per reason for the run, so a log could not name the draws nothing else had explained (#531's three hashes). Each dropped pipeline now gets one warning of its own with `pipeline =` its stages' hashes and render targets, up to 64 keys, before the `VICTORY_TRACE_TARGETS` frame trace that had this detail only under a switch. Test: `glue::a_dropped_pipeline_is_named_once`.`VICTORY_DUMP_DSP` is process-wide and so is the counter that numbers each stream's capture, so a stream another test activates while the variable is set takes `stream0_*` — and the dump test, reading the right file name, got that stream's zeros: ``` panicked at modules/dsp.rs:949: assert_eq!(read_f32("stream0_ir.f32"), ir) left: [0.0, 0.0, ... ] ``` One run in four of the whole suite, never alone. The two tests that activate streams now take a turn, so nothing can start a stream inside the other's capture. 15 runs of `victory-hle`'s suite: no failures.The Winsock tests take a turn (`serial()`) because the startup count is the process's — but `modules::net`'s `only_loopback_is_reachable` drives the same functions by name (`host!("ws2_32.dll", "socket")`, `connect`, `WSAConnectByNameA`, `WSAIoctl`, `closesocket`) without it. It can therefore start the stack up inside `off_machine_traffic_is_refused`'s "not started again" assertion, or take an ephemeral port inside `final_cleanup_invalidates_sockets_and_releases_their_ports`'s rebind of one it just released — the two winsock failures reported in #616. The turn now lives in `host_posix` (`winsock_turn`), and both modules take it; it is compiled only where that host is. The Winsock module alone never failed (0 of 20 runs), which is what pointed at the other module rather than at the socket code. 12 runs of `victory-hle`'s suite: no failures.Four measurements that close off the cheap explanations before the next person spends runs on them: a periodic dump shows every other thread idle (so nothing can ever satisfy the wait), the console model makes no difference, the records around the missing key are an index of {size, hash, kind, offset} entries that already names it, and the table slots the lookup reads are never written. The pool's alias views are coherent too -- the same record reads the same through both, so aliasing is not what fails.@AnastasisKon on GitHub · 2026-11-28 20:03 UTC · original
Full gate on
4bbf5b8f, in a clean worktree of this branch (sh tools/macos/verify.sh full):The MetalFX pass tests (
crates/victory-metal/tests/metalfx_pass.rs: spatial, temporal, and the refusal) pass on this Mac's GPU. The scaler is selected byVICTORY_METALFX=upscale, and the title's own FidelityFX upscale reaches it through the newCmd::Metalfxpath incrates/victory-gpu/src/native/list.rsandhost.rs.Not run: the title itself. The game folder on this machine is still 66% downloaded (
shaders.rpfreads as zeros), so nothing here has presented a frame yet, and the MetalFX path has therefore never been handed a real frame from the title.@AnastasisKon on GitHub · 2026-11-28 20:31 UTC · original
This is the same branch against a base that has moved on: upstream
mainhere is the README pointer, so the diff shows 178 files of the fork's whole history rather than the three commits this is. The reviewable pull request is https://github.com/AnastasisKon/Native-Victory-macOS/pull/79 (base: the fork'smain, 14 files, +1179/−89), and the work left — depth/motion on a real frame, and why frame generation has no caller — is written down in #642 so it can be taken in parallel. Closing this one rather than leaving two.Pull request closed