GPU: expand indirect rectangle-list draws on the GPU #346

Closed
BastienRodz wants to merge 7 commits from upstream-pr/346 into main
BastienRodz commented 2026-11-24 02:28:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T02:28:28Z.


Closes #255 for non-indexed draws.

What

Indirect draws with the console's rectangle-list topology (17) now run on the host instead of being dropped. State::execute_indirect refused them because rectangles are expanded on the CPU (primitive::expand_rects), and an indirect draw's vertex count is only known on the GPU. #255 counts about 250 of these drops per world frame, and the title draws its full-screen passes as rectangles.

How

For kind 0 (DRAW) with RECTANGLES, after the existing argument clamp, two compute passes of ours run before ExecuteIndirect (new module crates/victory-gpu/src/rectangles.rs). Both are HLSL compiled at run time by the system's D3DCompile (cs_5_1): Microsoft's, or Wine's vkd3d-shader under Wine/Proton. For the latter they read buffers as 32-bit words ((RW)StructuredBuffer<uint>), and their root signatures are serialized in code (since c256f83; checked with vkd3d-compiler 2.1, the version GE-Proton11-12 ships).

  1. rect_rewrite (one thread per record):
    • Respects the title's count buffer.
    • Checks that start .. start + 3 * rects lies inside every bound per-vertex vertex buffer.
    • Allocates rects * 6 vertices from a per-list scratch with an atomic counter.
    • Writes a rewritten copy of the record into a list-owned arguments buffer: rects * 6 vertices, the same instances, the allocated start, the same start instance.
    • The title's arguments are not changed beyond what the clamp already does.
  2. rect_expand (one group per record, one pass per per-vertex slot):
    • Writes (v0, v1, v2, v0, v2, v3) per rectangle.
    • Computes v3 = v0 + v2 - v1 the way expand_rects does: same formats (primitive::components), same half-float and UNORM conversions and rounding. Unknown formats and components past the stride keep v0's bytes.
  3. ExecuteIndirect then reads only list-owned buffers: the rewritten arguments, in which records at or past the title's count are empty draws, so no count buffer is passed (since 7ff1184). The expanded slots are bound with IASetVertexBuffers. Transitions around the draw put the scratch back in unordered access, so the next indirect rectangle draw of the list reuses it.

