Skip to content

Linux: run under Proton, and fix the world GPU faults - #994

Closed
Slaktarn700 wants to merge 15 commits into
Marvisak:mainfrom
Slaktarn700:proton-fixes
Closed

Slaktarn700 wants to merge 15 commits into
Marvisak:mainfrom
Slaktarn700:proton-fixes

Conversation

@Slaktarn700

Copy link
Copy Markdown

What

This makes VIctory run on Linux under Proton (vkd3d-proton + DXVK's dxgi), and fixes the two world GPU faults that hit every vendor. Tracking issue: #844.

It's 14 commits on main ffe310e, with 17 files changed (+1041 / −67). Each commit stands on its own and has its own reasoning in its message. If you'd rather review it as smaller PRs, I'm happy to split it.

Proton/Wine compatibility

  • 4828716 Indirect clamp builds with Wine's compiler. It uses structured buffers instead of RWByteAddressBuffer methods, so Microsoft's d3dcompiler_47 is no longer needed.
  • e5a8c2f Empty pipeline library: ask with a null blob. vkd3d-proton refuses an empty, non-null one.
  • d469fe9 HLE: WSAConnectByList and GetAddrInfoExA fail cleanly where the host lacks them, instead of the title crashing.
  • 4782660 Shader tests: skip the DXIL hash-refusal check under Wine, which doesn't verify hashes.
  • 45aceea Shaders: one returning block per program. Programs with several ret blocks became SPIR-V that crashed RADV at pipeline creation.

World GPU faults (all vendors)

  • 6f732b6 Mirror heap slots the title writes into its own memory. Each submission re-syncs them, so the GPU no longer reads stale descriptors.
  • c69bd9a Bind root SRVs as bounded one-view tables. Raw root SRVs let shaders read past the end of the buffer.

Testers in #844 confirmed both fixes on RDNA2 (RX 6800 XT), RDNA3 (RX 7900 XT), RDNA 3.5 (Radeon 8060S) and an RTX 4090.

Wine performance

  • 4f9aa10, 27eefe4 Watch. Under Wine, GetWriteWatch and VirtualQuery contend on the virtual-memory lock with the title's write faults: about 180 µs per call in the world, against about 70 µs in isolation. Under Wine the watch now asks once per allocation per submission, with allocations cached. Over the same 4-minute world run, kernel time fell from 34 s to about 8 s. crashbashash measured copies −29% against main on an RX 6800 XT. Windows is unchanged.

Diagnostics

  • 9823139 VICTORY_SHOW_TARGET (diagnostics feature): presents an intermediate render target instead of the final frame. For example, 2560x1440-f28-3 shows the world's G-buffer.
  • 45e24f9 A debug pixel shader (emit::debug_ps) that colours surfaces by slope, from depth derivatives.
    • With VICTORY_DEBUG_PS=1, depth-tested geometry uses it, so you can walk the world while lighting isn't translated.
    • A geometry pipeline whose pixel shader doesn't translate gets it as a fallback, instead of its draws being dropped. VICTORY_PS_FALLBACK=0 turns that off.
  • 0496398 VICTORY_PIPELINE_WAIT_MS: sets the per-frame pipeline wait. The default stays at 500 ms.

Docs

  • b7cc788, 2115124 add docs/linux-proton.md: Proton Experimental and system-Wine recipes, the known issues, and the switches above. They also add a README note and scripts/proton-run.sh.

Testing

  • Platform: RX 9070 XT, RADV / Mesa 26.3.1, CachyOS kernel 7.3.5, Proton Experimental (vkd3d-proton 3.2).
  • Tests: the full workspace (344 tests) passes under Proton. The only exceptions are the two tests that start cargo/git from inside Wine. Clippy is clean at every commit.
  • In the game: boots to the first mission and plays. With VICTORY_DEBUG_PS=1, the world can be walked with geometry visible.

Known gaps (not in this PR)

AI-assisted (Claude Code).

🤖 Generated with Claude Code

slaktarn and others added 14 commits November 24, 2026 13:06
Under Wine, D3DCompile is vkd3d-shader's HLSL compiler, which has no
RWByteAddressBuffer methods ("Method 'Load' is not defined") and does not
embed a [RootSignature] in the blob. The clamp did not build, so every
indirect execution was dropped under Proton.

The clamp now uses structured buffers of words (a root UAV takes either)
and its root signature is built in code. Same behaviour on Windows. A new
GPU test checks the clamped values, also with descriptor heaps bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The windows crate passes a dangling non-null pointer for an empty slice;
vkd3d-proton rejects that with E_INVALIDARG, so under Proton there was no
host pipeline library and pipelines were never kept on disk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Wine's ws2_32 exports neither; a title calling them panicked in the host!
lookup and aborted. The overrides now fail the call (WSAEOPNOTSUPP, or the
name is not found), and the export test skips them where they are missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vkd3d-proton does not check DXIL container hashes, so pipelines with a
zero or wrong digest are accepted there; the rest of the test still runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every s_endpgm (and the loop-limit abort) now branches to one shared ret
block, as DXC's output always has. A loop left by both a break and a
return could not be structured by dxil-spirv (vkd3d-proton): it emitted
invalid SPIR-V ("exits the loop ... but not via a structured exit"),
on which RADV segfaulted in vkCreateGraphicsPipelines (exit code 3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Grand Theft Auto VI places its descriptor heaps in its own memory and
copies whole slots there itself; no create or copy call reports those
writes, so the host slot kept what it was mirrored from before. Slots a
shader reads directly by index (not through a table) are only made from
what was mirrored: in the world a mesh shader read a slot as a constant
buffer while the host slot still held a texture view, whose upper half
it took for a buffer at address 0 (a GPU page fault and a lost device;
likely the "world's low-address page faults" noted at null_view).

Before each submission, the 64 KiB blocks of every shader-visible heap
written since the last one (watch::writes) are mirrored again; mirror()
skips slots whose record did not change.

Found with umr wave dumps under Proton (RX 9070 XT): the faulting waves
held s[8:11] = {0, 0x00400000, 0x00248000, 0}, the second half of an image
descriptor, loaded from heap slot ~1,061,522. Before, the world lost the
device after 5-90 s; with this, 90 s, then a different fault (next commit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A root SRV is a raw address the GPU reads without bounds. The console's
reads past the title buffer land in other title memory; ours past its host
copy land in unmapped memory: in the world a compute shader read 32 MB
past a root SRV's copy (umr: TCP fault at s[10:11] + 0x1f0e000) and the
device was lost.

Root SRVs (ByteAddressBuffer t<slot> in ROOT_CBV_SPACE) are now a table of
one raw view sized to the rest of the host copy, in a dynamic slot of the
bound view heap, reused within a list for the same address. Reads past the
copy return zeros. The shaders' bindings do not change.

With this and the previous commit, the world runs without a device loss
for as long as tested (8 minutes, twice, under Proton).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Wine emulates write watching page by page under one lock (about 1 ms an
asking), and the world's copies ask about the same big buffers dozens of
times per submission: 3,500 askings and 17 GB checked per frame, 3 s of a
frame. Under Wine, a range the kernel already answered for in this
submission is now answered from the journal; a write in between keeps its
dirty bit and shows in the next submission. Windows is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VIctory builds on Linux with cargo-xwin and runs under Proton Experimental,
getting as far as on Windows (tested: CachyOS, RX 9070 XT, Mesa 26.3.1).
docs/linux-proton.md covers building, running, tests and the known
differences; scripts/proton-run.sh runs victory.exe (and serves as cargo's
test runner) with Proton's Wine, vkd3d-proton and DXVK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ission

Under Wine each GetWriteWatch takes about 1 ms in the world (contention
on Wine's virtual-memory lock with the title's write faults), not the
size of the range: 70 us for 256 MB in isolation, 180 us per asking in
the world, 190,000 askings in 3 minutes. VirtualQuery takes the same lock.

Under Wine now:
- the first asking in a submission asks about the whole title allocation
  (up to 4 GiB), so the other buffers in it are answered from the journal;
- allocations are found from a cache by address, VirtualQuery only on a
  miss (a long region walk is capped and remembered as far as it went);
- views of physical pages go straight to their guards (no failed
  GetWriteWatch first, no second VirtualQuery in guard()).

Profiled on an RX 9070 XT: kernel time in watch::writes went from 34 s to
about 8 s over the same 4-minute run. Windows is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VICTORY_SHOW_TARGET=<w>x<h>-f<format>[-<n>] presents, each frame, the
n-th texture of that size and format the frame renders to or writes
(first-use order, names as in VICTORY_DUMP_TARGETS files) instead of the
title's frame. While the world's final image is still dark, its G-buffer
shows the geometry: 2560x1440-f28-3 on a Series X profile showed the first
mission's street (poles, wires, bollards, roofs) and let a player walk it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
victory_shader::emit::debug_ps(n) is a DXIL pixel shader of our own: it
reads SV_Position only, colours each pixel by its surface's slope (from
the screen-space derivatives of depth) and writes n colour targets. It
needs nothing of the title's, so a draw's geometry shows whether or not
its pixel shader translates.

- VICTORY_DEBUG_PS=1 (diagnostics view): pipelines that draw depth-tested
  geometry use it instead of the title's pixel shader; flat layers
  (interface, full-screen passes) keep theirs, so menus stay usable.
- Fallback: a geometry pipeline whose pixel shader does not translate, or
  that the host refuses, is made with the debug shader instead of having
  its draws dropped; in the debug view, one the host refuses with ours is
  made with the title's. VICTORY_PS_FALLBACK=0 turns the fallback off.

With the debug view on, the world drew 3,600-4,100 draws per frame
instead of about 1,700. A test makes a pipeline from the debug shader and
a stand-in vertex shader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The title's threads wait up to 500 ms per frame for pipelines being made
before draws are dropped. VICTORY_PIPELINE_WAIT_MS changes that budget
(0: never wait; pipelines then appear a few frames later and one-off
passes may be lost). The default is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From RDNA2/RDNA3/RDNA 3.5 reports on Marvisak#844: what a system Wine needs
instead of Proton (vkd3d-proton 3.2+, DXVK's dxgi.dll, no Microsoft
d3dcompiler_47 any more), and VICTORY_SHOW_TARGET, VICTORY_DEBUG_PS,
VICTORY_PS_FALLBACK and VICTORY_PIPELINE_WAIT_MS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MichaelSmithAI

Copy link
Copy Markdown

We checked the heap-mirroring change separately on an RTX 4090 under Wine/vkd3d-proton 3.2. After a direct CPU copy of an SRV record into a title-owned heap, the next guest queue submission changed the mirrored slot from texture A to B. Another copy and submission on the same watched page changed it back to A. Without the sweep the first submission after the copy kept A. This fixture checks resource identity at submission. It does not sample pixels or exercise a copied CBV.

One ordering detail in 6f732b6: the guest queue calls resync_title_writes() before taking the host submission mutex. A second queue caller can therefore refresh the heap while the first caller is still waiting for its GPU work. In our staging branch we moved the guest-only refresh inside that mutex, before list preparation. The same A → B → A check passes there. The ordering finding comes from source review; the fixture uses sequential submissions.

The guest queue started a new watch submission and refreshed heap slots
the title wrote before `Host::execute` took the submission mutex. A
second queue caller could then rewrite a host heap while the first
caller's GPU work, already submitted and being waited on, still read it.

`Host::execute_title` now takes the lock first, then starts the watch
submission and refreshes the heaps, then prepares and runs the lists.
Internal submissions (indirect clamp, captures, copy-backs) keep using
`execute`, which doesn't refresh.

Reported by MichaelSmithAI in Marvisak#994.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Slaktarn700

Copy link
Copy Markdown
Author

@MichaelSmithAI thanks for the A → B → A check on the 4090, and for the ordering catch. You're right: resync_title_writes() ran before Host::execute took the submission mutex, so a second queue caller could refresh a heap while the first one's GPU work still read it.

Fixed in 993dff8. The guest queue now calls Host::execute_title, which takes the lock first, then starts the watch submission (watch::new_submission, which had the same issue) and refreshes the heaps, and only then prepares the lists. Internal submissions (the indirect clamp, captures, copy-backs) keep plain execute and don't refresh. Lock order stays submission mutex → SHADER_HEAPS. Nothing takes them the other way round.

Clippy is clean, with and without --all-features, and the victory-gpu tests pass under Proton Experimental.

AI-assisted (Claude Code).

MfDev0 pushed a commit to MfDev0/victory that referenced this pull request Nov 24, 2026
…target

A G-buffer is several targets of one size and format, so the last one
bound is rarely the one worth seeing. An optional -<n> suffix selects
the n-th distinct match of the frame in first-use order; upstream
needed 2560x1440-f28-3 to see the first mission's street while the lit
image was dark.

Idea from upstream PR Marvisak#994 (9823139).

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Bezouro added a commit to Bezouro/VIctory that referenced this pull request Nov 24, 2026
… compute work

Adapt XCL's first-use compute scheduling to VIctory's native workers and frame budget. Track root-selected buffer views through branches and sample the title's indirect arguments. Include the opt-in slope diagnostic from Slaktarn700's VIctory PR Marvisak#994.
@timorjay

timorjay commented Nov 24, 2026 •

Copy link
Copy Markdown

Independent Windows check at 993dff8. On Microsoft WARP, the unmodified depth-colour pixel shader produced the expected colours for 3,072/3,072 pixels across three synthetic 32×32 surfaces. With constant depth the centre RGB was (0.5, 0.5, 1). Increasing depth to the right gave (0.146447, 0.5, 0.853553); decreasing depth downward gave (0.5, 0.853553, 0.853553). The Microsoft DXIL validator accepted all eight output-count variants. The pixel checks used one RGBA32F target. Runnable fixture and exact results.

I also tested the title in an offline Windows guest with vGPU disabled (WARP 10.0.26100.9818). These runs used local logging and capture instrumentation. In one Series X run the display selector found 2560x1440-f28-3 at the first observed use of a world-visibility shader, after graphics allocations had already returned E_OUTOFMEMORY. The presentation command list failed to close and no world frame was captured. With the Series S profile and a 1280x720-f28-3 selector, the run reached the world-visibility marker with no logged graphics allocation failures. The software device was removed before the next presentation. These software runs verified the shader output but did not display the street or test player control.

RTX 5090 D v2, Windows 11, driver 617.42. I ran the Series X profile in an offline vGPU guest on this PR head, with the 262,144-slot reserve from #747 and local capture instrumentation. At world offsets +1, +2 and +8 the debug view showed geometry. At +8 I could make out overhead lines, building fronts and the street while the title's original surface still showed the opening location card. At offsets +0, +1, +2 and +8 the captured presentation source matched the independent intermediate readback pixel-for-pixel (921,600 RGB pixels per pair after capture downsampling; +0 was black). At +16 the selector had no match and fell back to the original, nearly black frame. I stopped there by design; character input and long-run stability were not tested.

An earlier instrumented run returned E_INVALIDARG while closing the presentation command list. In the successful run I recorded the two surface readbacks separately and skipped transitions when the selected surface was already in COPY_SOURCE. All four matched samples were in that state, with one mip and one array layer. A separate 2×2 texture check on Microsoft WARP isolated the API error without submitting any work. Starting from COPY_SOURCE, the original transitions made Close() return 0x80070057. Skipping those transitions returned S_OK. Starting from RENDER_TARGET, both variants returned S_OK. All 56 non-benchmark GPU crate tests passed with WARP on the isolated patch. This accounts for an early presentation error. The later device-removal issue remains open. Minimal presentation fix · Standalone check.

On the same machine I also traced 507,328 consecutive out-of-range warnings at startup to the write-watch re-sync scanning beyond the mirrored part of the title heap. Clipping just that scan to the mirrored capacity reduced this warning count to zero. Time to the second saved frame went from 156.28 s to 8.73 s with a fresh profile each time and diagnostic logs written through a mapped folder. Five descriptor tests passed. Small patch against this PR head and regression test.

Codex assisted with the fixture, the local runs and this report.

@justlovett0

Copy link
Copy Markdown

Verified on Windows 10 + NVIDIA (the platform pair this PR's fixes had not been tested on): the world runs and its geometry renders through the debug views; the final image is dark as documented, and a device removal still comes after ~3 minutes.

Setup: Windows 10 21H2 19044.7846, RTX 3080 10 GB, driver 621.24 (32.0.16.2124), Ryzen 9 7900X, 32 GB. Build: main ffe310e + #175 (Agility SDK 1.620.2 – required to launch on this Win10 box) + this PR (15 commits, merged cleanly) + a local #747 constant (capped-heap dynamic pool 2^18). Release build; VICTORY_DEBUG_PS=1 and VICTORY_SHOW_TARGET=2560x1440-f28-3 for the world runs. Retail GTA VI 1.0.2.1 (b99f876b74d4a77f), Series X.

main + #175 + this PR
boot / menus / intro cutscenes fine fine
world entry TDR ~30 s into world loading (24-list submission, 0x887A0006) world simulation runs; the character is controllable
run length ~75–100 s total ~3.5 min total, ~2 min in-world, then device removal (29-list submission)
world picture black G-buffer geometry visible via VICTORY_SHOW_TARGET=2560x1440-f28-3: the street, basic polygons, moving assets in flat debug colours; the final present stays black (lighting/post untranslated, as documented)
frame rate – 0.9–1.6 fps, 270–400 MB copies/frame (the CPU-bound copy cost, #400)

Also measured on this build: 135 compute pipelines refused (wave64 on the 32-lane host – #233 not stacked), 480 shaders untranslated, and with the #747 constant zero "no dynamic slots" drops but 507k "title slot past the host heap" writes (details on #747).

The two world-fault fixes (6f732b6 mirror re-sync, c69bd9a bounded root-SRV tables) clearly changed the failure mode on NVIDIA/Win10: from an immediate page-fault TDR to minutes of running world. The remaining ~3-min removal may be the helper-lane readfirstlane spin (#1039/#908) or #772 – happy to run DRED/Aftermath-style diagnostics here if useful.

Logs kept locally (pr994-run.log, pr994-747-run.log, showtarget-run.log); excerpts on request. No game files attached.

AI use: Qwen Code (underlying model name not disclosed by the tool) built the stack, ran the title, extracted the counts and drafted this comment at the user's request; the user confirmed the visible geometry and character control by hand.

dieharddillon1 pushed a commit to dieharddillon1/VIctory that referenced this pull request Nov 24, 2026
Adapt the VICTORY_SHOW_TARGET experiment by slaktarn from Marvisak#994 (9823139) to the multi-plane Windows presenter. Keep submission order, overlays and normal presentation when the selected buffer is absent.
dieharddillon1 pushed a commit to dieharddillon1/VIctory that referenced this pull request Nov 24, 2026
Adapt the debug pixel shader by slaktarn from Marvisak#994 (45e24f9). Preserve vertex, mesh and geometry stages, cache debug shaders by render-target count, and use the regular pipeline if the diagnostic pipeline cannot be made.
@Zipettte

Copy link
Copy Markdown

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 993dff8: cargo test -p victory-gpu -p victory-hle -p victory-shader passes, 269 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

dieharddillon1 pushed a commit to dieharddillon1/VIctory that referenced this pull request Nov 24, 2026
Adapt slaktarn commits 6f732b6 and 993dff8 from Marvisak#994. Scan changed title heap pages inside the existing host submission lock and write-watch sweep, and exercise a raw descriptor copy and clear through real submissions.

Co-authored-by: slaktarn <S700@bananamix.se>
@theDVNVS

Copy link
Copy Markdown

THANKS!

@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers. Closing because it is outside the project's scope (VIctory targets Windows hosts; ports, launchers and tooling for other platforms are not being taken).

A Linux/Proton port in one PR: 14 commits over 17 files in gpu, hle and shader crates, a 118-line doc and a run script. Out of scope as it stands and built on code main replaced; its net.rs change does not loosen the guard. The small Wine fixes exist as single PRs (#347, clean #178, #217, #1279).

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
cmt8 added a commit to cmt8/VIctory that referenced this pull request Nov 25, 2026
A section above upstream's README, which stays below it unchanged: the
fork runs the title on Linux under Proton and vkd3d-proton (upstream
closed the Linux PR Marvisak#994 as out of scope), its status on the one test
machine, which branch holds what, every commit on linux/fx-next beyond
fxceless/victory-fork main sorted by origin (upstream PRs, other forks,
written here), how to build and run, and credits.

Tested: branch names checked against origin; the 39 commits on
origin/linux/fx-next beyond fxceless/main classified from their authors
and -x lines; upstream and fxceless PR numbers, authors and the Marvisak#994
closing comment checked with gh; linked files exist on the branches
named in their URLs; upstream's README text below is byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cmt8 added a commit to cmt8/VIctory that referenced this pull request Nov 25, 2026
A section above upstream's README, which stays below it unchanged: the
fork runs the title on Linux under Proton and vkd3d-proton (upstream
closed the Linux PR Marvisak#994 as out of scope), its status on the one test
machine, which branch holds what, every commit on linux/fx-next beyond
fxceless/victory-fork main sorted by origin (upstream PRs, other forks,
written here), how to build and run, and credits.

Tested: branch names checked against origin; the 39 commits on
origin/linux/fx-next beyond fxceless/main classified from their authors
and -x lines; upstream and fxceless PR numbers, authors and the Marvisak#994
closing comment checked with gh; linked files exist on the branches
named in their URLs; upstream's README text below is byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fornorharry added a commit to NitricAcidDev/VIctory-Omega-Fork that referenced this pull request Nov 25, 2026
… (fxceless Marvisak#994, 11b29e9)

Its traced passes (shadows, occlusion, the irradiance cache) walked whatever
bytes lay where the structures would be: dark tiles on hair and faces, lit
squares in shadow, another picture at each launch. A node test now answers
no hit, without reading, until the structure builder runs whole.
VICTORY_BVH_NO_HIT=0: as before.

By PiloteCode. This tree's numbers for the host's words are kept.

Its tests pass here (WARP and the RTX 5080). Not run with the title.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brunofgmag added a commit to brunofgmag/VIctory that referenced this pull request Nov 25, 2026
…ructure builder behind VICTORY_BVH_BUILDER) into fork-main
brunofgmag added a commit to brunofgmag/VIctory that referenced this pull request Nov 25, 2026
gmankab pushed a commit to gmankab/victory that referenced this pull request Nov 26, 2026
…=1, off by default); VICTORY_WAVE_WIDE=last (fork PR Marvisak#1141)

The structure builder does not run unless asked for, and the title's ray-traced passes run all the same: every node test then reads whatever bytes lie where a structure would be, in a walk bounded at 65,535 steps a wave. With VICTORY_BVH_NO_HIT=1 (and not VICTORY_BVH_BUILDER=1) a box node enters no child and any other node is missed: every ray leaves at its first test, the answer is the same in every run, and the program asks the host for neither the directory of title memory nor the list of missing pages (unit test). The idea is fork PR Marvisak#994's, done here at translation instead of by a host word. Also fork PR Marvisak#1141 as it is (VICTORY_WAVE_WIDE=last: the barrier form only for programs every other form leaves at 64 lanes; opt-in), and the comment on the wide loads corrected (not the same result on the card: run 277). A TRANSLATOR EDIT: an exe from here on has a new shader fingerprint; wipe the DXIL cache and the pipeline library before its first launch. Not run in a game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
alesanfe pushed a commit to alesanfe/VIctory that referenced this pull request Nov 26, 2026
…=1, off by default); VICTORY_WAVE_WIDE=last (fork PR Marvisak#1141)

The structure builder does not run unless asked for, and the title's ray-traced passes run all the same: every node test then reads whatever bytes lie where a structure would be, in a walk bounded at 65,535 steps a wave. With VICTORY_BVH_NO_HIT=1 (and not VICTORY_BVH_BUILDER=1) a box node enters no child and any other node is missed: every ray leaves at its first test, the answer is the same in every run, and the program asks the host for neither the directory of title memory nor the list of missing pages (unit test). The idea is fork PR Marvisak#994's, done here at translation instead of by a host word. Also fork PR Marvisak#1141 as it is (VICTORY_WAVE_WIDE=last: the barrier form only for programs every other form leaves at 64 lanes; opt-in), and the comment on the wide loads corrected (not the same result on the card: run 277). A TRANSLATOR EDIT: an exe from here on has a new shader fingerprint; wipe the DXIL cache and the pipeline library before its first launch. Not run in a game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 96ff135)
Steenax6 added a commit to Steenax6/VIctory-NVID that referenced this pull request Nov 26, 2026
DispatchX(x, y, z, flags) with bit 5 of the console's dispatch initiator
(USE_THREAD_DIMENSIONS, 0x20; 0x8020 for 32-lane programs) gives thread
counts, not group counts. The flags were dropped and the counts run as
groups: the ray-tracing structure builder, which dispatches this way, ran
up to 64 times over and its box stages wrote empty nodes past their
structures into the title's own objects (2.2 GiB in one frame of a failed
run). That is the likely cause of the fault seconds after the first 3D
frame with VICTORY_BVH_BUILDER=1.

The host now runs ceil(threads / numthreads) groups per axis, from the
console program's group size (Translated::threads). A partial last group
runs whole: cutting its extra threads needs the thread count in the
translated program, which victory-shader has no place for yet. The first
such dispatch and every partial one are logged, and the frame line counts
them.

Sources: fxceless/victory-fork PR Marvisak#646 (mynzjerko; the conversion and its
test) and PR Marvisak#994 (PiloteCode), DexNom/VIctory bc3cd4b and PR Marvisak#35,
uiliannn/VItoriaBr 633ba6e, all GPL-3.0 forks of VIctory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Steenax6 added a commit to Steenax6/VIctory-NVID that referenced this pull request Nov 26, 2026
… it by address

The structure builder writes the records its stages read into list upload
memory (the newer lists' method at 0x4a0) and hands the stages
their addresses; its header stage reads its 40-byte records by address.
Our upload memory was blocks of the process heap, which lie wherever the
heap puts them: at 1.5 to 1.8 TiB in the source's runs, beyond the
console's 40 bits and the directory of title memory by address (below
128 GiB). The records then read as zeros, the stage stored its headers at
address 0 (dropped), and no structure got a header.

With VICTORY_BVH_BUILDER=1 (or VICTORY_UPLOAD_CHUNKS=1; =0 never) upload
memory is carved from 4 MiB chunks of one 512 MiB write-watched
reservation between 4 GiB and 128 GiB: each chunk is one window of memory
outside buffers, refreshed by write watching like the title's memory, and
none of it is on the process heap. A chunk goes back to the free ones
when the list that holds it is reset or its submission has run; requests
over 4 MiB, or when every chunk is held, still come from the heap.

Source: ka1qux/BRVIctory-ka1qux 6d877612a (after fxceless/victory-fork
PR Marvisak#994, PiloteCode), the upload-memory part with its test. Its other
parts (naming addresses inside upload blocks, refreshing only named
copies, the builder's sizes copied on the card) are not taken.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andyeox-systemd

Copy link
Copy Markdown

NVIDIA data point for this branch: RTX 4070 Ti (Ada), Arch Linux, nvidia-open-dkms 620.73.04, system Wine 11.22, DXVK dxgi. The world draws in full (roads, buildings, props, characters, seen with VICTORY_DEBUG_PS=1 and VICTORY_SHOW_TARGET=2560x1440-f28-3); the lit image is dark, as noted above.

What NVIDIA needed on top of 993dff8:

Frames are about 2 to 3 s, and about half the draws still wait for pipelines on early runs. I also hit the empty-pipeline-library E_INVALIDARG independently before finding e5a8c2f here, so that fix is confirmed on NVIDIA too.

AI-assisted. No game data attached.

Steenax6 added a commit to Steenax6/VIctory-NVID that referenced this pull request Nov 26, 2026
…sses

The title builds and refits its dynamic ray-tracing structures, and the
top of the tree above the static world's pre-built ones, with its own
builder programs every frame. victory-gpu runs those only with
VICTORY_BVH_BUILDER=1; without it the structures hold whatever their
memory held before, and a walk through them read garbage: dark tiles on
hair and faces, bright squares in shadow, a different picture each start,
and walks that ran to the trace loop limit (1,024 a lane).

The translated node test now follows the same switch: without the
builder, a box node returns no child and a triangle node a miss, and the
node is not read (no title memory is asked for). It is decided when the
program is translated (the switch is in the shader cache's key); a run
with the switch whose builder the host turns off later keeps the full
test. A card test runs both forms of the instruction without the builder.

Sources (forks of VIctory): GromX0/victory-fork 429e3e5a93 and df9ac61a9d
(cell lit by its lamps, magenta blocks gone, RX 9070), the PiloteCode line
11b29e9 (brunofgmag; fxceless/victory-fork Marvisak#994, VICTORY_BVH_NO_HIT),
NitricAcidDev bc9bfcd, Xeltax/VIcky 3fb7f96, Cosatal 9b5dda9ac
(VICTORY_RT_MISS); realblastex/flamingo saw the cutscene's faces lit on an
RTX 4070. Here it is no second switch: it follows the builder's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Steenax6 added a commit to Steenax6/VIctory-NVID that referenced this pull request Nov 26, 2026
…e count

DispatchX with USE_THREAD_DIMENSIONS counts threads; the console then
starts only the threads up to the count in the last group, its other
lanes off in EXEC from the start. Since 3c92819 the host ran the groups
that hold the threads, but the last one whole: its threads past the
count ran too (the "shortcut" in State::dispatch).

Every program of the structure builder (a spilled user-data table, the
programs that dispatch this way) now gets two instructions in front of
its code: v_cmp_gt_u32 vcc, ttmp15, v0 and s_and exec, exec, vcc. The
trap temporary is a new compute input, the threads left from the
group's first on: the dispatch's thread count (user data of the new
kind USER_DISPATCH_THREADS, which the host sets per dispatch, u32::MAX
for one of whole groups) less the group id times the group's width,
none past the count. The title's code runs unchanged behind it, so its
lane counts, saved EXECs and scans that turn every lane on see the
lanes the console's would, in every form the translator has; in the
paired form (wave64 programs on 32-lane hosts, VICTORY_WAVE_PAIRS) the
upper lanes take their own console thread ids. No thread leaves early,
so every barrier is reached as before. A card test runs a 64-lane
program in the paired form and a 32-lane one over two groups for 13
counts: each lane adds its wave's s_bcnt1 of EXEC, and only the
launched lanes add, counting only launched lanes.

The frame line now says how many partial groups were cut and how many
still run whole (a program without the entry code, or a group partial
in y or z, whose rows the builder does not have).

Only the builder's programs change (all 52 still emit, validate and get
pipelines with VICTORY_HOST_WAVE=32); they run only with
VICTORY_BVH_BUILDER=1. The shader cache must be warmed again.

After DexNom/VIctory PR Marvisak#35 (pr0vId3nce: EXEC masked by instructions
ahead of the program), with the count through a trap temporary instead
of a load of the spilled table; the host word as fxceless/victory-fork
PR Marvisak#994 (PiloteCode) and uiliannn/VItoriaBr 633ba6e pass it. All
GPL-3.0 forks of VIctory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Steenax6 added a commit to Steenax6/VIctory-NVID that referenced this pull request Nov 26, 2026
…ew heap comes from a table by slot

Four of the five shadow-mask trace programs the translator refused with
"a descriptor read only as data" (CS_TraceShadowRays_Full, _Half,
_Quarter, _Eighth) pick a buffer descriptor from the view heap at an
index they compute and use only its address, as a pointer to the
ray-tracing structure they walk. The address of a descriptor at a fixed
place in a table was a host word already (USER_VIEW_ADDRESS); one picked
by a computed index had no source.

Such a load now reads the view's title address from a table the host
keeps per view heap (SLOT_VIEW_ADDRESSES, root SRV 252 in space 1: two
dwords a slot, the low dword and the bits from 32 up; 0 for a slot
without a buffer or structure view), at the slot the load reads, clamped
to the table. The host writes a slot's address wherever it notes a view
written there (the stride table's places), and binds the table like the
stride table. The table (16 MiB of upload memory per view heap) is made
only with VICTORY_BVH_BUILDER=1; without it a dispatch of such a program
is dropped, as the program was before, so a default run is unchanged
(the four now get pipelines, which a warm-up makes).

The fifth, CS_TraceShadowRays_FullAdaptive, now stops later, at 0xae80:
"a lane mask holding lanes elsewhere read as data" (a mask compared and
joined with numbers before a vccnz branch); not taken here.

shortcut: the table holds what the layer has mirrored of the heap: a
slot no draw or pass has looked at since the title wrote it reads the
address it had (or 0).

After ka1qux/BRVIctory-ka1qux 699236769 (from fxceless/victory-fork
PR Marvisak#994, PiloteCode), there slot 251; DexNom/VIctory 5f4c3df solves the
same with a guest-address table. All GPL-3.0 forks of VIctory. Checked
with victory translate --validate --pipelines (VICTORY_HOST_WAVE=32) on
the nine shadow-mask trace programs: 8 of 9 emit, validate and get
pipelines (4 of them before).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.