Skip to content

[BUNDLE] Eight more fixes carried from contributors' forks: #745 #776 #787 #805 #845 #852 #915 #918 - #1610

Closed
MamaLeVrai wants to merge 20 commits into
Marvisak:mainfrom
MamaLeVrai:bundle/carried-forks-2
Closed

MamaLeVrai wants to merge 20 commits into
Marvisak:mainfrom
MamaLeVrai:bundle/carried-forks-2

Conversation

@MamaLeVrai

@MamaLeVrai MamaLeVrai commented Nov 24, 2026 •

Copy link
Copy Markdown

Eight fixes from contributors' forks, in one PR. Each was reported as an issue that points to a fork branch and a commit (written when pull requests were still limited to collaborators), and none of their authors has a pull request. The branches are merged here as they are, with their commits and their authors, onto main (ffe310e); nothing is changed. Same idea as #1603, which carries four fixes of one contributor.

For reviewers and for anyone verifying with an agent (Claude, Codex, a person): this is a [BUNDLE] PR. The re-verification commands are below.

What is inside

Issue Author Fork branch Commit What it fixes
#745 raphael-riesner shader/med3-nan-bits c796377 v_med3 with a NaN operand gives the median on NVIDIA (fcmp uno folded)
#776 schmiticle; follow-up lucaseddd gpu/write-watch-once-per-submission; gpu/write-watch-preserve-partial-results c326bfa; 32ec0f4 write-watch queries repeat over nested buffers (120-180 ms of a world frame); the follow-up keeps the pages a sweep already reported when a later query of the same asking fails (a write could be lost, reproduced on c326bfa by DrDarkDK and lucaseddd)
#787 Pablo-Barros cli/translate-compare 31953ea victory compare: an A/B of two translate --list outputs, program by program
#805 davutsimsekk fix/loadlibrary-datafile-host 343aa42 LOAD_LIBRARY_AS_DATAFILE loads outside HostPolicy fail with ERROR_MOD_NOT_FOUND
#845 Numbers-iwnl fix/idle-receiver-keyboard a6884a3 a receiver answering for a switched-off pad hides the keyboard stand-in (3 commits)
#852 NicolaiVdS shader/atomic-handle-type ae7e0be an image atomic after a size query reuses an f32 handle: invalid SPIR-V, NVIDIA driver crash
#915 talakasse gpu/partial-detile af4fef4 detile only the subresources a texture's changed pages hold
#918 cybx shadow-batched-copy-back 4c0d57d put a run of GPU-written pieces back with one kernel call

The reasoning, the repro and the measurements of each are in its issue; each branch has its own tests where it adds behaviour.

Left out

Notes

Verification

Windows 11, RX 6950 XT, Rust 1.98.1 (the pinned toolchain):

Check Result
cargo clippy --workspace --all-targets --locked -- -D warnings clean
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings clean
cargo test --workspace --locked 361 passed, 0 failed, 6 ignored (main: 342 passed, 6 ignored), two runs

The title was not run. No game data is used or committed.

Re-verify in one go

git fetch https://github.com/MamaLeVrai/VIctory.git bundle/carried-forks-2
git checkout FETCH_HEAD
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo test --workspace --locked

AI-assisted (Claude Code); no game data.

🤖 Generated with Claude Code

raphael-riesner and others added 19 commits November 24, 2026 10:23
…fcmp uno)

v_med3_f32 and v_med3_f16 return the least operand when one is NaN, which
`med3` chose with `fcmp uno`. NVIDIA's driver assumes no NaNs in that
compare and folds it to false, so the NaN case gave the plain median:
v_med3_f32_matches_rdna2_with_nan failed on an RTX 3050 Ti
(`v_med3_f32(1.0, 2.0, NaN) = 2`, want 1). An integer test of the bits
(|x| > +inf) cannot be folded that way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nested buffers in the world (several views into one 174 MB block) each
asked GetWriteWatch about largely the same pages, about 20 times a frame:
1,500-1,800 askings a frame, 120-180 ms of it on an RX 9070 XT.

