Repository navigation
Conversation
ExecuteIndirect draws with the console's rectangle-list topology were refused, as rectangles are expanded on the CPU and an indirect draw's vertex count is only on the GPU. Now the bound vertex buffers are expanded whole (as direct rectangle draws are, up to 4 MiB of expanded vertices per buffer), and a small compute pass rewrites each clamped record into a triangle-list record of our own: 6 * (count / 3) vertices from 6 * (first / 3). Records that start inside a rectangle or reach past the expanded vertices draw nothing; the title's records are left unchanged. Indexed rectangle draws are still dropped. Refs Marvisak#255. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The count may sit beside the records, so the rectangle pass puts the title's buffer back where the clamp left it; the signature is found before the pass; triangle records stay within the clamp's 2^24 vertices; our compute passes are named in compile errors; the 4,096-record limit is marked as a shortcut. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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. |
|
Tested in game on an RX 7800 XT (Windows 11 26200), What the PR fixes: the rectangle drops are gone. The drop summary had 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 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 ( |
|
Independent title run of head |
|
Confirmation on NVIDIA in game. RTX 4090, driver 621.01, Windows 11, diag build with On this base the dropped rectangle draws are labelled differently from the AMD report:
So 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). |
|
AI-assisted. Tested
(Unit/host D3D12 verification only; no title dump run.) |
|
Review note (built on bool whole = a.z % 3 == 0 && a.z <= vertices && rects * 3 <= vertices - a.z;A record 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. |
|
Confirmed with the title on
Not tested
(Claude Code, Claude Opus 5.5: ran the title on both builds and compared the drop lines.) |
A rectangle-list record groups its rectangles from its own first vertex, so `[3, 1, 1, 0]` is one whole rectangle (vertices 1, 2, 3). The rewrite refused records whose first vertex was not a multiple of 3. 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. The expansions share the former 4 MiB per buffer. Raised by r4tedx on Marvisak#282. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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 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. |
|
Follow-up for the new head All three (Claude Code, Claude Opus 5.5.) |
|
For whoever picks between this and #346, which handle the same draws (#255):
AI-assisted (Claude Code). |
|
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,
AI-assisted. |
Resolved by adapting the PR's rectangle pass to HEAD's indirect barrier model: indirect::rectangles uses enhanced buffer barriers (common <-> compute UAV) when the list has them and legacy transitions otherwise; done() keeps HEAD's (args, count) form, called for the rewritten records and then the title's. Test updated to HEAD's bound/done signatures; passes with and without VICTORY_TEST_LEGACY_INDIRECT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tester tree (upstream main ffe310e plus its PRs, update 8; see its INTEGRATION.md) ran 11-25 minutes in the world on an RTX 5070 without a device removal. Where both sides carry the same PR (the wave64 stack #223/#233/#320 with #439 and #180, #454, #336, #259, #331 and others), the tester tree's newer head is taken; our own work and the PRs only we merged are kept. Conflicts, file by file: - descriptor/host.rs: the tester layout (`spare`, the guard slot after the dynamic slots, `free_table`, the capped sampler heap). A capped view heap keeps `capped_reserve()` dynamic slots, now 2^18 by default (the tester measurement, and our 91fed158), still `VICTORY_DYNAMIC_SLOTS` in diagnostics builds; uncapped hosts keep our 2^19. Our slot statistics (TAKEN/PEAK/SHORT), the bindless plan cache (`CommittedRegions`, `timed_valid_title_address`, `timed_find`, `title_bounds`) and the revision triple are kept beside the tester's `guard_slot`. - Buffer states: the tester tree's buffer-state tracker (#334: every list moves host copies of title memory between GENERIC_READ and UNORDERED_ACCESS and back to common before it closes) and depth twins (#469) are taken. #40's enhanced/legacy indirect barriers (the indirect prelude, `use_indirect_buffers`, the title buffer handoff mirrored in `host_barrier`) cannot share buffers with that tracker and are dropped; #40's argument checks (`byte_len`, exact spans, overflow-safe clamp shader, aligned counts) stay. `indirect::bound` and #282's `rectangles` go through `buffer_state`, and `indirect::execute` (#334) replaces `done`. #178's DXC fallback compiles both of our passes. Our segments (#387: `close` ends the segment, `close_native` closes a native list) carry the tracker: each native list returns its buffers to common and its twins to their depth targets, and each prelude also holds our texture uploads. - shadow.rs: our write flow (`queue_write`, one `snapshot` after the batch's refreshes, `finish_writes`, the unchanged-page cache) with #261's copy-back that also gives the snapshot the title's bytes; its tests run through our flow. - pipeline/make.rs: #275's per-frame budget and per-pipeline wake pair, with our compute waits (a dispatch waits for its pipeline, up to 20 s). - pipeline/library.rs: the tester version (#347, #275's saver thread); our concurrent-write test kept. shader_cache.rs: our byte-returning cache API with #358's "translated, only not kept". - draw.rs: #493's root SRV tables; where no table can stand in, our drop of a draw whose root view is unset or outside title buffers. Our refusal of a table offset past the capped heap stays. - resource.rs: `HostTexture` has both our `staged` generation and the depth twin. - Shaders: the tester's lower.rs for the wave64 stack, #160's image sampling (it covers our #73 and #136 sample forms) and #453/#587; kept from our side: #136's preference for an image or buffer use of a descriptor read as data and its `s_buffer_` arm, #422's nearest-even narrowing (also for #169's d16 loads and #453's interpolation), #452's spin-wait limit, #391's LDS limit, #302's spilled root arguments (now in `NativeProgram::translation_ir`), #136's PSV0 interpolation beside the tester's row harmonisation. split_tests.rs, lane_read_loop_tests.rs and docs/wave64-on-wave32.md are the tester versions (the same PRs at newer heads). - Tests: #483's heap guard dwords filled in our GPU tests of #200 (v_div_scale) and #437 (scalar loads from a raw view), which read through the guard slot otherwise; #334's debug-layer test passes an offset to our `indirect::bound`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ometry stage Merges Gargalindis's 39e056a over Marvisak#282's rectangle expansion and the depth-twin work. A rectangle-topology pipeline whose vertex stage reads per-vertex input keeps Marvisak#282's path: its buffers are expanded (direct draws on the CPU, indirect draws through the record rewrite). One without per-vertex input that got Marvisak#1020's geometry stage (rect_gs) is not expanded: its direct draws keep the title's vertex count and first vertex, its non-indexed indirect draws execute the title's records with the title's signature. Whether a direct draw expands is asked after prepare, and the indirect expansion refuses a geometry-stage pipeline, so a pipeline made ready on another thread mid-draw is never both expanded and completed. Indexed rectangle lists stay undrawn. HostPipeline keeps both depth_format/stencil (depth twins) and rect_gs. Diagnostics: the listed-frame pass lines say "rect gs true|false" for direct and indirect draws. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…) onto Marvisak#334 + integ/next Taken instead of Marvisak#282 (same draws, Marvisak#255; only one can land): Marvisak#346 expands on the GPU after the clamp, so vertex data the GPU wrote earlier in the submission is seen, and its record grouping starts at each record's first vertex. It has the stronger title evidence: the loading screen renders (justlovett0, RTX 3080), the `prepare failed`/topology-17 drops go from 256 per frame to 0 with no device removal (neonbyte1, RTX 5090/Wine; Exorion1er, RX 9070 XT/Proton; iurysf, RTX 4070), and every defect reported on it was fixed by a later commit (scratch layout cee702e, record bounds 0aebe86, count buffer 7ff1184, Wine compiler c256f83). Marvisak#282 expands on the CPU (does not see GPU-written vertices, copies bound buffers whole, three times per draw after 4d3d003) and its last head was only checked in short runs. Conflicts: 1. crates/victory-gpu/src/indirect.rs, module doc: the stack's (Wine-safe clamp in structured buffers, root signature made beside it) kept, with Marvisak#346's sentence on the rectangle expansion added. 2. indirect.rs, `bound`: Marvisak#346 splits it into `clamp_uav` (clamp + UAV barrier) and `bound` (then a fixed UAV -> INDIRECT_ARGUMENT transition); Marvisak#334 (merged just before) replaced the fixed transitions with its buffer states (`bound` asks for BUFFER_WRITE, `execute` for BUFFER_READ). Kept Marvisak#346's split with Marvisak#334's tracking, the resolution justlovett0 and the author agreed on (Marvisak#346 comments 7121242441, 7121274527): `clamp_uav` takes the buffer, starts a command and asks for BUFFER_WRITE; `bound` is `clamp_uav` (the read state comes from `execute`), no fixed transition. 3. crates/victory-gpu/src/host.rs: the stack's `PooledUpload` and Marvisak#346's `RectScratch` added at the same place; both kept. Non-textual fixes: - rectangles.rs calls `clamp_uav(list, &args.buffer, ..)` (new parameter). - rectangles.rs: the rewrite and expand passes bind the count's and the vertex buffers' host copies as root UAVs. With Marvisak#334 those copies' states are tracked, so they now ask for BUFFER_WRITE in the clamp's command (otherwise a copy a draw had moved to GENERIC_READ would be bound as a UAV in a read state). The draw's own `prepare` then asks for the read state as before. The list-owned scratch keeps Marvisak#346's own barriers. - primitive.rs: Marvisak#346's half-float rounding commit (8c7ac43) is already here through Marvisak#1220 (in Marvisak#1418), so `half_midpoints_round_to_even` is not added twice: the PR adds 8 tests, 7 are new here.
…sak#98, Marvisak#334 to Marvisak#492, validation) The line rebuilt on the bundles' current heads (Marvisak#1402 119b763, Marvisak#1492 5bbc098 without Marvisak#98, Marvisak#1504 1d41891, Marvisak#1511 ca601f0) with every merge replayed, and the merges after this file's first version (Marvisak#334, Marvisak#346, Marvisak#1024, Marvisak#211, Marvisak#492): merge order, the runner's numbers on 967d3ae (RTX 571, WARP 570 + the known Marvisak#1084 failure, all features 580; Marvisak#98's one test leaves), what is not included (Marvisak#98, Marvisak#282 for Marvisak#346, Marvisak#693 for Marvisak#1024, Marvisak#306's latest commit), and the open pull requests whose head is contained here (109, from the 18:24 collection). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #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