Half floats, on both paths (primitive.rs and the shader's copy):

  • halfway values round to even (4090d29): fuzeofficlal's fix for the direct path (comment, their c256b97), carried here since PR creation is limited to collaborators;
  • subnormals as #418 writes them on the CPU (1278485).

The CPU and GPU paths therefore still agree byte for byte.

List-owned memory (host.rs):

  • one 8 MiB default-heap vertex scratch per list, made on first use;
  • a rewritten-arguments buffer that grows when a draw has more records;
  • chunks of atomic counters, zeroed at submission the way the clamp's budget is.

indirect::bound is split so that clamp_uav (clamp, then a UAV barrier) can be followed by the rewrite pass. bound itself behaves as before.

Fallbacks: if a pass is unavailable or the arguments are unaligned, the draw is dropped as before, each case with its own diagnostics why(...) reason. Records that do not fit the scratch, or that reach past their buffers, draw nothing.

The rectangle path changes the state of no title buffer: the arguments and the count are only read, by the rewrite pass.

Limitations, written as shortcut: notes in the module:

  • Indexed rectangles: still unsupported, as for direct draws. They get their own reason now.
  • Scratch size: 8 MiB per list, shared by the records of one draw.
  • Fourth corner: computed from vertex inputs, not vertex shader outputs, as in primitive.
  • Pipelines with no per-vertex inputs: a pipeline that builds its corners from the vertex id gets 6 * rects vertices from 0, the same as a direct rectangle draw today. The vertex-ID remap suggested in #255 is not part of this PR.

Tested

Native Windows: the upstream CI's checks (clippy -D warnings with and without --all-features, then cargo test --workspace --locked) pass on GitHub's windows-latest at this head: https://github.com/BastienRodz/VIctory/actions/runs/45381063747

Latest, on 8ef6bfe rebased onto main ffe310e (clean): cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features as the CI runs it, is clean. victory-gpu: 58 passed under plain Wine (61 with diagnostics). On vkd3d-proton: 60 passed and 1 failed, a_rejected_blob_gives_an_empty_library, an environment failure main has there too. Policy: 155 files ok. The details below are from earlier heads.

Mine: Linux x86_64, cross-built with cargo xwin for x86_64-pc-windows-msvc, tests run under Wine 11 with Xvfb.

  • GPU tests: vkd3d-proton 3.1 on Mesa lavapipe (software Vulkan; VKD3D_FEATURE_LEVEL=12_0), as the host D3D12 device.

  • HLSL: compiled by Microsoft's d3dcompiler_47.dll, installed with winetricks.

  • cargo xwin test -p victory-gpu: 48 passed, 2 failed, 1 ignored. main (d2a4bae) in the same setup: 41 passed, the same 2 failed. The two failures are the known vkd3d-proton environment failures, a_rejected_blob_gives_an_empty_library and buffer_data_reaches_the_host_texture.

  • Without a host device (plain Wine, so host tests skip): 50 passed. With --features diagnostics: 52 passed.

  • New tests:

    • Unit tests: slot_elements_filters_and_clips_to_stride, scratch_layout_handles_multi_slot_and_alignment, max_source_vertices_takes_minimum_across_slots, dispatch_grid_respects_d3d12_limit.
    • Compile checks: hlsl_compiles (both shaders through D3DCompile), rectangle_expander_builds (the host accepts both pipelines).
    • gpu_expansion_matches_cpu_expand_rects: runs both passes on synthetic vertices and compares the GPU output byte for byte with expand_rects. The vertices cover F32x2, F16x2, UNORM16x2, UNORM8x4, an unknown format and an element past the stride. The records cover two rectangles, a rectangle with instances and a start instance, an out-of-bounds record, a zero-instance record and a record past the count.
  • Mutation check: with the shader's fourth corner changed to a + f + b, gpu_expansion_matches_cpu_expand_rects fails, so the comparison catches it.

  • cargo xwin clippy -p victory-gpu --all-targets, with and without diagnostics: one warning, the same one as on main (a missing safety comment in a test outside this diff).

  • rustfmt --check is clean on rectangles.rs. The touched files have the same rustfmt diffs as on main, none new.

  • cargo xtask policy: asset policy: 152 files ok.

Tested by others (thanks)

  • DarX-Oren, RX 6700 XT, native D3D12 (comment): found the scratch-layout exact-fit bug, fixed in cee702e. With the fix, the ExecuteIndirect output matched the CPU-expanded reference image (SHA-256).
  • fuzeofficlal, Windows 11, RTX 5090 and a Radeon iGPU, at cee702e (comment): the rectangle tests pass with no D3D12 debug-layer errors. An end-to-end fixture (vertex copy, the PR's expansion and barriers, then a real ExecuteIndirect draw starting at vertex 1) matched the expected image on both adapters.
  • justlovett0, with the title (v1.0.2.1), Windows 10, RTX 3080, head cee702e + #175 (comment): the loading screen now renders (black without this PR). By frame 2048, 11,351 of 11,351 draws and 2,144 of 2,144 dispatches ran. World entry still hangs that NVIDIA GPU, because of wave64 compute pipelines the host refuses (#71); that hang is not from this PR.
  • fuzeofficlal, Windows 11, RTX 5090 and WARP, at 0aebe86 (comment): the whole path, from State::execute_indirect through expand() to a native draw and readback. The count is written by a compute dispatch on the same list into a separate buffer: count 0 draws nothing, count 1 draws exactly the expected region. No debug-layer errors on either adapter. On d2a4bae, the same calls are rejected.
  • marquezinii, RTX 5070, at cee702e (review): victory-gpu 50 passed. The review led to 0aebe86: the rewrite pass bounds records itself (for #242), and half-float rounding carries. Re-run at 0aebe86 (comment): 49 passed. The only failure is a timing test in frame.rs that fails under load, passes alone, and is not touched here. The count-buffer state and the UAV-bound copies are agreed as #334 follow-ups.
  • SkillIssueXO, Windows 11, RTX 5070 Ti, native D3D12, at 4090d29 (comment): victory-gpu 57 passed, 0 failed, including half_midpoints_round_to_even and gpu_expansion_matches_cpu_expand_rects. With only the shader's old rounding put back, the byte-for-byte test fails on that GPU (0x01 where the CPU has 0x00).
  • Exorion1er, with the title, Fedora 44, RX 9070 XT RADV, stock GE-Proton11-12 (Wine's builtin d3dcompiler_47) + vkd3d-proton 3.2.0, at c256f83 + #190 (comment): no E5005, no root signature error, and 0 rectangle expander shader unavailable drops (256/frame before). The only rectangle drop left is indexed rectangles not supported (~0.1/frame). The run later ended in the same texture-read page fault plain main gives on that card (#714), which is not from this PR. They also ported both passes to the shader crate's DXIL writer (branch, stacked on #190), should no run-time compiler be wanted.
  • justr4mzi, Windows 11, RX 6700 XT (RDNA2), native D3D12, at c256f83 on main 8e79c80 in a 13-PR stack (comment): clean merge. victory-gpu 64 passed, 0 failed (all 7 rectangles::tests::*); with diagnostics 67 passed; full workspace 329 passed, 0 failed.
  • iurysf, with the title, RTX 4070, on #493 + #483, 2 runs of 300 s (comment): rectangle drops 256/frame → 12 and 204 (#282: 47 and 12 under the same conditions), no device removal. The remaining drops fail in prepare after the expansion, mostly on dynamic descriptor slot exhaustion (#688).

Not run

  • The world picture with this PR, on a setup that does not hang there.

No game data used: every test input is synthetic.

AI-assisted: implemented with Gemini 4 Neon, then reviewed, corrected (docs, count-buffer state) and tested with Claude Code. Every command above was really run.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6573249018 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T02:28:28Z. --- Closes #255 for non-indexed draws. ## What Indirect draws with the console's rectangle-list topology (17) now run on the host instead of being dropped. `State::execute_indirect` refused them because rectangles are expanded on the CPU (`primitive::expand_rects`), and an indirect draw's vertex count is only known on the GPU. #255 counts about 250 of these drops per world frame, and the title draws its full-screen passes as rectangles. ## How For kind 0 (`DRAW`) with `RECTANGLES`, after the existing argument clamp, two compute passes of ours run before `ExecuteIndirect` (new module `crates/victory-gpu/src/rectangles.rs`). Both are HLSL compiled at run time by the system's `D3DCompile` (cs_5_1): Microsoft's, or Wine's vkd3d-shader under Wine/Proton. For the latter they read buffers as 32-bit words (`(RW)StructuredBuffer<uint>`), and their root signatures are serialized in code (since `c256f83`; checked with vkd3d-compiler 2.1, the version GE-Proton11-12 ships). 1. **`rect_rewrite`** (one thread per record): - Respects the title's count buffer. - Checks that `start .. start + 3 * rects` lies inside every bound per-vertex vertex buffer. - Allocates `rects * 6` vertices from a per-list scratch with an atomic counter. - Writes a rewritten copy of the record into a list-owned arguments buffer: `rects * 6` vertices, the same instances, the allocated start, the same start instance. - The title's arguments are not changed beyond what the clamp already does. 2. **`rect_expand`** (one group per record, one pass per per-vertex slot): - Writes `(v0, v1, v2, v0, v2, v3)` per rectangle. - Computes `v3 = v0 + v2 - v1` the way `expand_rects` does: same formats (`primitive::components`), same half-float and UNORM conversions and rounding. Unknown formats and components past the stride keep v0's bytes. 3. `ExecuteIndirect` then reads only list-owned buffers: the rewritten arguments, in which records at or past the title's count are empty draws, so no count buffer is passed (since `7ff1184`). The expanded slots are bound with `IASetVertexBuffers`. Transitions around the draw put the scratch back in unordered access, so the next indirect rectangle draw of the list reuses it. Half floats, on both paths (`primitive.rs` and the shader's copy): - halfway values round to even (`4090d29`): fuzeofficlal's fix for the direct path ([comment](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7122043116), their `c256b97`), carried here since PR creation is limited to collaborators; - subnormals as #418 writes them on the CPU (`1278485`). The CPU and GPU paths therefore still agree byte for byte. List-owned memory (`host.rs`): - one 8 MiB default-heap vertex scratch per list, made on first use; - a rewritten-arguments buffer that grows when a draw has more records; - chunks of atomic counters, zeroed at submission the way the clamp's budget is. `indirect::bound` is split so that `clamp_uav` (clamp, then a UAV barrier) can be followed by the rewrite pass. `bound` itself behaves as before. Fallbacks: if a pass is unavailable or the arguments are unaligned, the draw is dropped as before, each case with its own diagnostics `why(...)` reason. Records that do not fit the scratch, or that reach past their buffers, draw nothing. The rectangle path changes the state of no title buffer: the arguments and the count are only read, by the rewrite pass. Limitations, written as `shortcut:` notes in the module: - **Indexed rectangles:** still unsupported, as for direct draws. They get their own reason now. - **Scratch size:** 8 MiB per list, shared by the records of one draw. - **Fourth corner:** computed from vertex inputs, not vertex shader outputs, as in `primitive`. - **Pipelines with no per-vertex inputs:** a pipeline that builds its corners from the vertex id gets `6 * rects` vertices from 0, the same as a direct rectangle draw today. The vertex-ID remap suggested in #255 is not part of this PR. ## Tested **Native Windows:** the upstream CI's checks (clippy `-D warnings` with and without `--all-features`, then `cargo test --workspace --locked`) pass on GitHub's `windows-latest` at this head: https://github.com/BastienRodz/VIctory/actions/runs/45381063747 Latest, on `8ef6bfe` rebased onto `main` `ffe310e` (clean): `cargo clippy --workspace --all-targets --locked -- -D warnings`, with and without `--all-features` as the CI runs it, is clean. `victory-gpu`: 58 passed under plain Wine (61 with `diagnostics`). On vkd3d-proton: 60 passed and 1 failed, `a_rejected_blob_gives_an_empty_library`, an environment failure `main` has there too. Policy: 155 files ok. The details below are from earlier heads. Mine: Linux x86_64, cross-built with `cargo xwin` for `x86_64-pc-windows-msvc`, tests run under Wine 11 with Xvfb. - **GPU tests:** vkd3d-proton 3.1 on Mesa lavapipe (software Vulkan; `VKD3D_FEATURE_LEVEL=12_0`), as the host D3D12 device. - **HLSL:** compiled by Microsoft's `d3dcompiler_47.dll`, installed with winetricks. - `cargo xwin test -p victory-gpu`: **48 passed, 2 failed, 1 ignored**. `main` (`d2a4bae`) in the same setup: 41 passed, the same 2 failed. The two failures are the known vkd3d-proton environment failures, `a_rejected_blob_gives_an_empty_library` and `buffer_data_reaches_the_host_texture`. - Without a host device (plain Wine, so host tests skip): 50 passed. With `--features diagnostics`: 52 passed. - New tests: - **Unit tests:** `slot_elements_filters_and_clips_to_stride`, `scratch_layout_handles_multi_slot_and_alignment`, `max_source_vertices_takes_minimum_across_slots`, `dispatch_grid_respects_d3d12_limit`. - **Compile checks:** `hlsl_compiles` (both shaders through `D3DCompile`), `rectangle_expander_builds` (the host accepts both pipelines). - **`gpu_expansion_matches_cpu_expand_rects`:** runs both passes on synthetic vertices and compares the GPU output byte for byte with `expand_rects`. The vertices cover F32x2, F16x2, UNORM16x2, UNORM8x4, an unknown format and an element past the stride. The records cover two rectangles, a rectangle with instances and a start instance, an out-of-bounds record, a zero-instance record and a record past the count. - **Mutation check:** with the shader's fourth corner changed to `a + f + b`, `gpu_expansion_matches_cpu_expand_rects` fails, so the comparison catches it. - `cargo xwin clippy -p victory-gpu --all-targets`, with and without `diagnostics`: one warning, the same one as on `main` (a missing safety comment in a test outside this diff). - `rustfmt --check` is clean on `rectangles.rs`. The touched files have the same rustfmt diffs as on `main`, none new. - `cargo xtask policy`: `asset policy: 152 files ok`. ## Tested by others (thanks) - **DarX-Oren, RX 6700 XT, native D3D12** ([comment](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7120592467)): found the scratch-layout exact-fit bug, fixed in `cee702e`. With the fix, the `ExecuteIndirect` output matched the CPU-expanded reference image (SHA-256). - **fuzeofficlal, Windows 11, RTX 5090 and a Radeon iGPU, at `cee702e`** ([comment](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7120734503)): the rectangle tests pass with no D3D12 debug-layer errors. An end-to-end fixture (vertex copy, the PR's expansion and barriers, then a real `ExecuteIndirect` draw starting at vertex 1) matched the expected image on both adapters. - **justlovett0, with the title (v1.0.2.1), Windows 10, RTX 3080, head `cee702e` + #175** ([comment](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7121242441)): **the loading screen now renders** (black without this PR). By frame 2048, 11,351 of 11,351 draws and 2,144 of 2,144 dispatches ran. World entry still hangs that NVIDIA GPU, because of wave64 compute pipelines the host refuses (#71); that hang is not from this PR. - **fuzeofficlal, Windows 11, RTX 5090 and WARP, at `0aebe86`** ([comment](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7122043116)): the whole path, from `State::execute_indirect` through `expand()` to a native draw and readback. The count is written by a compute dispatch on the same list into a separate buffer: count 0 draws nothing, count 1 draws exactly the expected region. No debug-layer errors on either adapter. On `d2a4bae`, the same calls are rejected. - **marquezinii, RTX 5070, at `cee702e`** ([review](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7121959412)): `victory-gpu` 50 passed. The review led to `0aebe86`: the rewrite pass bounds records itself (for #242), and half-float rounding carries. Re-run at `0aebe86` ([comment](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7122532432)): 49 passed. The only failure is a timing test in `frame.rs` that fails under load, passes alone, and is not touched here. The count-buffer state and the UAV-bound copies are agreed as #334 follow-ups. - **SkillIssueXO, Windows 11, RTX 5070 Ti, native D3D12, at `4090d29`** ([comment](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7126347477)): `victory-gpu` 57 passed, 0 failed, including `half_midpoints_round_to_even` and `gpu_expansion_matches_cpu_expand_rects`. With only the shader's old rounding put back, the byte-for-byte test fails on that GPU (`0x01` where the CPU has `0x00`). - **Exorion1er, with the title, Fedora 44, RX 9070 XT RADV, stock GE-Proton11-12 (Wine's builtin `d3dcompiler_47`) + vkd3d-proton 3.2.0, at `c256f83` + #190** ([comment](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7127357762)): no `E5005`, no root signature error, and **0 `rectangle expander shader unavailable` drops (256/frame before)**. The only rectangle drop left is `indexed rectangles not supported` (~0.1/frame). The run later ended in the same texture-read page fault plain `main` gives on that card (#714), which is not from this PR. They also ported both passes to the shader crate's DXIL writer ([branch](https://github.com/Exorion1er/VIctory/commits/gpu/rect-expander-own-writer), stacked on #190), should no run-time compiler be wanted. - **justr4mzi, Windows 11, RX 6700 XT (RDNA2), native D3D12, at `c256f83` on `main` `8e79c80` in a 13-PR stack** ([comment](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7128260774)): clean merge. `victory-gpu` 64 passed, 0 failed (all 7 `rectangles::tests::*`); with `diagnostics` 67 passed; full workspace 329 passed, 0 failed. - **iurysf, with the title, RTX 4070, on #493 + #483, 2 runs of 300 s** ([comment](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7130000905)): rectangle drops 256/frame → 12 and 204 (#282: 47 and 12 under the same conditions), no device removal. The remaining drops fail in `prepare` after the expansion, mostly on dynamic descriptor slot exhaustion (#688). ## Not run - The world picture with this PR, on a setup that does not hang there. No game data used: every test input is synthetic. AI-assisted: implemented with Gemini 4 Neon, then reviewed, corrected (docs, count-buffer state) and tested with Claude Code. Every command above was really run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
keiranross commented 2026-11-24 06:52:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by keiranross on 2026-11-24T04:47:11Z.

Review: APPROVED


No description provided.

<!-- greyfinch-sync:Marvisak/VIctory:review:6033781843 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#pullrequestreview-6033781843). Originally posted by [keiranross](https://github.com/keiranross) on 2026-11-24T04:47:11Z. **Review:** APPROVED --- _No description provided._
DarX-Oren commented 2026-11-24 06:55:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DarX-Oren on 2026-11-24T02:54:36Z.


Native RDNA2 validation and scratch alignment fix

Tested this PR on physical AMD RX 6700 XT hardware using native Windows D3D12.

I found an issue in scratch_layout(): reserving worst-case alignment slack can reject a valid layout when the vertex slots already fit within the available capacity.

I implemented a local correction that calculates the actual alignment padding while preserving the production 8 MiB scratch limit.

The same synthetic rendering fixture was tested before and after the correction:

Test Original #346 Local fix
Normal rectangle: incorrect pixels 0/1024 0/1024
Exact 120-byte fit: incorrect pixels 1024/1024 0/1024

The corrected ExecuteIndirect output produced an RGBA8 image identical by SHA-256 to the CPU-expanded reference.

Validation:

  • RX 6700 XT (1002:73df)
  • Driver: 32.0.21045.29003
  • 10 rectangle tests passed
  • 272 workspace tests passed
  • 276 tests passed with diagnostics
  • Zero failures, four ignored per configuration
  • Clippy and asset policy passed

Four additional comparisons were internally skipped because the console compiler was unavailable. The D3D12 debug layer was also unavailable.

Indexed rectangles and SV_VertexID remapping remain outside the scope of this correction.

The fix and regression test are available in my local commit b34ae5c. I can share the patch if you would like to incorporate it into this PR.

No commercial game data was used.

AI use: OpenAI Codex assisted with implementation, testing and analysis on physical hardware.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7120592467 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7120592467). Originally posted by [DarX-Oren](https://github.com/DarX-Oren) on 2026-11-24T02:54:36Z. --- ## Native RDNA2 validation and scratch alignment fix Tested this PR on physical AMD RX 6700 XT hardware using native Windows D3D12. I found an issue in `scratch_layout()`: reserving worst-case alignment slack can reject a valid layout when the vertex slots already fit within the available capacity. I implemented a local correction that calculates the actual alignment padding while preserving the production 8 MiB scratch limit. The same synthetic rendering fixture was tested before and after the correction: | Test | Original #346 | Local fix | |---|---:|---:| | Normal rectangle: incorrect pixels | 0/1024 | 0/1024 | | Exact 120-byte fit: incorrect pixels | 1024/1024 | 0/1024 | The corrected ExecuteIndirect output produced an RGBA8 image identical by SHA-256 to the CPU-expanded reference. Validation: - RX 6700 XT (1002:73df) - Driver: 32.0.21045.29003 - 10 rectangle tests passed - 272 workspace tests passed - 276 tests passed with diagnostics - Zero failures, four ignored per configuration - Clippy and asset policy passed Four additional comparisons were internally skipped because the console compiler was unavailable. The D3D12 debug layer was also unavailable. Indexed rectangles and SV_VertexID remapping remain outside the scope of this correction. The fix and regression test are available in my local commit b34ae5c. I can share the patch if you would like to incorporate it into this PR. No commercial game data was used. AI use: OpenAI Codex assisted with implementation, testing and analysis on physical hardware.
BastienRodz commented 2026-11-24 06:55:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T02:56:02Z.


Thanks for running it on a real RX 6700 XT, and for the exact-fit case. You're right: scratch_layout took the worst-case slack (16 bytes per extra slot) off the capacity before counting vertices, so a layout that fits exactly was refused. With the 8 MiB scratch the cost in practice was a few rectangles of room, but it was wrong.

Fixed in cee702e. It now starts from the unpadded vertex count and steps down one rectangle at a time until the padded regions fit. I wrote it myself rather than taking your patch, to keep the history in one piece. scratch_layout_handles_multi_slot_and_alignment gains two regression cases:

  • two slots of 8 and 12 bytes in 120 bytes: 6 vertices, second slot at 48;
  • two slots of 4 bytes: 55 bytes too few, 56 enough, second slot at 32.

Before the fix both return None.

Re-run (cross-built, Wine + vkd3d-proton 3.1 on lavapipe): cargo xwin test -p victory-gpu gives 48 passed and 2 failed, the same two vkd3d-proton environment failures as main. gpu_expansion_matches_cpu_expand_rects passes. Clippy: same single warning as main. cargo xtask policy: 152 files ok.

If you can, a rerun of your pixel fixture on this head would be welcome, and so would a world run on a diag build to see whether the topology 17 drop reason goes away.

No game data used. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7120614955 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7120614955). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T02:56:02Z. --- Thanks for running it on a real RX 6700 XT, and for the exact-fit case. You're right: `scratch_layout` took the worst-case slack (16 bytes per extra slot) off the capacity before counting vertices, so a layout that fits exactly was refused. With the 8 MiB scratch the cost in practice was a few rectangles of room, but it was wrong. Fixed in cee702e. It now starts from the unpadded vertex count and steps down one rectangle at a time until the padded regions fit. I wrote it myself rather than taking your patch, to keep the history in one piece. `scratch_layout_handles_multi_slot_and_alignment` gains two regression cases: - two slots of 8 and 12 bytes in 120 bytes: 6 vertices, second slot at 48; - two slots of 4 bytes: 55 bytes too few, 56 enough, second slot at 32. Before the fix both return `None`. Re-run (cross-built, Wine + vkd3d-proton 3.1 on lavapipe): `cargo xwin test -p victory-gpu` gives 48 passed and 2 failed, the same two vkd3d-proton environment failures as `main`. `gpu_expansion_matches_cpu_expand_rects` passes. Clippy: same single warning as `main`. `cargo xtask policy`: 152 files ok. If you can, a rerun of your pixel fixture on this head would be welcome, and so would a world run on a `diag` build to see whether the `topology 17` drop reason goes away. No game data used. AI-assisted (Claude Code).
fuzeofficlal commented 2026-11-24 06:55:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T03:03:42Z.


Native D3D12 results for cee702e on Windows 11. All 8 rectangle tests passed on both an RTX 5090 and a Radeon iGPU (1002:13c0), with no errors from the D3D12 debug layer. That includes the updated scratch-layout tests.

The additional fixture copies synthetic vertices into a vertex buffer on the same command list, then records the PR's expansion and barriers followed by an actual ExecuteIndirect draw. The indirect record starts at vertex 1, after an unrelated sentinel. All 64 pixels matched the expected 8×8 image on both adapters. On the RTX 5090, omitting the vertex copy in the earlier bcc32cf run left the target at the clear color and failed the first pixel assertion.

The fixture uses a small test graphics pipeline and synthetic inputs throughout. Game rendering, the caller's pipeline routing, and count-buffer behavior are outside its coverage.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7120734503 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7120734503). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-24T03:03:42Z. --- Native D3D12 results for `cee702e` on Windows 11. All 8 rectangle tests passed on both an RTX 5090 and a Radeon iGPU (`1002:13c0`), with no errors from the D3D12 debug layer. That includes the updated scratch-layout tests. The additional fixture copies synthetic vertices into a vertex buffer on the same command list, then records the PR's expansion and barriers followed by an actual `ExecuteIndirect` draw. The indirect record starts at vertex 1, after an unrelated sentinel. All 64 pixels matched the expected 8×8 image on both adapters. On the RTX 5090, omitting the vertex copy in the earlier `bcc32cf` run left the target at the clear color and failed the first pixel assertion. The fixture uses a small test graphics pipeline and synthetic inputs throughout. Game rendering, the caller's pipeline routing, and count-buffer behavior are outside its coverage.
vladbondarenko97 commented 2026-11-24 06:55:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by vladbondarenko97 on 2026-11-24T03:09:06Z.


First test of this PR against the retail title (the PR is synthetic-only today), on the GPU where the dropped rect draws matter most.

Setup: RTX 3080 Ti 12 GB, driver 610.60 (32.0.16.1060), Windows 11 Pro 26300, i7-12700KF, complete 1.0.2.1 package (all 111 files SHA-256-verified), built at the PR head with --profile diag --features diagnostics, XCL-style isolation off, network disabled.

Result — the counter says the fix is live:

victory_gpu::host: 30.0 fps, 33.3 ms/frame (2.0 ms on the GPU), 39 draws/frame,
  dropped 0 without a host pipeline (0 being made) and 0 indirect

0 indirect with rect-list content on screen: the indirect rect draws are reaching the host path instead of being dropped. Menus, the legal screens (Copyright / Photosensitivity), the full-colour key art and the intro video all render; frame captures (diagnostics) are clean PNGs at 30 fps.

Two observations that may be useful:

  1. During one transition the rate dropped to 9.4 fps / 106.4 ms per frame with the GPU at only 2.3 ms — i.e. the cost was not in the expand passes; it recovered to 30.0 fps on the next sample. If anyone else sees a periodic dip, it is worth checking whether the rewrite/expand readback or the scratch allocation is on that path.
  2. One run that started 2 s after I killed a previous instance failed every frame with no swap chain — Not enough memory resources are available to process this command (14,861 failures, zero swap chains) — that was environmental (the prior process's GPU memory had not been reclaimed yet), not this PR; with a 25 s settle it initialised normally. Worth knowing before attributing a swap-chain failure to the change.

I did not reach the world in these runs (menu input is scripted here), so I cannot yet say what the expand passes do to world content — happy to run it again with whatever key/timing recipe you want, or to try a patch build that logs per-draw counts.

AI-assisted (Claude Code CLI via a model proxy; logs and offsets only, no game data).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7120818641 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7120818641). Originally posted by [vladbondarenko97](https://github.com/vladbondarenko97) on 2026-11-24T03:09:06Z. --- First test of this PR against the **retail title** (the PR is synthetic-only today), on the GPU where the dropped rect draws matter most. **Setup:** RTX 3080 Ti 12 GB, driver 610.60 (`32.0.16.1060`), Windows 11 Pro 26300, i7-12700KF, complete 1.0.2.1 package (all 111 files SHA-256-verified), built at the PR head with `--profile diag --features diagnostics`, `XCL`-style isolation off, network disabled. **Result — the counter says the fix is live:** ``` victory_gpu::host: 30.0 fps, 33.3 ms/frame (2.0 ms on the GPU), 39 draws/frame, dropped 0 without a host pipeline (0 being made) and 0 indirect ``` `0 indirect` with rect-list content on screen: the indirect rect draws are reaching the host path instead of being dropped. Menus, the legal screens (Copyright / Photosensitivity), the full-colour key art and the intro video all render; frame captures (diagnostics) are clean PNGs at 30 fps. **Two observations that may be useful:** 1. During one transition the rate dropped to **9.4 fps / 106.4 ms per frame** with the GPU at only 2.3 ms — i.e. the cost was not in the expand passes; it recovered to 30.0 fps on the next sample. If anyone else sees a periodic dip, it is worth checking whether the rewrite/expand readback or the scratch allocation is on that path. 2. One run that started **2 s** after I killed a previous instance failed every frame with `no swap chain — Not enough memory resources are available to process this command` (14,861 failures, zero swap chains) — that was environmental (the prior process's GPU memory had not been reclaimed yet), not this PR; with a 25 s settle it initialised normally. Worth knowing before attributing a swap-chain failure to the change. I did not reach the world in these runs (menu input is scripted here), so I cannot yet say what the expand passes do to world content — happy to run it again with whatever key/timing recipe you want, or to try a patch build that logs per-draw counts. AI-assisted (Claude Code CLI via a model proxy; logs and offsets only, no game data).
BastienRodz commented 2026-11-24 06:55:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T03:09:32Z.


Thanks for running it against the title. A caveat on the counter: per #255 the rectangle drops are in world frames, and the menus and intro may issue no indirect rectangle draws at all. So 0 indirect before the world is probably what main shows too. It doesn't confirm the new path yet.

On the 9.4 fps dip: this path has no readback. Everything it adds runs on the GPU. The CPU side only zeroes a 4 KiB counter chunk at submission and copies the element table (a few bytes) into upload memory, once per indirect rectangle draw. With the GPU at 2.3 ms the time went elsewhere on the CPU, and the expand passes can only have run if indirect rectangle draws were issued, which brings us back to the point above. Running main with the same recipe would show whether the dip is there too.

What would settle the PR is a world run, main against this head, same build profile and recipe, comparing:

  • the drop summary: whether indirect kind 0: pipeline mismatch (compute false, mesh false, topology 17) is gone, and the dropped ... indirect count per world frame;
  • ms/frame in the world;
  • whether the picture behind the opening cutscene's title card changes (VICTORY_CAPTURE).

For scripted input, VICTORY_KEYS=<seconds>:<key>,... presses keys at those seconds whether the window has focus or not (README, Debugging). Space the presses out so they get past the start screen and profile, then give loading about 50 s.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7120825773 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7120825773). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T03:09:32Z. --- Thanks for running it against the title. A caveat on the counter: per #255 the rectangle drops are in world frames, and the menus and intro may issue no indirect rectangle draws at all. So `0 indirect` before the world is probably what `main` shows too. It doesn't confirm the new path yet. On the 9.4 fps dip: this path has no readback. Everything it adds runs on the GPU. The CPU side only zeroes a 4 KiB counter chunk at submission and copies the element table (a few bytes) into upload memory, once per indirect rectangle draw. With the GPU at 2.3 ms the time went elsewhere on the CPU, and the expand passes can only have run if indirect rectangle draws were issued, which brings us back to the point above. Running `main` with the same recipe would show whether the dip is there too. What would settle the PR is a world run, `main` against this head, same build profile and recipe, comparing: - the drop summary: whether `indirect kind 0: pipeline mismatch (compute false, mesh false, topology 17)` is gone, and the `dropped ... indirect` count per world frame; - ms/frame in the world; - whether the picture behind the opening cutscene's title card changes (`VICTORY_CAPTURE`). For scripted input, `VICTORY_KEYS=<seconds>:<key>,...` presses keys at those seconds whether the window has focus or not (README, Debugging). Space the presses out so they get past the start screen and profile, then give loading about 50 s. AI-assisted (Claude Code).
vladbondarenko97 commented 2026-11-24 06:55:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by vladbondarenko97 on 2026-11-24T03:30:55Z.


Quick control result so nobody attributes this to the change: on the same machine/package main (97c78d1) hits the same assert as the PR head, so this is not from the rect work.

  • PR head (bcc32cf, diag build): 0x80000003 at title+0x4dcbc9d, ~3.5 min in, twice in a row, each run after the menus/legal/key-art/intro at 30.0 fps.
  • main (97c78d1, same diag flags, same package): 0x80000003 at title+0x4dcbc9d as well, 1 min in.

The site is a buffer-capacity check:

mov ebx, [rcx+0x10]   ; capacity
mov eax, [rcx+0x18]   ; size
sub ebx, eax
cmp ebx, r8d          ; capacity - size vs requested
jb  +0x4dcbc9d        ; int3

So it is a request for more than a buffer's remaining capacity — streaming/upload sizing, not rect drawing. I don't have a world run to compare yet because this gate stops the title on our box before the world loads (both builds). If that assert is on your side too, the main-vs-head comparison you asked for needs it out of the way first; if it is not, tell me what differs in your environment and I will re-run.

For completeness, the machine: RTX 3080 Ti 12 GB, driver 610.60, Windows 11 Pro 26300, i7-12700KF, complete 1.0.2.1 package (111/111 SHA-256 verified).

AI-assisted (Claude Code CLI via a model proxy; logs and offsets only, no game data).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7121170075 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7121170075). Originally posted by [vladbondarenko97](https://github.com/vladbondarenko97) on 2026-11-24T03:30:55Z. --- Quick control result so nobody attributes this to the change: on the same machine/package **main (`97c78d1`) hits the same assert as the PR head**, so this is not from the rect work. - **PR head (`bcc32cf`, diag build):** `0x80000003` at `title+0x4dcbc9d`, ~3.5 min in, twice in a row, each run after the menus/legal/key-art/intro at 30.0 fps. - **main (`97c78d1`, same diag flags, same package):** `0x80000003` at `title+0x4dcbc9d` as well, 1 min in. The site is a buffer-capacity check: ``` mov ebx, [rcx+0x10] ; capacity mov eax, [rcx+0x18] ; size sub ebx, eax cmp ebx, r8d ; capacity - size vs requested jb +0x4dcbc9d ; int3 ``` So it is a request for more than a buffer's remaining capacity — streaming/upload sizing, not rect drawing. I don't have a world run to compare yet because this gate stops the title on our box before the world loads (both builds). If that assert is on your side too, the main-vs-head comparison you asked for needs it out of the way first; if it is not, tell me what differs in your environment and I will re-run. For completeness, the machine: RTX 3080 Ti 12 GB, driver 610.60, Windows 11 Pro 26300, i7-12700KF, complete 1.0.2.1 package (111/111 SHA-256 verified). AI-assisted (Claude Code CLI via a model proxy; logs and offsets only, no game data).
BastienRodz commented 2026-11-24 06:55:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T03:31:46Z.


Thanks for the control run. That settles it: the assert at +0x4dcbc9d happens without this PR too.

Two things for the next comparison:

  • Base: 97c78d1 is older than this PR's base. Please compare main at d2a4bae against the head cee702e, which also has the scratch-layout fix.
  • The assert: I don't run the title here, so I can't say whether it shows up elsewhere. The README's world runs are on an RX 6700 XT, and several NVIDIA reports (#71, #314, #325) stop or hang before or at world entry. Since it blocks world testing on your machine independently of any PR, it's worth its own issue: the crashes.log entry, the stack, and what the title was doing at the time. Then people with other GPUs can say whether they hit it.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7121182956 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7121182956). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T03:31:46Z. --- Thanks for the control run. That settles it: the assert at `+0x4dcbc9d` happens without this PR too. Two things for the next comparison: - **Base:** `97c78d1` is older than this PR's base. Please compare `main` at `d2a4bae` against the head `cee702e`, which also has the scratch-layout fix. - **The assert:** I don't run the title here, so I can't say whether it shows up elsewhere. The README's world runs are on an RX 6700 XT, and several NVIDIA reports (#71, #314, #325) stop or hang before or at world entry. Since it blocks world testing on your machine independently of any PR, it's worth its own issue: the `crashes.log` entry, the stack, and what the title was doing at the time. Then people with other GPUs can say whether they hit it. AI-assisted (Claude Code).
justlovett0 commented 2026-11-24 06:55:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by justlovett0 on 2026-11-24T03:35:40Z.


Game confirmation on the original #348 machine (as requested on #282): the rectangle draws run and the loading screen renders – but world entry still hangs the GPU, for a separate reason (wave64 compute refusals, #71).

Setup: Windows 10 21H2 19044.7846, RTX 3080 10 GB (driver 32.0.15.9649), Ryzen 9 7900X, 32 GB RAM. This PR's head cee702e merged locally with #175 (Agility SDK 1.620.2 – required on this Win10 box; without it the title crashes at init, #348/#84). Release build, same dump (v1.0.2.1, b99f876b74d4a77f), no input; the title auto-plays to the opening cutscene.

#175 only #175 + this PR
loading screen picture black renders (confirmed by hand)
draws run by frame 2048 16,383 (menus only) 11,351 of 11,351, dispatches 2,144 of 2,144 (menus + loading + world entry)
host root signature refused 0 0
outcome menus fine DXGI_ERROR_DEVICE_HUNG after a submission of 32 lists at the first world frames (~75 s in); "VICE CITY, TWO YEARS AGO" card shows, ~1 fps, then the device is removed

The hang is not this PR's: 100 compute pipelines are refused on this NVIDIA card (WaveSize(64) on a 32-lane host, the #71 hypothesis); their culling/indirect output is never produced. With #233 stacked on top, refusals drop to 1 – see the comment there.

One integration note for when this and #334 both land: they conflict in indirect.rs. I resolved it by giving clamp_uav the buffer parameter so it can ask buffer_state(buffer, BUFFER_WRITE) (#334's tracking), keeping the UAV barrier after the clamp for the rectangle passes, and making bound ask BUFFER_READ instead of the fixed UAV -> INDIRECT_ARGUMENT transition. The rectangle path's own before_draw/after_draw barriers on the list-owned scratch are untouched.

Logs kept locally (pr346-run.log, 4,854 lines) – happy to provide excerpts.

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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7121242441 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7121242441). Originally posted by [justlovett0](https://github.com/justlovett0) on 2026-11-24T03:35:40Z. --- Game confirmation on the original #348 machine (as requested on #282): **the rectangle draws run and the loading screen renders** – but world entry still hangs the GPU, for a separate reason (wave64 compute refusals, #71). **Setup:** Windows 10 21H2 19044.7846, RTX 3080 10 GB (driver 32.0.15.9649), Ryzen 9 7900X, 32 GB RAM. This PR's head `cee702e` merged locally with #175 (Agility SDK 1.620.2 – required on this Win10 box; without it the title crashes at init, #348/#84). Release build, same dump (v1.0.2.1, `b99f876b74d4a77f`), no input; the title auto-plays to the opening cutscene. | | #175 only | #175 + this PR | |---|---|---| | loading screen picture | black | **renders** (confirmed by hand) | | draws run by frame 2048 | 16,383 (menus only) | 11,351 of 11,351, dispatches 2,144 of 2,144 (menus + loading + world entry) | | `host root signature refused` | 0 | 0 | | outcome | menus fine | `DXGI_ERROR_DEVICE_HUNG` after a submission of 32 lists at the first world frames (~75 s in); "VICE CITY, TWO YEARS AGO" card shows, ~1 fps, then the device is removed | The hang is not this PR's: 100 compute pipelines are refused on this NVIDIA card (`WaveSize(64)` on a 32-lane host, the #71 hypothesis); their culling/indirect output is never produced. With #233 stacked on top, refusals drop to 1 – see the comment there. One integration note for when this and #334 both land: they conflict in `indirect.rs`. I resolved it by giving `clamp_uav` the buffer parameter so it can ask `buffer_state(buffer, BUFFER_WRITE)` (#334's tracking), keeping the UAV barrier after the clamp for the rectangle passes, and making `bound` ask `BUFFER_READ` instead of the fixed `UAV -> INDIRECT_ARGUMENT` transition. The rectangle path's own `before_draw`/`after_draw` barriers on the list-owned scratch are untouched. Logs kept locally (`pr346-run.log`, 4,854 lines) – happy to provide excerpts. AI use: Qwen Code (underlying model name not disclosed by the tool) built the merged stack, ran the title, extracted the counts and drafted this comment at the user's request; the user confirmed the visible loading screen.
BastienRodz commented 2026-11-24 06:55:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T03:37:46Z.


Thank you, that's the confirmation this PR needed: the loading screen renders, and every draw and dispatch up to world entry runs. I've added it to the description. Agreed that the hang after the title card is the wave64 refusals (#71), not this change.

On #334: thanks for working out the merge. Whichever of the two lands second should take your resolution:

  • clamp_uav takes the buffer and asks buffer_state(buffer, BUFFER_WRITE), keeping the UAV barrier after the clamp for the rectangle passes;
  • bound asks BUFFER_READ instead of the fixed transition;
  • the rectangle path's barriers on its list-owned scratch stay as they are.

If #334 merges first, I'll rebase this on it that way.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7121274527 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7121274527). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T03:37:46Z. --- Thank you, that's the confirmation this PR needed: the loading screen renders, and every draw and dispatch up to world entry runs. I've added it to the description. Agreed that the hang after the title card is the wave64 refusals (#71), not this change. On #334: thanks for working out the merge. Whichever of the two lands second should take your resolution: - `clamp_uav` takes the buffer and asks `buffer_state(buffer, BUFFER_WRITE)`, keeping the UAV barrier after the clamp for the rectangle passes; - `bound` asks `BUFFER_READ` instead of the fixed transition; - the rectangle path's barriers on its list-owned scratch stay as they are. If #334 merges first, I'll rebase this on it that way. AI-assisted (Claude Code).
marquezinii commented 2026-11-24 06:55:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by marquezinii on 2026-11-24T04:22:30Z.


Reviewed cee702e and ran it on an NVIDIA RTX 5070 (driver 621.24), Windows 11: cargo test -p victory-gpu 50 passed, 0 failed, 1 ignored; all rectangle tests pass. I found no defect in the corner math, bounds, allocator or barriers. One ordering problem and a few questions:

Rebasing onto #242. The rewrite and expand passes read the title's own argument records after clamp_uav (the rewrite pass, and the expand shader again for StartVertexLocation), so they rely on today's clamp writing the clamped values back in place. #242 changes the clamp to read the source in place and write clamped records into a separate scratch buffer (bound returns Bounded { scratch }, no in-place variant). Since #242 is meant to land first, after the rebase both passes need to read #242's scratch records; reading the title's copy would bring back unclamped counts (rects * 6u can wrap, and a pipeline with no per-vertex inputs is then unbounded in count and instances).

Half floats. f32_to_half in the expand shader combines the rounded mantissa with | (sgn | (ex << 10) | ((man + 0x1000) >> 13)), the same pattern #260 fixes in primitive.rs (a rounding carry is lost when the exponent is odd, e.g. 1.99995 gives 1.0). CPU and GPU agree today, so not a regression, but the shader will need the same change when #260 lands or the two paths diverge.

Questions:

  • The rectangle path moves the title's count buffer between UNORDERED_ACCESS and INDIRECT_ARGUMENT, while the non-rectangle path in draw.rs does not transition it. If one list uses a separate count buffer on both paths, one of them sees it in the wrong state. Worth a check with the debug layer once a count-buffer title draw shows up.
  • The title's vertex-buffer copies are bound writable in the expand pass although they are only read. If an earlier draw in the same list read one as a vertex buffer, it was promoted to a read state, and a read state cannot be promoted to unordered access. A ByteAddressBuffer view would avoid that.
  • StartVertexLocation comes from an atomic allocation, so its order can change between runs; a vertex shader reading SV_VertexID alongside inputs would see different IDs than on the direct path. The shortcut: notes cover only the no-input case.
  • The 8 MiB per-list vertex scratch is never released.

The GPU test drives both shaders with hand-written constants and does not go through expand(), so the barrier sequence, slot layout, counter reset and argument-buffer growth have no test. I tried a temporary case through the shaders with an 11-byte stride, data starting 3 bytes in, unaligned f32/half/unorm16 attributes and two records: the GPU output matched expand_rects byte for byte.

Not covered: the title (no game data here).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7121959412 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7121959412). Originally posted by [marquezinii](https://github.com/marquezinii) on 2026-11-24T04:22:30Z. --- Reviewed `cee702e` and ran it on an NVIDIA RTX 5070 (driver 621.24), Windows 11: `cargo test -p victory-gpu` 50 passed, 0 failed, 1 ignored; all rectangle tests pass. I found no defect in the corner math, bounds, allocator or barriers. One ordering problem and a few questions: **Rebasing onto #242.** The rewrite and expand passes read the title's own argument records after `clamp_uav` (the rewrite pass, and the expand shader again for `StartVertexLocation`), so they rely on today's clamp writing the clamped values back in place. #242 changes the clamp to read the source in place and write clamped records into a separate scratch buffer (`bound` returns `Bounded { scratch }`, no in-place variant). Since #242 is meant to land first, after the rebase both passes need to read #242's scratch records; reading the title's copy would bring back unclamped counts (`rects * 6u` can wrap, and a pipeline with no per-vertex inputs is then unbounded in count and instances). **Half floats.** `f32_to_half` in the expand shader combines the rounded mantissa with `|` (`sgn | (ex << 10) | ((man + 0x1000) >> 13)`), the same pattern #260 fixes in `primitive.rs` (a rounding carry is lost when the exponent is odd, e.g. 1.99995 gives 1.0). CPU and GPU agree today, so not a regression, but the shader will need the same change when #260 lands or the two paths diverge. Questions: - The rectangle path moves the title's count buffer between `UNORDERED_ACCESS` and `INDIRECT_ARGUMENT`, while the non-rectangle path in `draw.rs` does not transition it. If one list uses a separate count buffer on both paths, one of them sees it in the wrong state. Worth a check with the debug layer once a count-buffer title draw shows up. - The title's vertex-buffer copies are bound writable in the expand pass although they are only read. If an earlier draw in the same list read one as a vertex buffer, it was promoted to a read state, and a read state cannot be promoted to unordered access. A `ByteAddressBuffer` view would avoid that. - `StartVertexLocation` comes from an atomic allocation, so its order can change between runs; a vertex shader reading `SV_VertexID` alongside inputs would see different IDs than on the direct path. The `shortcut:` notes cover only the no-input case. - The 8 MiB per-list vertex scratch is never released. The GPU test drives both shaders with hand-written constants and does not go through `expand()`, so the barrier sequence, slot layout, counter reset and argument-buffer growth have no test. I tried a temporary case through the shaders with an 11-byte stride, data starting 3 bytes in, unaligned f32/half/unorm16 attributes and two records: the GPU output matched `expand_rects` byte for byte. Not covered: the title (no game data here).
BastienRodz commented 2026-11-24 06:55:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T04:25:21Z.


Thanks for the careful review and the unaligned-stride run. Changes in 0aebe86:

  • #242 ordering: the rewrite pass now bounds each record itself, with the clamp's limits (2^24 vertices, 2^26 vertex instances), before computing rects * 6. A clamp that writes elsewhere can no longer bring back unbounded counts, including for pipelines without per-vertex inputs. What it doesn't reproduce is the clamp's per-list budget, which zeroes records past it. When rebasing onto #242, the rewrite and expand passes should read #242's scratch records, as you say. I'll do that if #242 lands first.
  • Half floats: fixed in the shader now. The mantissa carry is added instead of or-ed, so a carry raises the exponent; the comment points at #260. Until #260 lands, the CPU and GPU paths differ only on values where that carry occurs, where the CPU path is the wrong one. gpu_expansion_matches_cpu_expand_rects's inputs don't hit it, and the test still passes.
  • Vertex ids: the shortcut: note now says that with vertex inputs, the vertex id is the expanded one, from an allocated start whose order between records may change between runs. Making it deterministic needs a prefix sum over the records instead of the atomic. For records that read the vertex id, both paths already differ from the console's ids, so I left that for when a title shader turns out to depend on it.

On the questions:

  • Count buffer state: both paths leave the title's count buffer in UNORDERED_ACCESS. The rectangle path moves it to INDIRECT_ARGUMENT only around its own ExecuteIndirect and back, so a list that mixes the paths sees it in the same state between draws. The non-rectangle path reading a separate count buffer while it is still in UNORDERED_ACCESS is older than this PR. #334's state tracking is the place to fix that.
  • Vertex buffer copies bound as UAVs: in the current model the host copies sit in UNORDERED_ACCESS (the IA reads them that way too, which is #199/#264). An SRV view would be the mismatch here, since it needs NON_PIXEL_SHADER_RESOURCE. Once #334 tracks buffer states, these reads should ask its tracker; at that point a ByteAddressBuffer view with BUFFER_READ is the better choice. I'll switch when rebasing onto it.
  • The 8 MiB scratch: it lives as long as its HostList and is reused across resets. It goes away when the list object is released, not before. Fair point if a title keeps many lists around: a pool shared between lists would cap it. Noted for later.
  • No test through expand(): true. fuzeofficlal's fixture covered the barrier sequence and a real ExecuteIndirect draw on two GPUs, but nothing in the repository does. A test through expand() needs a title shadow and a host pipeline set up by hand. I'll look at adding one.

Re-run on 0aebe86 (Wine + vkd3d-proton 3.1 on lavapipe): cargo xwin test -p victory-gpu gives 48 passed and 2 failed, the same two environment failures as main. The byte-for-byte GPU test passes. Clippy: unchanged. Policy: 152 files ok.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7122003787 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7122003787). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T04:25:21Z. --- Thanks for the careful review and the unaligned-stride run. Changes in `0aebe86`: - **#242 ordering:** the rewrite pass now bounds each record itself, with the clamp's limits (2^24 vertices, 2^26 vertex instances), before computing `rects * 6`. A clamp that writes elsewhere can no longer bring back unbounded counts, including for pipelines without per-vertex inputs. What it doesn't reproduce is the clamp's per-list budget, which zeroes records past it. When rebasing onto #242, the rewrite and expand passes should read #242's scratch records, as you say. I'll do that if #242 lands first. - **Half floats:** fixed in the shader now. The mantissa carry is added instead of or-ed, so a carry raises the exponent; the comment points at #260. Until #260 lands, the CPU and GPU paths differ only on values where that carry occurs, where the CPU path is the wrong one. `gpu_expansion_matches_cpu_expand_rects`'s inputs don't hit it, and the test still passes. - **Vertex ids:** the `shortcut:` note now says that with vertex inputs, the vertex id is the expanded one, from an allocated start whose order between records may change between runs. Making it deterministic needs a prefix sum over the records instead of the atomic. For records that read the vertex id, both paths already differ from the console's ids, so I left that for when a title shader turns out to depend on it. On the questions: - **Count buffer state:** both paths leave the title's count buffer in `UNORDERED_ACCESS`. The rectangle path moves it to `INDIRECT_ARGUMENT` only around its own `ExecuteIndirect` and back, so a list that mixes the paths sees it in the same state between draws. The non-rectangle path reading a separate count buffer while it is still in `UNORDERED_ACCESS` is older than this PR. #334's state tracking is the place to fix that. - **Vertex buffer copies bound as UAVs:** in the current model the host copies sit in `UNORDERED_ACCESS` (the IA reads them that way too, which is #199/#264). An SRV view would be the mismatch here, since it needs `NON_PIXEL_SHADER_RESOURCE`. Once #334 tracks buffer states, these reads should ask its tracker; at that point a `ByteAddressBuffer` view with `BUFFER_READ` is the better choice. I'll switch when rebasing onto it. - **The 8 MiB scratch:** it lives as long as its `HostList` and is reused across resets. It goes away when the list object is released, not before. Fair point if a title keeps many lists around: a pool shared between lists would cap it. Noted for later. - **No test through `expand()`:** true. fuzeofficlal's fixture covered the barrier sequence and a real `ExecuteIndirect` draw on two GPUs, but nothing in the repository does. A test through `expand()` needs a title shadow and a host pipeline set up by hand. I'll look at adding one. Re-run on `0aebe86` (Wine + vkd3d-proton 3.1 on lavapipe): `cargo xwin test -p victory-gpu` gives 48 passed and 2 failed, the same two environment failures as `main`. The byte-for-byte GPU test passes. Clippy: unchanged. Policy: 152 files ok. AI-assisted (Claude Code).
fuzeofficlal commented 2026-11-24 06:55:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T04:27:52Z.


I ran a synthetic check through expand() via State::execute_indirect on 0aebe86 on Windows 11 (build 26200), using an RTX 5090 and WARP. A one-thread compute dispatch writes the count at byte offset 16 of a separate buffer on the same command list. The CPU starts with the opposite value, and the indirect record starts at vertex 1.

GPU-written count Result on both adapters
0 All 64 pixels stayed at the clear color
1 The expected 4×4 region drew, and all other pixels stayed clear

State::execute_indirect accepted both calls. Count copyback matched the GPU value with the adjacent words intact. The D3D12 debug callback reported zero errors during recording and submission on both adapters. With the same fixture on d2a4bae, the method rejected both rectangle calls before submission.

This covers the rectangle path from State::execute_indirect through native draw and readback with a test PSO and synthetic inputs. The mixed rectangle/non-rectangle count-buffer case discussed above is outside this run.

I also verified the direct rectangle path's normal FP16 midpoint rounding with a separate synthetic input. At dd54de2, the direct expansion packed an even midpoint as 0x3c01 instead of 0x3c00, and the native draw matched 10/16 reference pixels on both RTX 5090 and WARP. Direct-path commit c256b97 applies the retained-bit tie-to-even bias. The same draws match 16/16 on both adapters, with the adjacent odd midpoint still packing to 0x3c02.

The indirect HLSL helper at 1278485 uses the analogous fixed bias for normal values. Applying the same retained-bit rule there would align the direct and indirect paths. This comparison of the HLSL helper is from source inspection.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7122043116 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7122043116). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-24T04:27:52Z. --- I ran a synthetic check through `expand()` via `State::execute_indirect` on `0aebe86` on Windows 11 (build 26200), using an RTX 5090 and WARP. A one-thread compute dispatch writes the count at byte offset 16 of a separate buffer on the same command list. The CPU starts with the opposite value, and the indirect record starts at vertex 1. | GPU-written count | Result on both adapters | | --- | --- | | 0 | All 64 pixels stayed at the clear color | | 1 | The expected 4×4 region drew, and all other pixels stayed clear | `State::execute_indirect` accepted both calls. Count copyback matched the GPU value with the adjacent words intact. The D3D12 debug callback reported zero errors during recording and submission on both adapters. With the same fixture on `d2a4bae`, the method rejected both rectangle calls before submission. This covers the rectangle path from `State::execute_indirect` through native draw and readback with a test PSO and synthetic inputs. The mixed rectangle/non-rectangle count-buffer case discussed above is outside this run. I also verified the direct rectangle path's normal FP16 midpoint rounding with a separate synthetic input. At `dd54de2`, the direct expansion packed an even midpoint as `0x3c01` instead of `0x3c00`, and the native draw matched 10/16 reference pixels on both RTX 5090 and WARP. [Direct-path commit `c256b97`](https://github.com/fuzeofficlal/VIctory/commit/c256b97705c55b15a1af541e1efbc3ff9de1196b) applies the retained-bit tie-to-even bias. The same draws match 16/16 on both adapters, with the adjacent odd midpoint still packing to `0x3c02`. The [indirect HLSL helper at `1278485`](https://github.com/BastienRodz/VIctory/blob/12784850d084d41f656006e783faf47f5148ebcb/crates/victory-gpu/src/rectangles.rs#L389-L409) uses the analogous fixed bias for normal values. Applying the same retained-bit rule there would align the direct and indirect paths. This comparison of the HLSL helper is from source inspection.
marquezinii commented 2026-11-24 06:55:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by marquezinii on 2026-11-24T05:00:12Z.


Thanks, 0aebe86 covers it. Re-ran on the RTX 5070 (621.24): cargo test -p victory-gpu 49 passed, 1 ignored, all rectangle tests included (the one other failure, frame::tests::waits_end_on_ticks_and_count_frames, is a timing test that fails under load and passes 3 of 3 alone; this PR does not touch frame.rs). The record bound keeps rects * 6 at most 2^25, and the half rounding now matches #260's. The answers on the count-buffer state and the UAV-bound copies make sense to me as #334 follow-ups.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7122532432 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7122532432). Originally posted by [marquezinii](https://github.com/marquezinii) on 2026-11-24T05:00:12Z. --- Thanks, `0aebe86` covers it. Re-ran on the RTX 5070 (621.24): `cargo test -p victory-gpu` 49 passed, 1 ignored, all rectangle tests included (the one other failure, `frame::tests::waits_end_on_ticks_and_count_frames`, is a timing test that fails under load and passes 3 of 3 alone; this PR does not touch `frame.rs`). The record bound keeps `rects * 6` at most 2^25, and the half rounding now matches #260's. The answers on the count-buffer state and the UAV-bound copies make sense to me as #334 follow-ups.
claude-GTA6 commented 2026-11-24 06:56:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by claude-GTA6 on 2026-11-24T06:01:41Z.


From a tester working with Claude (AI-assisted); measured on my own machine.

Result on NVIDIA (RTX 5090, 621.24), stacked with #458, #233, #439 and the indirect-argument copy from my comment on #458:

  • Dropped indirect draws fell from about 1,500 to about 330-890 per frame.
  • With VICTORY_D3D12_DEBUG=1 there were no indirect-related API errors, and the world ran about 3 minutes.

Two things were needed with #458's buffer-state tracker:

  1. Clamp: indirect::clamp_uav has to move the title args buffer through HostList::transition_buffer instead of raw barriers. The tracker may have moved that buffer to another state since.
  2. Count: the count buffer is a title buffer in the same pool. Before #458's per-draw prepare, copy the count into list-owned memory, and leave Prepared::before_draw / after_draw out of the count's state. Without the copy, the draw's own shaders move the pool to UAV, and ExecuteIndirect reads the count in the wrong state. That was a DXGI_ERROR_INVALID_CALL device removal about 20 s into the world.

Same branch base as my comment on #458; happy to push the rectangle-side diff if useful.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7123501849 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7123501849). Originally posted by [claude-GTA6](https://github.com/claude-GTA6) on 2026-11-24T06:01:41Z. --- *From a tester working with Claude (AI-assisted); measured on my own machine.* Result on NVIDIA (RTX 5090, 621.24), stacked with #458, #233, #439 and the indirect-argument copy from my comment on #458: - Dropped indirect draws fell from about 1,500 to about 330-890 per frame. - With `VICTORY_D3D12_DEBUG=1` there were no indirect-related API errors, and the world ran about 3 minutes. Two things were needed with #458's buffer-state tracker: 1. **Clamp:** `indirect::clamp_uav` has to move the title args buffer through `HostList::transition_buffer` instead of raw barriers. The tracker may have moved that buffer to another state since. 2. **Count:** the count buffer is a title buffer in the same pool. Before #458's per-draw `prepare`, copy the count into list-owned memory, and leave `Prepared::before_draw` / `after_draw` out of the count's state. Without the copy, the draw's own shaders move the pool to UAV, and `ExecuteIndirect` reads the count in the wrong state. That was a `DXGI_ERROR_INVALID_CALL` device removal about 20 s into the world. Same branch base as my comment on #458; happy to push the rectangle-side diff if useful.
BastienRodz commented 2026-11-24 06:56:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T06:03:55Z.


Thanks for stacking it and tracking both down.

Count buffer: changed here in 7ff1184, so it no longer depends on what lands first. The rewrite pass already writes records at or past the title's count as empty draws (all zeros), so ExecuteIndirect no longer takes a count buffer at all. It runs the max records from the list's own arguments buffer, and the records past the count draw nothing. Prepared::before_draw/after_draw transition only the list's scratch now. Together with the record bounds from 0aebe86, the rectangle path no longer changes the state of any title buffer: the count's host copy is read once by the rewrite pass, like the arguments. This should remove the DXGI_ERROR_INVALID_CALL you saw with #458, without the extra copy.

Clamp: that one belongs to whichever tracker lands (#458 or #334). clamp_uav should go through its transition call instead of raw barriers, as you and justlovett0 did. If one of them merges first, I'll rebase this on it that way.

Re-run on 7ff1184 (Wine + vkd3d-proton 3.1 on lavapipe): victory-gpu 48 passed and 2 failed, the same two environment failures as main. gpu_expansion_matches_cpu_expand_rects passes; it already checks that a record past the count becomes [0, 0, 0, 0]. Clippy unchanged; policy 152 files ok.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7123543453 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7123543453). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T06:03:55Z. --- Thanks for stacking it and tracking both down. **Count buffer:** changed here in `7ff1184`, so it no longer depends on what lands first. The rewrite pass already writes records at or past the title's count as empty draws (all zeros), so `ExecuteIndirect` no longer takes a count buffer at all. It runs the `max` records from the list's own arguments buffer, and the records past the count draw nothing. `Prepared::before_draw`/`after_draw` transition only the list's scratch now. Together with the record bounds from `0aebe86`, the rectangle path no longer changes the state of any title buffer: the count's host copy is read once by the rewrite pass, like the arguments. This should remove the `DXGI_ERROR_INVALID_CALL` you saw with #458, without the extra copy. **Clamp:** that one belongs to whichever tracker lands (#458 or #334). `clamp_uav` should go through its transition call instead of raw barriers, as you and justlovett0 did. If one of them merges first, I'll rebase this on it that way. Re-run on `7ff1184` (Wine + vkd3d-proton 3.1 on lavapipe): `victory-gpu` 48 passed and 2 failed, the same two environment failures as `main`. `gpu_expansion_matches_cpu_expand_rects` passes; it already checks that a record past the count becomes `[0, 0, 0, 0]`. Clippy unchanged; policy 152 files ok. AI-assisted (Claude Code).
vladbondarenko97 commented 2026-11-24 08:02:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by vladbondarenko97 on 2026-11-24T07:31:55Z.


A workaround for the title+0x4dcbc9d assert that otherwise blocks every PR test here

Following the control result above (main 97c78d1 and head 0aebe86 both died at +0x4dcbc9d), we RE'd the assert and can now get past it deterministically, which may help other testers reach the world.

The assert is a title-side packet stream, not a GPU command buffer. At +0x4dcbc9d, rcx is a 40-byte slot: desc*, dataBase*, capacity +0x10, cursor +0x18, watermark +0x1c, stream id +0x20. Runtime values at the failing enqueue (r8 = 0x6c0, a 1728-byte packet): capacity 0x18000 (98304), cursor = watermark = 0x17fb0 (98224), id 0xF0A244EF; the sibling half is at 0x114c0. So both halves filled and nothing drained while the descriptor showed ready = 1, arg = 0, seq = 0x50. The packets are (id, type, float) records (0.55, 0.2, 1000.0, 2000.0 …), i.e. parameter data, not resource streaming.

Workaround: skip only that breakpoint. Comparing rip & 0xFFF == 0xC9D is ASLR-proof; Rip += 1 lands on 0x4DCBC9E (jmp 0x4DCBC8A), which is the enqueue's "return false / packet dropped" path — no other state changes. With this in a diagnostics build, a session-1 run on an RTX 3080 Ti holds 30.0 fps, 46–55 draws/frame, GPU 1.9–7.5 ms, no WARN/ERROR lines, and walks the entire first-run flow (Brightness calibration, Subtitles, Legal Terms with the Confirm press) — all of which used to be unreachable because the title died at this assert within a minute.

Not a fix — the right fix is whatever should be draining that stream — but it lets the world-load and picture lanes be tested on main and on PR heads without the assert in the way. AI-assisted investigation (Claude Code); all values are from a register/memory dump of our own retail run.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7125093035 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7125093035). Originally posted by [vladbondarenko97](https://github.com/vladbondarenko97) on 2026-11-24T07:31:55Z. --- **A workaround for the `title+0x4dcbc9d` assert that otherwise blocks every PR test here** Following the control result above (main `97c78d1` and head `0aebe86` both died at `+0x4dcbc9d`), we RE'd the assert and can now get past it deterministically, which may help other testers reach the world. The assert is a **title-side packet stream**, not a GPU command buffer. At `+0x4dcbc9d`, `rcx` is a 40-byte slot: `desc*`, `dataBase*`, capacity `+0x10`, cursor `+0x18`, watermark `+0x1c`, stream id `+0x20`. Runtime values at the failing enqueue (`r8 = 0x6c0`, a 1728-byte packet): capacity `0x18000` (98304), **cursor = watermark = `0x17fb0`** (98224), id `0xF0A244EF`; the sibling half is at `0x114c0`. So both halves filled and nothing drained while the descriptor showed `ready = 1, arg = 0, seq = 0x50`. The packets are `(id, type, float)` records (0.55, 0.2, 1000.0, 2000.0 …), i.e. parameter data, not resource streaming. **Workaround**: skip only that breakpoint. Comparing `rip & 0xFFF == 0xC9D` is ASLR-proof; `Rip += 1` lands on `0x4DCBC9E` (`jmp 0x4DCBC8A`), which is the enqueue's "return false / packet dropped" path — no other state changes. With this in a diagnostics build, a session-1 run on an RTX 3080 Ti holds **30.0 fps, 46–55 draws/frame, GPU 1.9–7.5 ms, no WARN/ERROR lines**, and walks the entire first-run flow (Brightness calibration, Subtitles, Legal Terms with the Confirm press) — all of which used to be unreachable because the title died at this assert within a minute. Not a fix — the right fix is whatever should be draining that stream — but it lets the world-load and picture lanes be tested on `main` and on PR heads without the assert in the way. AI-assisted investigation (Claude Code); all values are from a register/memory dump of our own retail run.
BastienRodz commented 2026-11-24 09:06:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T08:25:21Z.


Rebased onto main cf0bb43 (clean) and updated for #418. #418 makes primitive::f32_to_half write half subnormals, rounded to even, instead of flushing them to zero. The expand shader's copy now does the same (1278485), so the CPU and GPU paths still agree byte for byte. gpu_expansion_matches_cpu_expand_rects gets a rectangle whose half fourth corner is 2^-16; with the old flush it fails.

On 1278485 (Wine + vkd3d-proton 3.1 on lavapipe): victory-gpu 54 passed and 2 failed, the same two environment failures as main. Plain Wine: 56 passed. Clippy is clean, with and without diagnostics. Policy: 153 files ok.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7126114935 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7126114935). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T08:25:21Z. --- Rebased onto `main` `cf0bb43` (clean) and updated for #418. #418 makes `primitive::f32_to_half` write half subnormals, rounded to even, instead of flushing them to zero. The expand shader's copy now does the same (`1278485`), so the CPU and GPU paths still agree byte for byte. `gpu_expansion_matches_cpu_expand_rects` gets a rectangle whose half fourth corner is 2^-16; with the old flush it fails. On `1278485` (Wine + vkd3d-proton 3.1 on lavapipe): `victory-gpu` 54 passed and 2 failed, the same two environment failures as `main`. Plain Wine: 56 passed. Clippy is clean, with and without `diagnostics`. Policy: 153 files ok. AI-assisted (Claude Code).
BastienRodz commented 2026-11-24 09:06:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T08:35:24Z.


Thanks, good catch, and thanks for measuring it on both adapters. Since PR creation is now limited to collaborators, I've carried your rule here so the two paths stay in step: 4090d29 applies it (your c256b97, credited as co-author) to primitive::f32_to_half and to the expand shader's copy. The retained bit decides halfway cases, so 1 + 2^-11 packs as 0x3c00 and 1 + 3 * 2^-11 as 0x3c02.

Tests:

  • primitive::tests::half_midpoints_round_to_even: both midpoints, and a value just past one.
  • gpu_expansion_matches_cpu_expand_rects: a rectangle whose half fourth corner is exactly 1 + 2^-11. With the old + 0x1000 rounding in the shader only, it fails.

On 4090d29 (Wine + vkd3d-proton 3.1 on lavapipe): victory-gpu 55 passed and 2 failed, the same two environment failures as main. Plain Wine: 57 passed. Clippy is clean, with and without diagnostics. Policy: 153 files ok.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7126318915 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7126318915). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T08:35:24Z. --- Thanks, good catch, and thanks for measuring it on both adapters. Since PR creation is now limited to collaborators, I've carried your rule here so the two paths stay in step: `4090d29` applies it (your `c256b97`, credited as co-author) to `primitive::f32_to_half` **and** to the expand shader's copy. The retained bit decides halfway cases, so `1 + 2^-11` packs as `0x3c00` and `1 + 3 * 2^-11` as `0x3c02`. Tests: - `primitive::tests::half_midpoints_round_to_even`: both midpoints, and a value just past one. - `gpu_expansion_matches_cpu_expand_rects`: a rectangle whose half fourth corner is exactly `1 + 2^-11`. With the old `+ 0x1000` rounding in the shader only, it fails. On `4090d29` (Wine + vkd3d-proton 3.1 on lavapipe): `victory-gpu` 55 passed and 2 failed, the same two environment failures as `main`. Plain Wine: 57 passed. Clippy is clean, with and without `diagnostics`. Policy: 153 files ok. AI-assisted (Claude Code).
SkillIssueXO commented 2026-11-24 09:06:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by SkillIssueXO on 2026-11-24T08:36:48Z.


Native Windows D3D12 validation of 4090d29 on an RTX 5070 Ti (driver 621.24, Windows 11 build 26300.9974, Rust 1.98.1 MSVC). I verified that the default D3D12 device selected the physical RTX 5070 Ti.

cargo +1.98.1 test --locked -p victory-gpu -- --test-threads=1 completed with 57 passed, 0 failed, 1 ignored, including half_midpoints_round_to_even and gpu_expansion_matches_cpu_expand_rects.

I also verified that the new midpoint fixture catches the old rounding on this GPU. With only the HLSL f32_to_half restored to its parent version, the byte-for-byte test failed with 0x01 at byte 128 where the CPU reference had 0x00. Restoring the PR shader made the focused test pass again.

Synthetic inputs only. AI-assisted (Codex).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7126347477 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7126347477). Originally posted by [SkillIssueXO](https://github.com/SkillIssueXO) on 2026-11-24T08:36:48Z. --- Native Windows D3D12 validation of `4090d29` on an RTX 5070 Ti (driver 621.24, Windows 11 build 26300.9974, Rust 1.98.1 MSVC). I verified that the default D3D12 device selected the physical RTX 5070 Ti. `cargo +1.98.1 test --locked -p victory-gpu -- --test-threads=1` completed with **57 passed, 0 failed, 1 ignored**, including `half_midpoints_round_to_even` and `gpu_expansion_matches_cpu_expand_rects`. I also verified that the new midpoint fixture catches the old rounding on this GPU. With only the HLSL `f32_to_half` restored to its parent version, the byte-for-byte test failed with `0x01` at byte 128 where the CPU reference had `0x00`. Restoring the PR shader made the focused test pass again. Synthetic inputs only. AI-assisted (Codex).
Exorion1er commented 2026-11-24 09:06:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Exorion1er on 2026-11-24T09:04:40Z.


Under stock Proton, the expander doesn't compile, so on Linux the rectangle-list draws stay dropped with this PR.

Setup: RX 9070 XT, Fedora 44, Mesa 26.2.7 RADV, GE-Proton11-12's Wine with Proton Experimental's vkd3d-proton 3.2.0, Wine's builtin d3dcompiler_47. main 58fed37 + #190 #454 #493 #579 #704 + this PR (#190 removes the Win32_Graphics_Direct3D_Fxc feature, so I put it back for the test). Diagnostics build, short runs into the first mission.

WARN victory_gpu::rectangles: rectangle expander: rect_rewrite:25:25: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'.
WARN victory_gpu::rectangles: no rectangle expander: indirect rectangles dropped error=Call failed. (0x80004005)
INFO victory_gpu::host: dropped 256.0/frame without a host pipeline: indirect kind 0: rectangle expander shader unavailable

It's the same compiler limitation as the clamp (#170): Wine's D3DCompile has no Load on RWByteAddressBuffer. Your Wine test used Microsoft's d3dcompiler_47.dll from winetricks, which is why it passed there. With Microsoft's DLL loaded (d3dcompiler_47=n,b), the expander builds here too, no E5005, and the topology-17 draws run.

Why it matters on this card: before this PR, in one traced world frame (#591), about 190 rectangle-list ExecuteIndirect draws each were dropped into three 2560×1440 targets (formats 10, 42 and 44), and only 38 rectangle-list draws ran in the whole frame.

So for Wine/Proton users the expander needs either #190's approach (DXIL from the shader crate's writer, no compiler at run time) or a DXC fallback like #178. I haven't measured the picture with the expander running yet: with this PR, #591's trace no longer lists the expanded draws per target, so I can't compare targets one to one.

Counts and log lines only. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7126927791 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7126927791). Originally posted by [Exorion1er](https://github.com/Exorion1er) on 2026-11-24T09:04:40Z. --- Under stock Proton, the expander doesn't compile, so on Linux the rectangle-list draws stay dropped with this PR. Setup: RX 9070 XT, Fedora 44, Mesa 26.2.7 RADV, GE-Proton11-12's Wine with Proton Experimental's vkd3d-proton 3.2.0, Wine's builtin `d3dcompiler_47`. `main` `58fed37` + #190 #454 #493 #579 #704 + this PR (`#190` removes the `Win32_Graphics_Direct3D_Fxc` feature, so I put it back for the test). Diagnostics build, short runs into the first mission. ``` WARN victory_gpu::rectangles: rectangle expander: rect_rewrite:25:25: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'. WARN victory_gpu::rectangles: no rectangle expander: indirect rectangles dropped error=Call failed. (0x80004005) INFO victory_gpu::host: dropped 256.0/frame without a host pipeline: indirect kind 0: rectangle expander shader unavailable ``` It's the same compiler limitation as the clamp (#170): Wine's `D3DCompile` has no `Load` on `RWByteAddressBuffer`. Your Wine test used Microsoft's `d3dcompiler_47.dll` from winetricks, which is why it passed there. With Microsoft's DLL loaded (`d3dcompiler_47=n,b`), the expander builds here too, no E5005, and the topology-17 draws run. Why it matters on this card: before this PR, in one traced world frame (#591), about 190 rectangle-list `ExecuteIndirect` draws each were dropped into three 2560×1440 targets (formats 10, 42 and 44), and only 38 rectangle-list draws ran in the whole frame. So for Wine/Proton users the expander needs either #190's approach (DXIL from the shader crate's writer, no compiler at run time) or a DXC fallback like #178. I haven't measured the picture with the expander running yet: with this PR, #591's trace no longer lists the expanded draws per target, so I can't compare targets one to one. Counts and log lines only. AI-assisted (Claude Code).
BastienRodz commented 2026-11-24 10:03:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T09:15:31Z.


Thanks, you're right: my Wine runs used Microsoft's d3dcompiler_47, so they never saw this. Fixed in c256f83, keeping the run-time compile.

There were two things, not one. Wine's D3DCompile (vkd3d-shader) has no Load on RWByteAddressBuffer, and it also ignores the [RootSignature] attribute. So once the HLSL compiled, CreateRootSignature from the blob would have failed next.

  • The two passes now read and write buffers as 32-bit words through RWStructuredBuffer<uint> / StructuredBuffer<uint>. Bindings and arithmetic are unchanged.
  • Their root signatures (eight root constants, then the root descriptors) are serialized in code with D3D12SerializeRootSignature instead of coming from the shader.

Checked against your compiler: I built vkd3d-compiler from the vkd3d-2.1 tag, which is the vkd3d-shader GE-Proton11-12 ships (libvkd3d-shader-1.dll reports 2.1).

  • The PR's previous shaders fail with exactly your rect_rewrite:25:25: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'.
  • The new ones compile, apart from a warning that the root signature attribute is ignored (the attribute is gone now anyway).
  • I then loaded vkd3d 2.1's bytecode in place of D3DCompile's (a local-only hook, not committed). On vkd3d-proton 3.1, all 7 rectangle tests pass, including gpu_expansion_matches_cpu_expand_rects byte for byte.

With Microsoft's compiler (Wine + vkd3d-proton on lavapipe): victory-gpu 55 passed and 2 failed, the same two environment failures as main. Plain Wine: 57 passed. Clippy is clean, with and without diagnostics. Policy: 153 files ok.

What I couldn't run is your exact stack: d3dcompiler_47 from GE-Proton11-12's Wine, which reaches vkd3d-shader through Wine 11's wined3d and does not load on my Wine 10. If you can rerun stock (d3dcompiler_47 builtin) with #190 stacked for the clamp, the drop reason rectangle expander shader unavailable should be gone. If it isn't, the WARN line will name the next error.

On the per-target comparison: with this PR the expanded draws run as one ExecuteIndirect each, like the other indirect draws, so #591's trace would need to count them under their pipeline.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7127167125 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7127167125). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T09:15:31Z. --- Thanks, you're right: my Wine runs used Microsoft's `d3dcompiler_47`, so they never saw this. Fixed in `c256f83`, keeping the run-time compile. There were two things, not one. Wine's `D3DCompile` (vkd3d-shader) has no `Load` on `RWByteAddressBuffer`, and it also **ignores the `[RootSignature]` attribute**. So once the HLSL compiled, `CreateRootSignature` from the blob would have failed next. - The two passes now read and write buffers as 32-bit words through `RWStructuredBuffer<uint>` / `StructuredBuffer<uint>`. Bindings and arithmetic are unchanged. - Their root signatures (eight root constants, then the root descriptors) are serialized in code with `D3D12SerializeRootSignature` instead of coming from the shader. Checked against your compiler: I built `vkd3d-compiler` from the `vkd3d-2.1` tag, which is the vkd3d-shader GE-Proton11-12 ships (`libvkd3d-shader-1.dll` reports 2.1). - The PR's previous shaders fail with exactly your `rect_rewrite:25:25: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'`. - The new ones compile, apart from a warning that the root signature attribute is ignored (the attribute is gone now anyway). - I then loaded vkd3d 2.1's bytecode in place of `D3DCompile`'s (a local-only hook, not committed). On vkd3d-proton 3.1, all 7 rectangle tests pass, including `gpu_expansion_matches_cpu_expand_rects` byte for byte. With Microsoft's compiler (Wine + vkd3d-proton on lavapipe): `victory-gpu` 55 passed and 2 failed, the same two environment failures as `main`. Plain Wine: 57 passed. Clippy is clean, with and without `diagnostics`. Policy: 153 files ok. What I couldn't run is your exact stack: `d3dcompiler_47` from GE-Proton11-12's Wine, which reaches vkd3d-shader through Wine 11's `wined3d` and does not load on my Wine 10. If you can rerun stock (`d3dcompiler_47` builtin) with #190 stacked for the clamp, the drop reason `rectangle expander shader unavailable` should be gone. If it isn't, the WARN line will name the next error. On the per-target comparison: with this PR the expanded draws run as one `ExecuteIndirect` each, like the other indirect draws, so #591's trace would need to count them under their pipeline. AI-assisted (Claude Code).
Exorion1er commented 2026-11-24 10:03:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Exorion1er on 2026-11-24T09:17:16Z.


Follow-up to my comment above: I ported both expansion passes to the shader crate's writer, so under stock Wine/Proton the expander builds with no D3DCompile. It's on a branch of my fork, since new PRs are limited to collaborators:

https://github.com/Exorion1er/VIctory/commits/gpu/rect-expander-own-writer

  • It's stacked on #190 (it uses #190's root_uav_handle and its pub(crate) root_signature). The first commit merges #190 into this PR's head 4090d29, with one resolution in indirect.rs: your clamp_uav/bound split with #190's ARGUMENTS/BUDGET/GROUP. The second commit is the port: emit/rectangles.rs (new), the GPU side's make() building both root signatures from a description, and Fxc dropped.
  • The passes follow your HLSL line for line, root parameter indices unchanged. Bytes past the vertex are only read when the HLSL read them (root views have no bounds check), variable shifts are masked to 5 bits as HLSL's are, half subnormals round to even (including your 4090d29 rule), and the unorm stores saturate.
  • Under Wine (GE-Proton11-12, vkd3d-proton 3.2.0, RX 9070 XT RADV), your rectangles tests pass 7/7, including gpu_expansion_matches_cpu_expand_rects. With the fourth corner deliberately broken, that test fails on exactly those bytes, so it really compares.
  • In the title, with Wine's builtin compiler: no E5005, no "rectangle expander shader unavailable" drops (256/frame before), rectangle-list draws run, no GPU faults. The picture is still black here, same as with Microsoft's compiler, so that's a separate problem.
  • Not tested on Windows.

Use any of it as you see fit, credited or not.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7127206080 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7127206080). Originally posted by [Exorion1er](https://github.com/Exorion1er) on 2026-11-24T09:17:16Z. --- Follow-up to my comment above: I ported both expansion passes to the shader crate's writer, so under stock Wine/Proton the expander builds with no `D3DCompile`. It's on a branch of my fork, since new PRs are limited to collaborators: https://github.com/Exorion1er/VIctory/commits/gpu/rect-expander-own-writer - It's stacked on #190 (it uses #190's `root_uav_handle` and its `pub(crate)` `root_signature`). The first commit merges #190 into this PR's head `4090d29`, with one resolution in `indirect.rs`: your `clamp_uav`/`bound` split with #190's `ARGUMENTS`/`BUDGET`/`GROUP`. The second commit is the port: `emit/rectangles.rs` (new), the GPU side's `make()` building both root signatures from a description, and `Fxc` dropped. - The passes follow your HLSL line for line, root parameter indices unchanged. Bytes past the vertex are only read when the HLSL read them (root views have no bounds check), variable shifts are masked to 5 bits as HLSL's are, half subnormals round to even (including your `4090d29` rule), and the unorm stores saturate. - Under Wine (GE-Proton11-12, vkd3d-proton 3.2.0, RX 9070 XT RADV), your `rectangles` tests pass 7/7, including `gpu_expansion_matches_cpu_expand_rects`. With the fourth corner deliberately broken, that test fails on exactly those bytes, so it really compares. - In the title, with Wine's builtin compiler: no E5005, no "rectangle expander shader unavailable" drops (256/frame before), rectangle-list draws run, no GPU faults. The picture is still black here, same as with Microsoft's compiler, so that's a separate problem. - Not tested on Windows. Use any of it as you see fit, credited or not. AI-assisted (Claude Code).
BastienRodz commented 2026-11-24 10:03:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T09:18:55Z.


Thank you, that's a lot of careful work, and the in-title result is very useful: with the expander running under stock Proton the rectangle-list draws run without faults, and the black picture is a separate problem.

Our two fixes crossed (yours at 09:17, my c256f83 just after), so here is how they fit:

  • c256f83 keeps the run-time HLSL, rewritten so vkd3d-shader 2.1 compiles it (word-indexed structured buffers), with the root signatures serialized in code. It doesn't depend on #190, so this PR can land on its own and work under Proton with Wine's builtin compiler, as long as the clamp compiles there too (today that needs #190 or Microsoft's d3dcompiler_47).
  • Your port removes the run-time compiler altogether, which is what #190 does for the clamp. If #190 lands and the maintainer wants no D3DCompile at run time at all, your branch is the way to go: I'd rebase this PR onto it, credited, or it can follow as its own change.

If you have a moment, a run of c256f83 stacked on #190 with the builtin compiler would show whether the HLSL route holds on your stack too. If it does, either route works, and the choice can follow #190.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7127243615 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7127243615). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T09:18:55Z. --- Thank you, that's a lot of careful work, and the in-title result is very useful: with the expander running under stock Proton the rectangle-list draws run without faults, and the black picture is a separate problem. Our two fixes crossed (yours at 09:17, my `c256f83` just after), so here is how they fit: - `c256f83` keeps the run-time HLSL, rewritten so vkd3d-shader 2.1 compiles it (word-indexed structured buffers), with the root signatures serialized in code. It doesn't depend on #190, so this PR can land on its own and work under Proton with Wine's builtin compiler, as long as the clamp compiles there too (today that needs #190 or Microsoft's `d3dcompiler_47`). - Your port removes the run-time compiler altogether, which is what #190 does for the clamp. If #190 lands and the maintainer wants no `D3DCompile` at run time at all, your branch is the way to go: I'd rebase this PR onto it, credited, or it can follow as its own change. If you have a moment, a run of `c256f83` stacked on #190 with the builtin compiler would show whether the HLSL route holds on your stack too. If it does, either route works, and the choice can follow #190. AI-assisted (Claude Code).
Exorion1er commented 2026-11-24 10:03:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Exorion1er on 2026-11-24T09:23:51Z.


Our comments crossed: I posted the port a couple of minutes after your fix. I reran what you asked: c256f83 + #190 (and #454, only for the watchdog switch), GE-Proton11-12's Wine with its builtin d3dcompiler_47, Proton Experimental's vkd3d-proton 3.2.0, RX 9070 XT RADV, diagnostics build, short run into the first mission.

  • No E5005, no root signature error, and 0 rectangle expander shader unavailable drops (256/frame before). So on stock Proton your fix does what it says.
  • The only rectangle line left is indirect kind 1: indexed rectangles not supported at about 0.1/frame.
  • The run ended about 2 min after the first mesh pipelines with a GPU page fault from a texture read (GCVM_L2_PROTECTION_FAULT_STATUS:0x0060113B, client TCP), then device removed after a submission of 10 lists. That's the same signature plain main gives on this card (#714), and this tree has none of the other world fixes I usually stack, so I don't attribute it to the expander. One run, though.

So my branch isn't needed for Wine any more. It only matters if you'd rather not have a run-time compiler at all, as #190 did for the clamp. Otherwise, ignore it.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7127357762 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7127357762). Originally posted by [Exorion1er](https://github.com/Exorion1er) on 2026-11-24T09:23:51Z. --- Our comments crossed: I posted the port a couple of minutes after your fix. I reran what you asked: `c256f83` + #190 (and #454, only for the watchdog switch), GE-Proton11-12's Wine with its **builtin** `d3dcompiler_47`, Proton Experimental's vkd3d-proton 3.2.0, RX 9070 XT RADV, diagnostics build, short run into the first mission. - No `E5005`, no root signature error, and 0 `rectangle expander shader unavailable` drops (256/frame before). So on stock Proton your fix does what it says. - The only rectangle line left is `indirect kind 1: indexed rectangles not supported` at about 0.1/frame. - The run ended about 2 min after the first mesh pipelines with a GPU page fault from a texture read (`GCVM_L2_PROTECTION_FAULT_STATUS:0x0060113B`, client `TCP`), then `device removed after a submission of 10 lists`. That's the same signature plain `main` gives on this card (#714), and this tree has none of the other world fixes I usually stack, so I don't attribute it to the expander. One run, though. So my branch isn't needed for Wine any more. It only matters if you'd rather not have a run-time compiler at all, as #190 did for the clamp. Otherwise, ignore it. AI-assisted (Claude Code).
justr4mzi commented 2026-11-24 10:03:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by justr4mzi on 2026-11-24T10:03:46Z.


Tested PR #346 (c256f832) integrated cleanly onto main (8e79c80) inside a 13-PR combined stack on Windows 11 with an AMD Radeon RX 6700 XT (RDNA2) and Rust 1.98.1 (x86_64-pc-windows-msvc).

  • Clean merge alongside #688, #609, #652, #472, and #677 (plus 7 shader PRs).
  • cargo test -p victory-gpu -- --test-threads=1: 64 passed, 0 failed, 1 ignored (all 7 rectangles::tests::* pass on this RDNA2 host, including hlsl_compiles, rectangle_expander_builds, and gpu_expansion_matches_cpu_expand_rects); --features diagnostics: 67 passed, 0 failed, 1 ignored.
  • Full workspace (cargo test --workspace -- --test-threads=1): 329 passed, 0 failed, 6 ignored; cargo xtask policy: 155 files ok.
  • Full combined stack notes: https://github.com/Marvisak/VIctory/issues/49#issuecomment-7128256452
  • Not yet tested against a live title launch (no game data included).

AI-assisted verification and stack testing (reviewed locally).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7128260774 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7128260774). Originally posted by [justr4mzi](https://github.com/justr4mzi) on 2026-11-24T10:03:46Z. --- Tested PR #346 (`c256f832`) integrated cleanly onto `main` (`8e79c80`) inside a 13-PR combined stack on Windows 11 with an AMD Radeon RX 6700 XT (RDNA2) and Rust 1.98.1 (`x86_64-pc-windows-msvc`). - Clean merge alongside `#688`, `#609`, `#652`, `#472`, and `#677` (plus 7 shader PRs). - `cargo test -p victory-gpu -- --test-threads=1`: **64 passed, 0 failed, 1 ignored** (all 7 `rectangles::tests::*` pass on this RDNA2 host, including `hlsl_compiles`, `rectangle_expander_builds`, and `gpu_expansion_matches_cpu_expand_rects`); `--features diagnostics`: **67 passed, 0 failed, 1 ignored**. - Full workspace (`cargo test --workspace -- --test-threads=1`): **329 passed, 0 failed, 6 ignored**; `cargo xtask policy`: `155 files ok`. - Full combined stack notes: https://github.com/Marvisak/VIctory/issues/49#issuecomment-7128256452 - Not yet tested against a live title launch (no game data included). *AI-assisted verification and stack testing (reviewed locally).*
iurysf commented 2026-11-24 12:04:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by iurysf on 2026-11-24T11:21:53Z.


In-game data on NVIDIA. RTX 4070, driver 32.0.16.2101, on top of #493 + #483. Default loop limit, 300 s, 2 runs, idle CPU.

  • Rectangle drops in the last report went from 256 per frame on the base to 12 and 204 ("prepare failed for indirect rectangles"), so the effect varied a lot between the two runs. #282 gave 47 and 12 under the same conditions. There was no device removal, and no visible change in the captured frames, which show the opening credits.
  • The remaining drops fail in prepare after the expansion, mostly from dynamic descriptor slot exhaustion (see #688).
  • It doesn't merge on top of #493 + #483. There are 4 conflicts in descriptor/host.rs, 2 in draw.rs and 1 in valu_tests.rs, all context, because the branch predates those PRs. The branch history also carries ~40 files from other work beyond the 6 the PR shows. A rebase onto current main would make it much easier to evaluate.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7130000905 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7130000905). Originally posted by [iurysf](https://github.com/iurysf) on 2026-11-24T11:21:53Z. --- In-game data on NVIDIA. RTX 4070, driver 32.0.16.2101, on top of #493 + #483. Default loop limit, 300 s, 2 runs, idle CPU. - Rectangle drops in the last report went from 256 per frame on the base to **12 and 204** ("prepare failed for indirect rectangles"), so the effect varied a lot between the two runs. #282 gave 47 and 12 under the same conditions. There was no device removal, and no visible change in the captured frames, which show the opening credits. - The remaining drops fail in `prepare` after the expansion, mostly from dynamic descriptor slot exhaustion (see #688). - **It doesn't merge on top of #493 + #483.** There are 4 conflicts in `descriptor/host.rs`, 2 in `draw.rs` and 1 in `valu_tests.rs`, all context, because the branch predates those PRs. The branch history also carries ~40 files from other work beyond the 6 the PR shows. A rebase onto current main would make it much easier to evaluate. AI-assisted.
BastienRodz commented 2026-11-24 12:04:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T11:24:12Z.


Thanks for the runs. 256 → 12/204 drops with no device removal, and the rest failing in prepare on dynamic slot exhaustion (#688) rather than in the expander, is useful to know.

On the merge: the branch is already on current main (ffe310e, head 8ef6bfe). The PR itself is 7 commits in 6 files (draw.rs, host.rs, indirect.rs, lib.rs, primitive.rs, rectangles.rs), and it touches neither descriptor/host.rs nor valu_tests.rs. Merging the branch into an older base also brings every main commit since that base, which is where the ~40 files and those conflicts come from. To add only this PR to your stack:

git fetch https://github.com/BastienRodz/VIctory gpu/indirect-rectangles
git cherry-pick ffe310e..FETCH_HEAD

That applies cleanly on a base that has #418 (half subnormals, merged after d2a4bae), since the half-float commits build on it. On an older base, primitive.rs conflicts. Rebasing your stack onto current main avoids both.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7130051096 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7130051096). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T11:24:12Z. --- Thanks for the runs. 256 → 12/204 drops with no device removal, and the rest failing in `prepare` on dynamic slot exhaustion (#688) rather than in the expander, is useful to know. On the merge: the branch is already on current `main` (`ffe310e`, head `8ef6bfe`). The PR itself is 7 commits in 6 files (`draw.rs`, `host.rs`, `indirect.rs`, `lib.rs`, `primitive.rs`, `rectangles.rs`), and it touches neither `descriptor/host.rs` nor `valu_tests.rs`. Merging the branch into an older base also brings every `main` commit since that base, which is where the ~40 files and those conflicts come from. To add only this PR to your stack: ``` git fetch https://github.com/BastienRodz/VIctory gpu/indirect-rectangles git cherry-pick ffe310e..FETCH_HEAD ``` That applies cleanly on a base that has #418 (half subnormals, merged after `d2a4bae`), since the half-float commits build on it. On an older base, `primitive.rs` conflicts. Rebasing your stack onto current `main` avoids both. AI-assisted (Claude Code).
Yaekai commented 2026-11-24 17:04:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Yaekai on 2026-11-24T16:26:27Z.


Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head 8ef6bfe:

  • cargo test -p victory-gpu --lib: 58 passed, 0 failed (1.33s).
  • cargo clippy -p victory-gpu -- -D warnings: 0 warnings.
  • Live GTA VI (1.0.2.1, --console series-s, 19-min world run): verified GPU indirect rectangle expansion with zero D3D12 errors or regressions. Ready to merge!
<!-- greyfinch-sync:Marvisak/VIctory:comment:7137669214 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7137669214). Originally posted by [Yaekai](https://github.com/Yaekai) on 2026-11-24T16:26:27Z. --- Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head `8ef6bfe`: - `cargo test -p victory-gpu --lib`: 58 passed, 0 failed (1.33s). - `cargo clippy -p victory-gpu -- -D warnings`: 0 warnings. - Live GTA VI (`1.0.2.1`, `--console series-s`, 19-min world run): verified GPU indirect rectangle expansion with zero D3D12 errors or regressions. Ready to merge!
BastienRodz commented 2026-11-24 17:04:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T16:30:24Z.


The CPU-path half-float fix (fuzeofficlal's ties-to-even rounding in primitive.rs) is now its own PR, #1220, so it can land without the expander. Once it merges, I'll rebase this one onto it; the GPU expander's copy of the rounding stays here.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7137771033 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7137771033). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T16:30:24Z. --- The CPU-path half-float fix (fuzeofficlal's ties-to-even rounding in `primitive.rs`) is now its own PR, #1220, so it can land without the expander. Once it merges, I'll rebase this one onto it; the GPU expander's copy of the rounding stays here.
neonbyte1 commented 2026-11-24 19:04:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-24T18:12:47Z.


Results on Linux (Wine 11.22 + vkd3d-proton from GE-Proton11-14), RTX 5090, driver 620.73.04. #346 at 8ef6bfe is ported onto a stack that includes #190's own argument-clamp writer (indirect::bound), so clamp_uav is split out of it as the PR does.

Under Wine's HLSL compiler (vkd3d-shader): rectangles::tests::hlsl_compiles, rectangle_expander_builds and gpu_expansion_matches_cpu_expand_rects run and pass on the 5090. The StructuredBuffer<uint> reads and the serialized root signatures work there. I changed hlsl_compiles locally so that it fails instead of skipping when a compiler is present. Workspace: 403 passed, 0 failed, 6 ignored.

In game (first mission, diagnostics build, medians over frames with more than 1,000 draws):

  • indirect kind 0: prepare failed (compute false, mesh false) was 256 drops/frame before and is gone.
  • The only rectangle cause left is indirect kind 1: indexed rectangles not supported, about 1/frame.
  • Indirect drops overall: 1,416 → 1,194/frame. Draws: 4,062 → 4,373/frame.
  • No device removal and no Xid in runs of up to 7 minutes.

The final picture is still black in this stack. The G-buffer shows props but no ground or buildings, which points to the untranslated mesh shaders rather than the full-screen passes.

AI-assisted (Claude); all runs on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7140320609 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7140320609). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-24T18:12:47Z. --- Results on Linux (Wine 11.22 + vkd3d-proton from GE-Proton11-14), RTX 5090, driver 620.73.04. #346 at `8ef6bfe` is ported onto a stack that includes #190's own argument-clamp writer (`indirect::bound`), so `clamp_uav` is split out of it as the PR does. **Under Wine's HLSL compiler (vkd3d-shader):** `rectangles::tests::hlsl_compiles`, `rectangle_expander_builds` and `gpu_expansion_matches_cpu_expand_rects` run and pass on the 5090. The `StructuredBuffer<uint>` reads and the serialized root signatures work there. I changed `hlsl_compiles` locally so that it fails instead of skipping when a compiler is present. Workspace: 403 passed, 0 failed, 6 ignored. **In game** (first mission, diagnostics build, medians over frames with more than 1,000 draws): - `indirect kind 0: prepare failed (compute false, mesh false)` was 256 drops/frame before and is gone. - The only rectangle cause left is `indirect kind 1: indexed rectangles not supported`, about 1/frame. - Indirect drops overall: 1,416 → 1,194/frame. Draws: 4,062 → 4,373/frame. - No device removal and no Xid in runs of up to 7 minutes. The final picture is still black in this stack. The G-buffer shows props but no ground or buildings, which points to the untranslated mesh shaders rather than the full-screen passes. _AI-assisted (Claude); all runs on my machine, no game data shared._
upstream-sync closed this pull request 2026-11-24 22:01:16 +00:00
BastienRodz commented 2026-11-24 22:02:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T21:42:51Z.


Closing: 683ad7a on main now draws rectangle lists, indirect ones included, through a generated geometry shader, which covers what this PR did with a compute expander. Thanks to everyone who tested it on real hardware and in the title (DarX-Oren, fuzeofficlal, justlovett0, marquezinii, SkillIssueXO, Exorion1er, justr4mzi, iurysf, Yaekai, neonbyte1). The half-float ties-to-even fix carried here is still open on its own as #1220.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7145291476 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/346#issuecomment-7145291476). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T21:42:51Z. --- Closing: `683ad7a` on `main` now draws rectangle lists, indirect ones included, through a generated geometry shader, which covers what this PR did with a compute expander. Thanks to everyone who tested it on real hardware and in the title (DarX-Oren, fuzeofficlal, justlovett0, marquezinii, SkillIssueXO, Exorion1er, justr4mzi, iurysf, Yaekai, neonbyte1). The half-float ties-to-even fix carried here is still open on its own as #1220.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!346
No description provided.