While Host::execute prepares a submission, the title's writes it must
see are already made, so the preparing thread now asks the kernel only
about pages it has not asked about in that submission (watch::Sweep).
A step that writes title memory during the preparation
(Batch::title_written) clears what was asked, so later askings see it.
Askings from other threads, and outside a submission, are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`victory compare <before> <after>` reads two `translate --list` outputs
and says what the second run gained and lost: each run's pipelines and
validations with the gains and losses, the programs that end differently
by their reason before and after, and every loss with both reasons. The
key is the file's name, offset, record and stage, so copies of the title
in other folders compare.

Testers measure a change against main this way, each with a script of
their own so far.
A wireless receiver answers for its pad while the pad is switched off: the
slot reads connected with an all-zero report. That counted as a pad, so the
keyboard's stand-in pad was never connected and keyboard input went nowhere
with no controller in hand.

Treat a slot as a pad only after it has reported something other than rest.
Once it has, it stays a pad at rest, so a played-with pad does not connect and
disconnect on every button release. The callback test seeds an all-zero pad
and waits for its connect callback; it presses a button now.
Heap handles were cached per block by the first property word only
(kind and UAV flag), not the second (component type and count). A size
query (f32 x4) and then an atomic (u32 x1) on the same image UAV in one
block shared the query's handle, so dxil-spirv declared a float image
and emitted OpAtomicUMax %float. NVIDIA's compiler faults on that
(0xc0000005 in vkCreate*Pipelines under vkd3d-proton). The key now holds
both words; structured buffers read with two strides get their own
handles too.

Offline check (translate --pipelines over shaders.rpf, NVIDIA RTX 5070 Ti,
vkd3d-proton master): 21,566 pipelines, no driver fault, every dumped
SPIR-V module passes spirv-val. In the title, the world loads without
the driver faults.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A slot that reported input, disconnected, and came back neutral kept the flag
set, so a receiver that re-paired without a pad took the keyboard stand-in away
again. Clear it when the host reports the slot disconnected, so it applies to
the current connection only.

Regression test and the case are from andrewpozdnakov7-jpg in Marvisak#845.

Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com>
Louisreed's observation in Marvisak#845: the press that turns an idle slot into a pad
arrives in the same poll as its connect callback, so a title that only starts
reading after that callback could miss it. The reading stays current until the
pad reports something else, so the title sees the press on its next read.

Test: the press is still current after a second poll with no host change, and
the release produces a new reading. A press that starts and ends between two
reads is still lost, which no poll-level fix can avoid.
A change to a title texture's memory detiled every mip and slice again,
and the watched path read the whole memory back first. A streamed
texture filling page by page paid for all of it at every submission
that sampled it.

Layout::extents gives the tiled byte ranges each subresource is detiled
from. Watched memory now reads again only the pages written since the
last detiling; memory that is hashed instead is hashed per 64 KiB page.
Either way only the subresources overlapping a changed page are
detiled. The first detiling, and memory whose read copy is gone, still
take the whole texture, and every subresource is still copied into the
host texture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy-back read and wrote title memory one 64 KiB piece at a time. In the
world of a retail game that is ~650 WriteProcessMemory calls a frame, about
300 ms of an ~850 ms frame, though the bytes compared took ~30 ms: a call
costs hundreds of microseconds whatever its size.

Consecutive pieces the GPU changed are now read with one call, and the
consecutive ones the title lacked a GPU byte in are written with one call.
The merge rule per piece is unchanged (GPU bytes only where the copy moved
and the title does not have them; title bytes kept elsewhere), and a run
that cannot be read whole falls back to piece by piece, so unmapped pieces
are still skipped. Measured: copy-back ~350 ms -> ~130 ms a frame.
Marvisak#776 Marvisak#787 Marvisak#805 Marvisak#845 Marvisak#852 Marvisak#915 Marvisak#918), verified together

