GPU: run indirect rectangle-list draws (#255) #282
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!282
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/282/head"
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?
@artor410 on GitHub · 2026-11-24 02:01 UTC · original
artor410:indirect-rectangles→main· +293 −32 · 3 files · 3 commits · closed without mergingRefs #255: the non-indexed draws its diagnostics name. Left open for someone to confirm with the game.
Summary
State::execute_indirectused to refuse indirect draws with the rectangle-list topology. They now go through:INDIRECT_ARGUMENTafter the pass, so a count kept beside the records stays valid.HostList::argument_space: per-list 64 KiB chunks of shader-writable memory for the rewritten records, reused after a reset.indirect::makenow takes the source and a name, so the clamp and the new pass share it.Evidence
No game files were used, and this is untested against the game.
indirect::rectangle_records_become_triangle_records. It runs the realbound→rectangles→donesequence on the host device:[6,2,0,1] [7,1,3,0] [3,1,1,0] [3,1,9,0](stride 20, 9 expanded vertices) →[12,2,0,1] [12,1,6,0] [0] [0], and the title's records come out unchanged.Before: it does not compile (no pass). After: it passes on an RDNA GPU with mesh shaders.
cargo test -p victory-gpu: 44 passed, 1 ignored. Clippy (with and withoutdiagnostics) adds no warnings, andcargo xtask policypasses.Known gaps (marked
shortcut:in the code):SV_VertexIDsee expanded ids, the same as direct rectangle draws today.Merge Danger
Door: two-way
Blast Radius: small
This only runs with
VICTORY_INDIRECT=1(diagnostics builds), for draws that were dropped before.🤖 Generated with Claude Code
@ifBars on GitHub · 2026-11-24 02:15 UTC · original
I tested the non-indexed rectangle rewrite together with #242 on Windows 10 using Microsoft WARP. Both patches modify the lifetime and layout of the indirect argument buffer. We combined the rectangle rewrite with #242’s count-aware clamp so it can read the title arguments once, write the expanded draw into the existing scratch record, and charge the budget for the expanded vertices.
The software execution test read the rewritten records back and checked vertex counts and offsets, instance fields, stride padding, the active count, and the unchanged source. All seven indirect tests passed. This test covers argument generation. It does not establish visible world geometry. The original CPU expansion still cannot see vertex data written by the GPU earlier in the same submission.
Integration commit and software test. AI-assisted implementation and verification.
@gw1337x on GitHub · 2026-11-24 02:18 UTC · original
Tested in game on an RX 7800 XT (Windows 11 26200),
diagbuild,VICTORY_D3D12_DRED=1. Build:maind2a4bae+ #135 + #124 + #130 + this PR (clean merge), one run into the opening cutscene.What the PR fixes: the rectangle drops are gone. The drop summary had
indirect kind 0: pipeline mismatch (... topology 17)at about 246 per frame before. With this PR that line never appears, and neither doesrectangles not expanded. The draws go through.The picture: no visible change. The cutscene still shows only its intro card and subtitles over black, at about 1–1.7 fps. So on its own this isn't what keeps the world black. The largest remaining drops are the untranslated shaders listed in #293: the mesh shader
910b4be059bfb28f, the compute shadere30970f1727063fd, and the "address in an SGPR" group.How the run ended: the usual page fault inside freed textures (three 2048×2048 BC7), at about 113 s (#135's remaining case).
Merge note: this PR conflicts with #242, which rewrites the same clamp path into a scratch copy (
draw.rsexecute_indirect,host.rsargument memory,indirect.rsdone). Whichever lands second will need its rectangle pass to read the clamped records from #242's copy.@tanishq-dubey on GitHub · 2026-11-24 03:00 UTC · original
Independent title run of head
ba9864dd48177e9a78a5dc95e54ca7a70a26db5eon RTX 5090, NVIDIA 620.70.06, Linux/Wine 11.22, vkd3d-proton 3.2.0, diagnostics build. Kept separately tested local handle-type, sparse-copy, indirect-budget and self-swap corrections; no wave64/waterfall stack. The world remained black and ran at roughly 0.3–0.6 fps in sampled intervals before a title null-write termination after a long stall. During early world intervals the drop summary reportedindirect kind 0: rectangles not expanded(192–512 per frame, while pipelines were still building). That reason combines missing/pending host pipeline, unavailable vertex input, signature and rewrite failures, so this does not establish which condition occurred or whether later eligible rectangles ran. Other shader translations still fail. No game data attached. AI-assisted.@ChruutvoLuzi on GitHub · 2026-11-24 03:04 UTC · original
Confirmation on NVIDIA in game. RTX 4090, driver 621.01, Windows 11, diag build with
VICTORY_D3D12_DRED=1, the first mission's opening.d2a4baewith #189, #205, #206, #134, #123, #89, #136 and #193 merged locally, once without and once with this PR atba9864d(#388 was also added in the second run; it doesn't touch the indirect path).On this base the dropped rectangle draws are labelled differently from the AMD report:
execute_indirectsendsDRAW/INDEXEDwith the rectangle topology toprepare, so the drop summary saysindirect kind 0: prepare failed (compute false, mesh false)instead ofpipeline mismatch (... topology 17). It's the same refusal.indirect kind 0: prepare failed0x887A0006after about 60 s in the world0x887A0006after about 90 sSo the rectangle drops are gone on NVIDIA too, at about the rate the AMD run above saw. After it the drop summary names no indirect-specific reason; what it still lists is per program without a host pipeline. The hang at the end is the one in #71 and not related to this PR. I didn't capture frames, so I can't say whether anything new shows up on screen.
AI-assisted (Claude Code).
@lordon1a on GitHub · 2026-11-24 03:08 UTC · original
AI-assisted.
Tested
ba9864dd4on Windows 11 Home 26H2 (build 26200) with Intel(R) Iris(R) Xe Graphics (8086:46a6, driver32.0.101.7088, DXGI Adapter 0),rustc 1.100.0(x86_64-pc-windows-gnullvm):cargo xtask policy:151 files okcargo test -p victory-gpu -- --test-threads=1: 44 passed, 0 failed, 1 ignored (benchmark) in0.24s, includingindirect::tests::rectangle_records_become_triangle_recordsandindirect::tests::argument_clamp_builds.draw.rs,host.rs,indirect.rs).(Unit/host D3D12 verification only; no title dump run.)
@r4tedx on GitHub · 2026-11-24 03:29 UTC · original
Review note (built on
maind2a4bae;cargo test -p victory-gpupasses on an RTX 5070). One case that is refused although it is a complete rectangle list: the helper shader requires the start vertex to be a multiple of 3,A record
[3, 1, 1, 0](three vertices, one instance, starting at vertex 1) is one whole rectangle, formed from vertices 1, 2, 3: primitives are grouped from the record's start vertex, not from vertex 0. Here it becomes an empty draw, and the test encodes that as expected. Grouping relative toa.zwould keep it (#346 expands on the GPU from the record's start).These are the roughly 250 dropped draws per frame of #255, so if a tester has the numbers: how many of the world's rectangle-list records have a start vertex that is not a multiple of 3? If none, this does not matter in practice.
From reading and synthetic tests only; I have no copy of the title.
@SpaghettiMaster545 on GitHub · 2026-11-24 03:31 UTC · original
Confirmed with the title on
ba9864dmerged alone ontomaind2a4bae(clean), against twomainruns made the same way (#255).VICTORY_CACHE_DIR,VICTORY_KEYSinto story mode, until the host GPU failure (#71, unrelated).dropped N/frame without a host pipeline: indirect kind 0, every 5 s line, from the first world line to the hang:main, two runs:prepare failed (compute false, mesh false): 40, 64, 64, 70, 127, 200, then 256 per frame on every line after (45 … 256 in the second run). These are the ~250 of #255.rectangles not expanded: 214, 192, 192, 192, 130, 80, 20 per frame. The drops fall while the world loads, instead of rising to 256: by the last line, about 236 of the ~256 per frame go through.rectangles not expanded, so some records still fall outside what the expansion takes (whole rectangles within the bound vertices, the 4 MiB cap, orfirst % 3 != 0). I did not split those further.main, and the world hang is at the same point (84 s, withinmain's 59–111 s).Not tested
(Claude Code, Claude Opus 5.5: ran the title on both builds and compared the drop lines.)
@artor410 on GitHub · 2026-11-24 03:34 UTC · original
Thanks, r4tedx: fixed in
4d3d003. The bound buffers are now expanded from each of their first three vertices, one expansion after the other, and a record reads the expansion its first vertex falls in. So[3, 1, 1, 0]draws vertices 1, 2, 3 (the test now expects this, plus a start at 5). The three expansions share the former 4 MiB per buffer, and the CPU copy runs three times per draw. Synthetic tests only (cargo test -p victory-gpu: 44 passed); untested against the title.On #242 (gw1337x, ifBars): agreed, whichever lands second has to read the clamped records from #242's copy. I'll rebase onto it if it merges first.
@SpaghettiMaster545 on GitHub · 2026-11-24 03:51 UTC · original
Follow-up for the new head
4d3d003, the same setup as my report above: three runs, but each ended at the world hang (#71) after only 47, 52 and 64 s, so they reach just the first one or two drop lines. Those read 192, then 96–146rectangles not expandedper frame, falling the same way as onba9864d(214 → 20 over an 84 s run). That is too short to tell whether thefirst % 3change removes the rest of the drops.All three
4d3d003runs hung a bit earlier thanmain(59–111 s over three runs) andba9864d(84 s). With so few runs, and the hang time varying this much onmainalone, I would not read anything into that yet.(Claude Code, Claude Opus 5.5.)
@Exorion1er on GitHub · 2026-11-24 09:33 UTC · original
For whoever picks between this and #346, which handle the same draws (#255):
c256f83) builds under stock Proton.draw.rsandindirect.rs, so only one can land.AI-assisted (Claude Code).
@iurysf on GitHub · 2026-11-24 11:21 UTC · original
In-game confirmation on NVIDIA, as asked. RTX 4070, driver 32.0.16.2101, on top of #493 + #483 (needed to keep this GPU alive in the world). Merges cleanly. Default loop limit, 300 s,
DRED=1+GPU_TIMING=1, 2 runs each, alternating, idle CPU.indirect kind 0: prepare failed, per frame, last report)prepare, because the dynamic descriptor slots run out (a draw or dispatch dropped: no dynamic slots for its tables). #688 targets that, and I'm measuring the two together next. A few loggedrectangles not expanded(16 in one run).AI-assisted.
Pull request closed