GPU: make fence signaling monotonic, clamp sampler enums, and add unit tests #932
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T14:18:19Z.
Summary
Fixes 2 real bugs in
crates/victory-gpu/src/fence.rsandcrates/victory-gpu/src/sampler.rsand adds 11 deterministic synthetic unit tests.Because external PR creation is currently restricted (
collaborators_only), the CI-green branch is ready on my fork for cherry-pick / review:geiyiliyabumo/VIctory@test/gpu-fence-and-samplergeiyiliyabumo/VIctory@370c61b(based onmainffe310e)Changes
crates/victory-gpu/src/fence.rs:signalusingstore(which allowed a lower signal value to move a D3D12 fence backwards) to usefetch_max(value, Ordering::AcqRel).fence::6/6 PASS): monotonic signaling, creation flags & GPU address, COM interfaces/refcount, all 5 vtable slots, and Windows event waiters.crates/victory-gpu/src/sampler.rs:D3D12_COMPARISON_FUNC(1..=8) andD3D12_TEXTURE_ADDRESS_MODE(1..=5) enum words so out-of-range title descriptors do not cause hostCreateSamplerto silently drop the descriptor.sampler::7/7 PASS): filter bits, comparison/reduction encoding, comparison & anisotropy clamping, LOD/bias/border, and address modes.Verification (Windows 11 x64 MSVC)
rustfmt --edition 2024 --check: PASScargo xtask policy: PASS (154 files ok)cargo clippy -p victory-gpu --all-targets --locked -- -D warnings(default +--features diagnostics): PASS (0 warnings)cargo test -p victory-gpu --locked -- fence::(6/6 PASS) &-- sampler::(7/7 PASS)AI-assisted; synthetic tests only, no game files.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-24T14:25:48Z.
Native D3D12 permits fence values to decrease. With WARP on Windows 10, signals
5 → 2leftGetCompletedValue()at 2. A new event for 4 stayed pending until the next signal of 4. D3D12 fence semanticsThe VIctory regression test failed on
370c61b: the same signals left the value at 5. The follow-up restores the latest signal value and checks that an event registered after a rewind waits for the next qualifying signal. Fix and regression testThe commit is directly on
370c61b. After the fix, all 6 fence tests and 64 GPU diagnostics tests passed, with 1 existing benchmark ignored. Clippy and the asset policy check passed. AI-assisted.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T06:57:10Z.
Automated triage for the maintainers.
Neither change is needed as described:
signalincrates/victory-gpu/src/fence.rsstores the value as given. That matches native D3D12, where a fence's value may go down: the comment above shows WARP leavingGetCompletedValue()at 2 after signals 5 then 2. Withfetch_maxthe regression test there fails, so the current behaviour is the correct one.1..=5already fall back toCLAMPonmain(address_modeincrates/victory-gpu/src/sampler.rs, from PR #474). The comparison function is passed through only when the comparison reduction is selected. A title descriptor with an out-of-range value there hasn't been shown.The new unit tests could still be useful. Pull requests are open to everyone again if you want to offer them on their own.
Generated by Claude Code