Merges the fork branches named in those issues onto main (ffe310e), each
with its commits and its author unchanged, no conflicts and no changes of
mine. cargo clippy --workspace --all-targets --locked -- -D warnings, with
and without --all-features, is clean and cargo test --workspace --locked
passes (360 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 24, 2026 19:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

…a partial write-watch sweep already reported)

The commit sits on top of c326bfa, which is already in this bundle; it is merged as it is, with
its author. It is the fix for the lost write that DrDarkDK and lucaseddd reproduced on c326bfa.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@pfhandler

Copy link
Copy Markdown

Local patches for two issues hit while running GTA VI 1.0.2.1 through VIctory on Linux (GE-Proton 11-14, vkd3d-proton 3.2.0, RTX 4060 Ti 8 GB):

  • VICTORY_NO_HOST_PAD=1 — a connected host pad (e.g. DualShock appearing as XInput pad 0) keeps the keyboard stand-in pad from being enumerated. Hiding the host pad lets VICTORY_KEYS drive the title again.
  • VICTORY_MODE=1920x1080 — the DXGI output mode list is fixed at the console's 3840x2160. Reporting 1920x1080 instead keeps the title's render targets and VRAM use down on smaller hosts (Series S profile + 1080p settled around 3.5 GB VRAM here).

Both are local uncommitted diffs, posted here for reuse. Tested only on the configuration above.

diff --git a/crates/victory-gpu/src/dxgi.rs b/crates/victory-gpu/src/dxgi.rs
index c7f7c45..2535b68 100644
--- a/crates/victory-gpu/src/dxgi.rs
+++ b/crates/victory-gpu/src/dxgi.rs
@@ -219,6 +219,19 @@ struct Mode {
 }
 const _: () = assert!(size_of::<Mode>() == 32);
 
+/// The console's fixed output mode, overridable for hosts smaller than the
+/// console's 4K target: `VICTORY_MODE=1920x1080` reports that instead.
+fn mode_size() -> (u32, u32) {
+    const DEFAULT: (u32, u32) = (3840, 2160);
+    let Some(text) = std::env::var_os("VICTORY_MODE") else {
+        return DEFAULT;
+    };
+    let text = text.to_string_lossy();
+    text.split_once('x')
+        .and_then(|(w, h)| Some((w.trim().parse().ok()?, h.trim().parse().ok()?)))
+        .unwrap_or(DEFAULT)
+}
+
 /// The console's mode list: one 4K mode at 60 Hz (Grand Theft Auto VI looks
 /// for a 120 Hz one to allow 120 Hz frame intervals).
 /// shortcut: fixed mode, not the host display's; report the host's rates if
@@ -242,9 +255,10 @@ extern "system" fn modes(
         return MORE_DATA;
     }
     *count = 1;
+    let (width, height) = mode_size();
     let mode = Mode {
-        width: 3840,
-        height: 2160,
+        width,
+        height,
         refresh: [60, 1],
         format: 0,
         scanlines: 1, // progressive
diff --git a/crates/victory-hle/src/modules/gameinput.rs b/crates/victory-hle/src/modules/gameinput.rs
index a411bd0..da8d66c 100644
--- a/crates/victory-hle/src/modules/gameinput.rs
+++ b/crates/victory-hle/src/modules/gameinput.rs
@@ -1134,6 +1134,11 @@ mod host {
 
     impl Source for Host {
         fn pad(&mut self, slot: usize) -> Option<PadState> {
+            // The keyboard stand-in pad only exists while no host pad is
+            // connected; this hides a host pad the title mis-handles.
+            if std::env::var_os("VICTORY_NO_HOST_PAD").is_some() {
+                return None;
+            }
             if self.empty_until[slot].is_some_and(|until| Instant::now() < until) {
                 return None;
             }

This was referenced Nov 24, 2026
@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers. Closing because this pull request re-packages other open pull requests. Each of those is reviewed on its own, so a bundle cannot be merged.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

@Marvisak Marvisak closed this Nov 25, 2026

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: README.md, crates/victory-gpu/src/host.rs, crates/victory-gpu/src/shadow.rs, crates/victory-gpu/src/texture.rs, crates/victory-gpu/src/watch.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.