GPU: build the indirect-argument clamp with our own writer (no shader compiler at run time) #190

Closed
github-bot wants to merge 1 commit from gh-pr/190/head into gh-pr/190/base
Owner

@⁠LaunchDoesntCode on GitHub · 2026-11-24 01:16 UTC · original
gpu/clamp-as-dxil → main · +559 −103 · 8 files · 1 commits · closed without merging

Closes #170. An alternative to #178, which fixes the same thing by falling back to DXC; the comparison is at the end.

What

Under Wine and Proton, indirect::clamp() fails and every indirect execution is dropped, because the clamp is HLSL compiled at run time by D3DCompile, and Wine's d3dcompiler_47 cannot compile it. As #170 records, rewriting the HLSL does not help: that compiler has no store to a raw or structured buffer and ignores the [RootSignature] attribute.

This emits the same shader as DXIL with the shader crate's own writer and makes its root signature from a description, so no shader compiler is involved on any host.

Changes

  • victory-shader/src/emit/clamp.rs (new): argument_clamp() returns the clamp as a DXIL container. Same behaviour as the HLSL it replaces: one thread per record; draws, dispatches and mesh dispatches clamped in place with the same bounds; the cost added to the list's budget atomically; a record past the budget emptied.
  • emit/shader.rs: the builder learns root UAVs (raw buffers) beside root CBVs and SRVs: root_uav_handle, their dx.resources records and their PSV0 bindings. Translated shaders do not use it, so their output is unchanged.
  • victory-gpu/src/indirect.rs: make() takes that DXIL and a root signature from pipeline::host::root_signature (now pub(crate)). D3DCompile and the Win32_Graphics_Direct3D_Fxc feature are gone.
  • emit/host.rs (test harness): Root::Uav, a root UAV whose contents come back after the dispatch, and root_signature_of, split out of root_signature_for.

Tested

Cross-built for x86_64-pc-windows-msvc on Linux Mint, Proton 10.0 (wine-10.0, vkd3d-proton), RTX 5090, driver 595.99.2, main at d2a4bae:

  • indirect::tests::argument_clamp_builds: fails on main, passes here.
  • Two new GPU tests in emit::clamp run the clamp and read the buffers back:
    • records_are_clamped_in_place: records of all four kinds against the bounds written out in Rust, the untouched fourth dword of each record, a record past the count left alone, and the budget's total.
    • records_past_the_budget_run_empty: a record that fits exactly, one that crosses the budget and one after it is spent, for draws and for a dispatch.
  • cargo test -p victory-shader: 70 passed, 1 failed (stub_pipeline_is_created, which fails the same way on main under Proton).
  • cargo test -p victory-gpu: 41 passed, 2 failed, both failing on main too (a_rejected_blob_gives_an_empty_library, and buffer_data_reaches_the_host_texture, which is #128).

Not tested: Windows, and the title

  • No run on Windows. The container goes through the same writer and hash as every translated shader, but dxil.dll validation of this particular module and a run on a Windows driver are unchecked. A Windows run of cargo test -p victory-shader clamp and -p victory-gpu argument_clamp would settle it.
  • Not run in the title. With VICTORY_INDIRECT=1 under Proton this should turn "indirect execution dropped" into executed draws; I have not captured that.

Against #178

#178 (DXC fallback) this
Size +63 −8 +559 −103, most of it the shader and its tests
Needs at run time dxcompiler.dll in the prefix when D3DCompile refuses nothing
Windows path unchanged changed: the same DXIL on every host
Evidence seen working in the title under Wine clamp results checked on the GPU; not seen in the title

They are not exclusive in spirit but they do touch the same function, so only one should land. #178 is the smaller change and is already seen working in the title; this one removes the dependency instead of adding a second compiler. Your call.

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

🤖 Generated with Claude Code

**@⁠LaunchDoesntCode** on GitHub · 2026-11-24 01:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/190) `gpu/clamp-as-dxil` → `main` · +559 −103 · 8 files · 1 commits · closed without merging Closes #170. An alternative to #178, which fixes the same thing by falling back to DXC; the comparison is at the end. ## What Under Wine and Proton, `indirect::clamp()` fails and every indirect execution is dropped, because the clamp is HLSL compiled at run time by `D3DCompile`, and Wine's `d3dcompiler_47` cannot compile it. As #170 records, rewriting the HLSL does not help: that compiler has no store to a raw or structured buffer and ignores the `[RootSignature]` attribute. This emits the same shader as DXIL with the shader crate's own writer and makes its root signature from a description, so no shader compiler is involved on any host. ## Changes - **`victory-shader/src/emit/clamp.rs` (new):** `argument_clamp()` returns the clamp as a DXIL container. Same behaviour as the HLSL it replaces: one thread per record; draws, dispatches and mesh dispatches clamped in place with the same bounds; the cost added to the list's budget atomically; a record past the budget emptied. - **`emit/shader.rs`:** the builder learns root UAVs (raw buffers) beside root CBVs and SRVs: `root_uav_handle`, their `dx.resources` records and their `PSV0` bindings. Translated shaders do not use it, so their output is unchanged. - **`victory-gpu/src/indirect.rs`:** `make()` takes that DXIL and a root signature from `pipeline::host::root_signature` (now `pub(crate)`). `D3DCompile` and the `Win32_Graphics_Direct3D_Fxc` feature are gone. - **`emit/host.rs` (test harness):** `Root::Uav`, a root UAV whose contents come back after the dispatch, and `root_signature_of`, split out of `root_signature_for`. ## Tested Cross-built for `x86_64-pc-windows-msvc` on Linux Mint, Proton 10.0 (wine-10.0, vkd3d-proton), RTX 5090, driver 595.99.2, `main` at `d2a4bae`: - `indirect::tests::argument_clamp_builds`: fails on `main`, passes here. - Two new GPU tests in `emit::clamp` run the clamp and read the buffers back: - `records_are_clamped_in_place`: records of all four kinds against the bounds written out in Rust, the untouched fourth dword of each record, a record past the count left alone, and the budget's total. - `records_past_the_budget_run_empty`: a record that fits exactly, one that crosses the budget and one after it is spent, for draws and for a dispatch. - `cargo test -p victory-shader`: 70 passed, 1 failed (`stub_pipeline_is_created`, which fails the same way on `main` under Proton). - `cargo test -p victory-gpu`: 41 passed, 2 failed, both failing on `main` too (`a_rejected_blob_gives_an_empty_library`, and `buffer_data_reaches_the_host_texture`, which is #128). ## Not tested: Windows, and the title - No run on Windows. The container goes through the same writer and hash as every translated shader, but `dxil.dll` validation of this particular module and a run on a Windows driver are unchecked. **A Windows run of `cargo test -p victory-shader clamp` and `-p victory-gpu argument_clamp` would settle it.** - Not run in the title. With `VICTORY_INDIRECT=1` under Proton this should turn "indirect execution dropped" into executed draws; I have not captured that. ## Against #178 | | #178 (DXC fallback) | this | |---|---|---| | Size | +63 −8 | +559 −103, most of it the shader and its tests | | Needs at run time | `dxcompiler.dll` in the prefix when `D3DCompile` refuses | nothing | | Windows path | unchanged | changed: the same DXIL on every host | | Evidence | seen working in the title under Wine | clamp results checked on the GPU; not seen in the title | They are not exclusive in spirit but they do touch the same function, so only one should land. #178 is the smaller change and is already seen working in the title; this one removes the dependency instead of adding a second compiler. Your call. No game data used. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The clamp was HLSL compiled at run time by the system's D3DCompile. Wine's
d3dcompiler_47 rejects it (no Load on RWByteAddressBuffer, no store to a
structured buffer, and the RootSignature attribute is ignored), so under
Wine and Proton clamp() failed and every indirect execution was dropped.

The same shader is now emitted as DXIL by the shader crate
(emit:🗜️:argument_clamp) and its root signature is made from a
description, so no shader compiler is needed on any host. For that the
shader builder learns root UAVs (raw buffers), beside root CBVs and SRVs.

Two GPU tests run the clamp over records of each kind and compare with
the bounds written out in Rust, and check that records past the list's
budget run empty.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:53:57 +00:00
github-bot closed this pull request 2026-11-26 03:53:57 +00:00
Author
Owner

@⁠raffclar on GitHub · 2026-11-24 01:16 UTC · original

Reviewing

**@⁠raffclar** on GitHub · 2026-11-24 01:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7118944155) Reviewing
Author
Owner

@⁠raffclar on GitHub · 2026-11-24 01:19 UTC · original

This will conflict with #178 and #40 They're all touching indirect.rs and it's getting a little hectic. Worth noting for merge order

**@⁠raffclar** on GitHub · 2026-11-24 01:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7118983226) This will conflict with #178 and #40 They're all touching `indirect.rs` and it's getting a little hectic. Worth noting for merge order
Author
Owner

@⁠SkippySteve on GitHub · 2026-11-24 01:25 UTC · original

Independent run of #190 under Proton on a second machine. Synthetic crate tests only; no game data and no title run.

Host: Arch Linux (kernel 7.2), RTX 2060 SUPER, NVIDIA 615.78.08. Runtime: UMU-Proton 11.0-2e (its files/bin/wine), a fresh dedicated prefix, WINEDLLOVERRIDES="d3d12=n;d3d12core=n;dxgi=n;d3d11=n" so the prefix's vkd3d-proton and DXVK DLLs are used. +loaddll shows native d3d12.dll/d3d12core.dll, and vkd3d-proton reports SM 6.8.

Build: cargo xwin test --target x86_64-pc-windows-msvc -p victory-shader -p victory-gpu --no-run at ffa1310, then the test exes run under wine. D3DCompile, Direct3D_Fxc and dxcompiler do not appear anywhere in the tree on this branch, so the clamp is built with no runtime shader compiler.

main @ d2a4bae #190 @ ffa1310
victory-gpu indirect::tests::argument_clamp_builds FAIL (clamp().is_some() at indirect.rs:215) pass
victory-shader emit::clamp::tests::records_are_clamped_in_place (not on main) pass
victory-shader emit::clamp::tests::records_past_the_budget_run_empty (not on main) pass
cargo test -p victory-shader, all tests 68 pass / 1 fail 70 pass / 1 fail
cargo test -p victory-gpu, all tests 40 pass / 3 fail / 1 ignored 41 pass / 2 fail / 1 ignored

The failures left on this branch are the same ones that fail on main here: stub_pipeline_is_created, a_rejected_blob_gives_an_empty_library and buffer_data_reaches_the_host_texture (#128). That is the same as your Proton 10 / RTX 5090 numbers, so the result holds on an older Turing card and a newer Proton.

Against #178: git merge-tree pr190 pr178 conflicts in crates/victory-gpu/Cargo.toml and crates/victory-gpu/src/indirect.rs, as you said. Both change make()/the Fxc feature, so only one of them can land as-is. I have not run this on Windows, so the open dxil.dll validation question from the PR body still stands.

**@⁠SkippySteve** on GitHub · 2026-11-24 01:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7119084580) Independent run of #190 under Proton on a second machine. Synthetic crate tests only; no game data and no title run. **Host:** Arch Linux (kernel 7.2), RTX 2060 SUPER, NVIDIA 615.78.08. **Runtime:** UMU-Proton 11.0-2e (its `files/bin/wine`), a fresh dedicated prefix, `WINEDLLOVERRIDES="d3d12=n;d3d12core=n;dxgi=n;d3d11=n"` so the prefix's vkd3d-proton and DXVK DLLs are used. `+loaddll` shows native `d3d12.dll`/`d3d12core.dll`, and vkd3d-proton reports SM 6.8. **Build:** `cargo xwin test --target x86_64-pc-windows-msvc -p victory-shader -p victory-gpu --no-run` at `ffa1310`, then the test exes run under `wine`. `D3DCompile`, `Direct3D_Fxc` and `dxcompiler` do not appear anywhere in the tree on this branch, so the clamp is built with no runtime shader compiler. | | `main` @ `d2a4bae` | #190 @ `ffa1310` | |---|---|---| | `victory-gpu indirect::tests::argument_clamp_builds` | **FAIL** (`clamp().is_some()` at `indirect.rs:215`) | **pass** | | `victory-shader emit::clamp::tests::records_are_clamped_in_place` | (not on main) | **pass** | | `victory-shader emit::clamp::tests::records_past_the_budget_run_empty` | (not on main) | **pass** | | `cargo test -p victory-shader`, all tests | 68 pass / 1 fail | 70 pass / 1 fail | | `cargo test -p victory-gpu`, all tests | 40 pass / 3 fail / 1 ignored | 41 pass / 2 fail / 1 ignored | The failures left on this branch are the same ones that fail on `main` here: `stub_pipeline_is_created`, `a_rejected_blob_gives_an_empty_library` and `buffer_data_reaches_the_host_texture` (#128). That is the same as your Proton 10 / RTX 5090 numbers, so the result holds on an older Turing card and a newer Proton. **Against #178:** `git merge-tree pr190 pr178` conflicts in `crates/victory-gpu/Cargo.toml` and `crates/victory-gpu/src/indirect.rs`, as you said. Both change `make()`/the Fxc feature, so only one of them can land as-is. I have not run this on Windows, so the open `dxil.dll` validation question from the PR body still stands.
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 01:26 UTC · original

Tested ffa1310 under Wine 11.22 + vkd3d-proton 3.1 on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build, with Wine's builtin d3dcompiler_47 and no dxcompiler.dll: pass.

  • indirect::tests::argument_clamp_builds passes, and the suite is 41 passed, 2 failed, 1 ignored. The two failures are the environment-only a_rejected_blob_gives_an_empty_library (vkd3d wants a non-empty blob) and #128.
  • This is the better Wine/Proton fix compared with #178: that one needs dxcompiler.dll on the host (Wine does not ship it, though it does work once the DLL is provided — 41/2 as well). Here no shader compiler is involved at all, so indirect execution runs out of the box under Proton.
  • On Windows, where D3DCompile succeeds, behaviour is unchanged. Keeping #178 as a fallback for hosts where both compilers refuse the source still seems worthwhile, but #190 alone unblocks the Linux path.

No game data used.

**@⁠DaviTostes** on GitHub · 2026-11-24 01:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7119105657) Tested `ffa1310` under **Wine 11.22 + vkd3d-proton 3.1** on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build, **with Wine's builtin `d3dcompiler_47` and no `dxcompiler.dll`**: **pass**. - `indirect::tests::argument_clamp_builds` **passes**, and the suite is **41 passed, 2 failed, 1 ignored**. The two failures are the environment-only `a_rejected_blob_gives_an_empty_library` (vkd3d wants a non-empty blob) and #128. - This is the better Wine/Proton fix compared with #178: that one needs `dxcompiler.dll` on the host (Wine does not ship it, though it does work once the DLL is provided — 41/2 as well). Here no shader compiler is involved at all, so indirect execution runs out of the box under Proton. - On Windows, where `D3DCompile` succeeds, behaviour is unchanged. Keeping #178 as a fallback for hosts where both compilers refuse the source still seems worthwhile, but #190 alone unblocks the Linux path. No game data used.
Author
Owner

@⁠raffclar on GitHub · 2026-11-24 01:30 UTC · original

I think it's worth really thinking about whether to go down this route of adding DirectX's IL. It's more to maintain. This should be fixed upstream in Wine/Proton if possible

**@⁠raffclar** on GitHub · 2026-11-24 01:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7119173763) I think it's worth really thinking about whether to go down this route of adding DirectX's IL. It's more to maintain. This should be fixed upstream in Wine/Proton if possible
Author
Owner

@⁠raffclar on GitHub · 2026-11-24 01:31 UTC · original

I'd refactor this into its own little garden so as Wine/Proton support increases, it can be pruned

**@⁠raffclar** on GitHub · 2026-11-24 01:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7119190979) I'd refactor this into its own little garden so as Wine/Proton support increases, it can be pruned
Author
Owner

@⁠xstraok on GitHub · 2026-11-24 08:32 UTC · original

Tested on Linux under Proton, where the clamp is the only thing between the world and dropping every indirect execution.

Setup

  • 58fed37 (main) with this PR's ffa1310 merged on top, diag build (--profile diag --features diagnostics), cross-built for x86_64-pc-windows-gnu with Rust 1.92.0
  • Arch Linux, kernel 7.2.15, AMD RX 9060 XT (RDNA4), Mesa 26.2.6 RADV, Ryzen 5 7600, 32 GB
  • Proton Experimental (11.0-20261112), vkd3d-proton for D3D12

Without this PR (main 8d23f07, same setup): Wine's D3DCompile (vkd3d-shader) refuses the clamp:
argument clamp: clamp:19:27: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'.
so every indirect execution is dropped. World: 93–1,279 draws/frame.

With this PR: no clamp warning; world 1,151–3,005 draws/frame (last 8 stats lines), 1.4–3.2 s/frame, no device removal, no amdgpu page fault in the kernel log. The picture is still mostly black (shaders that do not translate), with some geometry and the post-processing (blur, chromatic aberration) visible.

Not tested: Windows; NVIDIA; release build; cargo test under Wine.

Report written with Claude Code (Claude Opus 5.5) from runs on my machine.

**@⁠xstraok** on GitHub · 2026-11-24 08:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7126258735) Tested on Linux under Proton, where the clamp is the only thing between the world and dropping every indirect execution. **Setup** - `58fed37` (main) with this PR's `ffa1310` merged on top, diag build (`--profile diag --features diagnostics`), cross-built for `x86_64-pc-windows-gnu` with Rust 1.92.0 - Arch Linux, kernel 7.2.15, AMD RX 9060 XT (RDNA4), Mesa 26.2.6 RADV, Ryzen 5 7600, 32 GB - Proton Experimental (11.0-20261112), vkd3d-proton for D3D12 **Without this PR** (main `8d23f07`, same setup): Wine's `D3DCompile` (vkd3d-shader) refuses the clamp: `argument clamp: clamp:19:27: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'.` so every indirect execution is dropped. World: 93–1,279 draws/frame. **With this PR:** no clamp warning; world 1,151–3,005 draws/frame (last 8 stats lines), 1.4–3.2 s/frame, no device removal, no amdgpu page fault in the kernel log. The picture is still mostly black (shaders that do not translate), with some geometry and the post-processing (blur, chromatic aberration) visible. **Not tested:** Windows; NVIDIA; release build; `cargo test` under Wine. Report written with Claude Code (Claude Opus 5.5) from runs on my machine.
Author
Owner

@⁠Exorion1er on GitHub · 2026-11-24 08:35 UTC · original

Tested in the title on Linux: RX 9070 XT (RDNA4), Fedora 44, kernel 7.3.5, Mesa 26.2.7 RADV. GE-Proton11-12's Wine with Proton Experimental's vkd3d-proton 3.2.0 (d3d12,d3d12core,dxgi=n,b), no dxcompiler.dll anywhere. Diagnostics builds, Series X files, menus driven by VICTORY_KEYS, VICTORY_NO_WATCHDOG=1.

main f67c50c f67c50c + #190 #454 #493 #579 #89 6db02ea + #190 #454 #493 #579, VICTORY_SHADER_LOOP_LIMIT=32
clamp E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer' → no argument clamp: indirect execution dropped no clamp warning no clamp warning
"not bounded (no clamp…)" drop lines 68 0 0
indirect drops per world frame, median (range) 3,988 (2,035–9,996), 15 frames 1,382 (495–2,438), 35 frames 959 (298–2,828), 70 frames

What's still dropped on the stacked builds is prepare failed (compute false, mesh false), not the clamp.

With the stack, the scene reaches the G-buffer. At frame 1600 of the third run, the 2560×1440 depth target is about 92% covered and the richest f28 target about 85%, with the buildings and street correctly placed. The lighting targets (f26) are empty and the presented frame is black, like the Windows reports on #71. One run per column, so treat the numbers loosely, but the clamp result was the same in all three.

So on RADV, #190 (at ffa1310) does in the title what DaviTostes's test showed, without needing DXC.

Counts only, no game data. AI-assisted (Claude Code).

**@⁠Exorion1er** on GitHub · 2026-11-24 08:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7126315307) Tested in the title on Linux: RX 9070 XT (RDNA4), Fedora 44, kernel 7.3.5, Mesa 26.2.7 RADV. GE-Proton11-12's Wine with Proton Experimental's vkd3d-proton 3.2.0 (`d3d12,d3d12core,dxgi=n,b`), no `dxcompiler.dll` anywhere. Diagnostics builds, Series X files, menus driven by `VICTORY_KEYS`, `VICTORY_NO_WATCHDOG=1`. | | `main` `f67c50c` | `f67c50c` + #190 #454 #493 #579 #89 | `6db02ea` + #190 #454 #493 #579, `VICTORY_SHADER_LOOP_LIMIT=32` | |---|---|---|---| | clamp | `E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'` → `no argument clamp: indirect execution dropped` | no clamp warning | no clamp warning | | "not bounded (no clamp…)" drop lines | 68 | 0 | 0 | | indirect drops per world frame, median (range) | 3,988 (2,035–9,996), 15 frames | 1,382 (495–2,438), 35 frames | 959 (298–2,828), 70 frames | What's still dropped on the stacked builds is `prepare failed (compute false, mesh false)`, not the clamp. With the stack, the scene reaches the G-buffer. At frame 1600 of the third run, the 2560×1440 depth target is about 92% covered and the richest `f28` target about 85%, with the buildings and street correctly placed. The lighting targets (`f26`) are empty and the presented frame is black, like the Windows reports on #71. One run per column, so treat the numbers loosely, but the clamp result was the same in all three. So on RADV, #190 (at `ffa1310`) does in the title what DaviTostes's test showed, without needing DXC. Counts only, no game data. AI-assisted (Claude Code).
Author
Owner

@⁠MichaelSmithAI on GitHub · 2026-11-24 10:55 UTC · original

For the open validator question: Microsoft’s Windows dxil.dll accepted the 3,012-byte production argument-clamp shader through VIctory’s IDxcValidator wrapper under Wine. Microsoft’s Linux dxv also accepted it. The shader emitted at ffa1310 and after merging it onto ffe310e was byte-identical, SHA-256 9aeebc09369dab28bafc2182724063778e241ee7f065a4262f2e42cba5aef67e.

This verifies the emitted container with the Microsoft validator. Native Windows pipeline creation remains a separate check.

**@⁠MichaelSmithAI** on GitHub · 2026-11-24 10:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7129421346) For the open validator question: Microsoft’s Windows `dxil.dll` accepted the 3,012-byte production argument-clamp shader through VIctory’s `IDxcValidator` wrapper under Wine. Microsoft’s Linux `dxv` also accepted it. The shader emitted at `ffa1310` and after merging it onto `ffe310e` was byte-identical, SHA-256 `9aeebc09369dab28bafc2182724063778e241ee7f065a4262f2e42cba5aef67e`. This verifies the emitted container with the Microsoft validator. Native Windows pipeline creation remains a separate check.
Author
Owner

@⁠0xKaji on GitHub · 2026-11-24 14:46 UTC · original

Tested this PR (ffa1310) under Wine + vkd3d-proton 3.2.0 on an RTX 3060 8GB (driver 620.73.04, CachyOS Linux 7.3.5-2), both in the unit tests and in the live title through Stage (e) world rendering (timeout 120s, stacked on ffe310e + #177 + #347, VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains).

Unit Tests (Windows x86_64-pc-windows-msvc under Wine 11.22)

  • victory-shader (emit::clamp): 2 passed, 0 failed (records_are_clamped_in_place and records_past_the_budget_run_empty both pass on hardware).
  • victory-gpu full suite (--test-threads=1): 50 passed, 0 failed, 1 ignored — indirect::tests::argument_clamp_builds flips from failing on main (d3dcompiler_47 E5005) to passing.

Live Title Result (run3 without #190 vs run4 with #190 + #347)

  • Before (#177 only): victory_gpu::indirect failed once with clamp:19:27: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer' -> no argument clamp: indirect execution dropped (0x80004005). World frames capped at 767 draws/frame, dropping 2,589–5,080 indirect executions per frame.
  • With #190 (+ #347): The argument clamp DXIL compute shader compiled and ran cleanly (0 clamp failures, 0 crashes, 0 NVIDIA Xids). Live rendering in Stage (e) jumped >10× to 7,823 draws/frame (222 mesh pipelines + 113 VS/PS + 177 compute built cleanly; frame-256.png grew from 14 KB to 2.2 MiB), with buffer copies reaching 795.3 MB / 1500.8 ms GPU time. The >10× jump in draws/frame is the combined effect of this PR unlocking the indirect path plus #347 eliminating compile stalls; the clamp-specific change is 0 clamp failures and ExecuteIndirect going from fully dropped to active.
  • The 3,509 indirect drops still seen in the last frame occurred only downstream (prepare failed / scene pipeline still being compiled + 5 first-time indirect signatures such as stride=16 / args=[0, ...]), not from the argument clamp itself.
**@⁠0xKaji** on GitHub · 2026-11-24 14:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7134920453) Tested this PR (`ffa1310`) under Wine + `vkd3d-proton 3.2.0` on an **RTX 3060 8GB** (driver `620.73.04`, CachyOS Linux `7.3.5-2`), both in the unit tests and in the live title through Stage (e) world rendering (`timeout 120s`, stacked on `ffe310e` + #177 + #347, `VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains`). ### Unit Tests (Windows `x86_64-pc-windows-msvc` under Wine `11.22`) - `victory-shader` (`emit::clamp`): **2 passed, 0 failed** (`records_are_clamped_in_place` and `records_past_the_budget_run_empty` both pass on hardware). - `victory-gpu` full suite (`--test-threads=1`): **50 passed, 0 failed, 1 ignored** — `indirect::tests::argument_clamp_builds` flips from failing on `main` (`d3dcompiler_47` `E5005`) to **passing**. ### Live Title Result (`run3` without #190 vs `run4` with #190 + #347) - **Before (#177 only):** `victory_gpu::indirect` failed once with `clamp:19:27: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'` -> `no argument clamp: indirect execution dropped (0x80004005)`. World frames capped at **`767` draws/frame**, dropping `2,589–5,080` indirect executions per frame. - **With #190 (+ #347):** The `argument clamp` DXIL compute shader compiled and ran cleanly (`0` clamp failures, `0` crashes, `0` NVIDIA `Xid`s). Live rendering in Stage (e) jumped **>10×** to **`7,823` draws/frame** (`222` mesh pipelines + `113` VS/PS + `177` compute built cleanly; `frame-256.png` grew from `14 KB` to `2.2 MiB`), with buffer copies reaching `795.3 MB` / `1500.8 ms` GPU time. The >10× jump in draws/frame is the combined effect of this PR unlocking the indirect path plus #347 eliminating compile stalls; the clamp-specific change is 0 clamp failures and `ExecuteIndirect` going from fully dropped to active. - The `3,509` indirect drops still seen in the last frame occurred only downstream (`prepare failed` / scene pipeline still being compiled + 5 first-time indirect signatures such as `stride=16` / `args=[0, ...]`), not from the argument clamp itself.
Author
Owner

@⁠rouges78 on GitHub · 2026-11-24 15:23 UTC · original · edited 2026-11-24 15:26 UTC

Native Windows run on NVIDIA, as asked for in the PR body. Synthetic crate tests only: no game data, no title run.

Host: Windows 11 Pro (build 26300), RTX 4080, NVIDIA driver 621.14 (32.0.16.2114), D3D12Core.dll 10.0.26100.9818, Rust 1.98.1, native x86_64-pc-windows-msvc. The machine also has a Radeon iGPU, so I checked by adapter LUID that D3D12CreateDevice(None) is the 4080 and that the WARP runs are the Microsoft Basic Render Driver.

Tested: ffa1310 merged onto main @ ffe310e (clean merge), compared with ffe310e.

test WARP RTX 4080, 621.14
victory-shader emit::clamp::tests::records_are_clamped_in_place pass pass
victory-shader emit::clamp::tests::records_past_the_budget_run_empty pass pass
victory-gpu indirect::tests::argument_clamp_builds (--features diagnostics) pass pass

Run with --nocapture --test-threads=1; none took the "no SM 6.6 device; skipped" path. argument_clamp_builds returns silently without a host, so I also ran a local probe (not part of the PR) that fails instead: make() returned Ok on both adapters. So the NVIDIA driver takes the hand-written DXIL: the root signature and the compute pipeline are created, and the two readback tests get the expected buffers and budget.

Full suites, passed / failed / ignored:

main @ ffe310e #190 merged
cargo test -p victory-shader, WARP (VICTORY_WARP=1) 120 / 0 / 1 122 / 0 / 1
cargo test -p victory-shader, RTX 4080 120 / 0 / 1 122 / 0 / 1
cargo test -p victory-gpu --features diagnostics, WARP (VICTORY_D3D12_WARP=1) 53 / 0 / 1 53 / 0 / 1
cargo test -p victory-gpu, RTX 4080 50 / 0 / 1 50 / 0 / 1

Notes:

  • dxil.dll: the native validator from SDK 10.0.26100 (1.8.2502.11) accepts the module and leaves our digest unchanged. 3,012 bytes, SHA-256 9aeebc09369dab28bafc2182724063778e241ee7f065a4262f2e42cba5aef67e, the same hash MichaelSmithAI reported above.
  • Debug layer: not observed. Graphics Tools is not installed here (D3D12GetDebugInterface returns DXGI_ERROR_SDK_COMPONENT_MISSING), so no info-queue messages were captured.
  • On both trees, 4 of the passing shader tests are diff_tests that return early here ("no console compiler; skipped"). They are not the clamp tests.
  • One flake, not from this PR: frame::tests::waits_end_on_ticks_and_count_frames (frame.rs is identical in both trees) failed in some runs of both trees with skipped ticks, e.g. [4, 5, 7, 8] at frame.rs:221, and in 0 of 60 later runs per tree. That is the late wake-up #985 already addresses. The victory-gpu rows above are the runs without it.
  • Not measured: timings and the budget wrap (the PR keeps main's plain atomic add). Not run in the title; I don't have it.

AI-assisted (Claude Code), from runs on my machine.

**@⁠rouges78** on GitHub · 2026-11-24 15:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7135954649) · edited 2026-11-24 15:26 UTC Native Windows run on NVIDIA, as asked for in the PR body. Synthetic crate tests only: no game data, no title run. **Host:** Windows 11 Pro (build 26300), RTX 4080, NVIDIA driver 621.14 (32.0.16.2114), `D3D12Core.dll` 10.0.26100.9818, Rust 1.98.1, native `x86_64-pc-windows-msvc`. The machine also has a Radeon iGPU, so I checked by adapter LUID that `D3D12CreateDevice(None)` is the 4080 and that the WARP runs are the Microsoft Basic Render Driver. **Tested:** `ffa1310` merged onto `main` @ `ffe310e` (clean merge), compared with `ffe310e`. | test | WARP | RTX 4080, 621.14 | |---|---|---| | `victory-shader` `emit::clamp::tests::records_are_clamped_in_place` | pass | pass | | `victory-shader` `emit::clamp::tests::records_past_the_budget_run_empty` | pass | pass | | `victory-gpu` `indirect::tests::argument_clamp_builds` (`--features diagnostics`) | pass | pass | Run with `--nocapture --test-threads=1`; none took the "no SM 6.6 device; skipped" path. `argument_clamp_builds` returns silently without a host, so I also ran a local probe (not part of the PR) that fails instead: `make()` returned `Ok` on both adapters. So the NVIDIA driver takes the hand-written DXIL: the root signature and the compute pipeline are created, and the two readback tests get the expected buffers and budget. Full suites, passed / failed / ignored: | | `main` @ `ffe310e` | #190 merged | |---|---|---| | `cargo test -p victory-shader`, WARP (`VICTORY_WARP=1`) | 120 / 0 / 1 | 122 / 0 / 1 | | `cargo test -p victory-shader`, RTX 4080 | 120 / 0 / 1 | 122 / 0 / 1 | | `cargo test -p victory-gpu --features diagnostics`, WARP (`VICTORY_D3D12_WARP=1`) | 53 / 0 / 1 | 53 / 0 / 1 | | `cargo test -p victory-gpu`, RTX 4080 | 50 / 0 / 1 | 50 / 0 / 1 | Notes: - **`dxil.dll`:** the native validator from SDK 10.0.26100 (1.8.2502.11) accepts the module and leaves our digest unchanged. 3,012 bytes, SHA-256 `9aeebc09369dab28bafc2182724063778e241ee7f065a4262f2e42cba5aef67e`, the same hash MichaelSmithAI reported above. - **Debug layer: not observed.** Graphics Tools is not installed here (`D3D12GetDebugInterface` returns `DXGI_ERROR_SDK_COMPONENT_MISSING`), so no info-queue messages were captured. - On both trees, 4 of the passing shader tests are `diff_tests` that return early here ("no console compiler; skipped"). They are not the clamp tests. - One flake, not from this PR: `frame::tests::waits_end_on_ticks_and_count_frames` (`frame.rs` is identical in both trees) failed in some runs of both trees with skipped ticks, e.g. `[4, 5, 7, 8]` at `frame.rs:221`, and in 0 of 60 later runs per tree. That is the late wake-up #985 already addresses. The `victory-gpu` rows above are the runs without it. - Not measured: timings and the budget wrap (the PR keeps `main`'s plain atomic add). Not run in the title; I don't have it. AI-assisted (Claude Code), from runs on my machine.
Author
Owner

@⁠hh-ze on GitHub · 2026-11-24 15:28 UTC · original

Verified #190 on an RTX 5060 Ti with NVIDIA driver 595.99.02. All three targeted GPU tests passed, and a Story Mode run got past the Wine D3DCompile failure that previously prevented the indirect-argument clamp from running.

Setup

  • Ubuntu 24.04.5 LTS, kernel 7.0.0-43-generic, Ryzen 5 7600
  • GE-Proton 11-13 x86_64, Wine 11.0 (Staging), vkd3d-proton build cae8353ed7959c4, DXVK f90f1bf180f4135
  • Cross-built with Rust 1.98.1 for x86_64-pc-windows-gnu, using --profile diag --features diagnostics and a 16 MiB default thread stack
  • Base 234f049 with #177 and #439. Cherry-picked this PR’s ffa1310 as local commit 501c44e.
  • Ran the Windows binaries directly under GE-Proton Wine in isolated prefixes with VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains.

GPU verification

Test Result
victory-gpu · indirect::tests::argument_clamp_builds Pass
victory-shader · emit::clamp::tests::records_are_clamped_in_place Pass
victory-shader · emit::clamp::tests::records_past_the_budget_run_empty Pass

The first test created the clamp pipeline. The two readback tests dispatched the shader on the RTX 5060 Ti and checked the resulting argument records and budget handling.

Story Mode verification

I ran the local Series X 1.0.2.1 build. The baseline reproduced the failure from #170 when it reached world rendering:

argument clamp: clamp:19:27: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'.
no argument clamp: indirect execution dropped ... (0x80004005)

With ffa1310 applied, the run passed that point with the clamp active. These are samples from the last world-rendering intervals before each run exited:

Build Draws/frame Indirect executions dropped/frame Last frame number logged
Base 234f049 369 5,826 1200+ (last logged 1299)
Base + ffa1310 1,413 2,077 1361

These were diagnostic runs with separate caches and different skip lists. The baseline skipped three confirmed crashing compute shaders. The patched run also skipped a3d1a26ad0c8c2cd, which reproduced the crash in a standalone pipeline-creation test. The numbers describe those runs and should be read as diagnostic samples.

The patched run still exited with vkCreateComputePipelines Exception 0xc0000005 in Unix call after reaching roughly 0.2–0.3 fps in the world. The GPU and desktop stayed responsive, and the kernel logged no NVIDIA Xid during the tests. The clamp fix worked on this setup. Playable world rendering remains blocked by the compute-pipeline crash and substantial remaining rendering drops.

AI-assisted testing and log analysis. Log excerpts and test results only.

**@⁠hh-ze** on GitHub · 2026-11-24 15:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7136092009) Verified #190 on an **RTX 5060 Ti with NVIDIA driver 595.99.02**. All three targeted GPU tests passed, and a Story Mode run got past the Wine `D3DCompile` failure that previously prevented the indirect-argument clamp from running. ### Setup - Ubuntu 24.04.5 LTS, kernel `7.0.0-43-generic`, Ryzen 5 7600 - GE-Proton 11-13 x86_64, Wine `11.0 (Staging)`, vkd3d-proton build `cae8353ed7959c4`, DXVK `f90f1bf180f4135` - Cross-built with Rust `1.98.1` for `x86_64-pc-windows-gnu`, using `--profile diag --features diagnostics` and a 16 MiB default thread stack - Base `234f049` with #177 and #439. Cherry-picked this PR’s `ffa1310` as local commit `501c44e`. - Ran the Windows binaries directly under GE-Proton Wine in isolated prefixes with `VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains`. ### GPU verification | Test | Result | | --- | --- | | `victory-gpu` · `indirect::tests::argument_clamp_builds` | Pass | | `victory-shader` · `emit::clamp::tests::records_are_clamped_in_place` | Pass | | `victory-shader` · `emit::clamp::tests::records_past_the_budget_run_empty` | Pass | The first test created the clamp pipeline. The two readback tests dispatched the shader on the RTX 5060 Ti and checked the resulting argument records and budget handling. ### Story Mode verification I ran the local Series X `1.0.2.1` build. The baseline reproduced the failure from #170 when it reached world rendering: ```text argument clamp: clamp:19:27: E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'. no argument clamp: indirect execution dropped ... (0x80004005) ``` With `ffa1310` applied, the run passed that point with the clamp active. These are samples from the last world-rendering intervals before each run exited: | Build | Draws/frame | Indirect executions dropped/frame | Last frame number logged | | --- | ---: | ---: | ---: | | Base `234f049` | 369 | 5,826 | 1200+ (last logged 1299) | | Base + `ffa1310` | 1,413 | 2,077 | 1361 | These were diagnostic runs with separate caches and different skip lists. The baseline skipped three confirmed crashing compute shaders. The patched run also skipped `a3d1a26ad0c8c2cd`, which reproduced the crash in a standalone pipeline-creation test. The numbers describe those runs and should be read as diagnostic samples. The patched run still exited with `vkCreateComputePipelines Exception 0xc0000005 in Unix call` after reaching roughly 0.2–0.3 fps in the world. The GPU and desktop stayed responsive, and the kernel logged no NVIDIA Xid during the tests. The clamp fix worked on this setup. Playable world rendering remains blocked by the compute-pipeline crash and substantial remaining rendering drops. AI-assisted testing and log analysis. Log excerpts and test results only.
Author
Owner

@⁠x3ero0 on GitHub · 2026-11-24 18:35 UTC · original

One more NVIDIA data point, on a card not yet in this thread.

Setup: RTX 5080, driver 620.70, CachyOS (kernel 7.3.5), GE-Proton11-6's Wine with its bundled vkd3d-proton, ffa1310 cherry-picked onto main ffe310e (applies cleanly), cross-built with cargo xwin for x86_64-pc-windows-msvc.

Test ffe310e ffe310e + this PR
indirect::tests::argument_clamp_builds fails (E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer') passes
emit::clamp::tests::records_are_clamped_in_place n/a passes
emit::clamp::tests::records_past_the_budget_run_empty n/a passes

Synthetic tests only; I did not run the title on this tree.

For what it is worth as a cross-check of the design: I had written the same thing independently before finding this PR (#1470, now closed as a duplicate). That version gave the same buffers as the HLSL clamp compiled by DXC on 5,461 random records, on a native Linux build of vkd3d-proton, and Microsoft's libdxil.so (DXC v1.9.2609) accepted its container.

**@⁠x3ero0** on GitHub · 2026-11-24 18:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7140851637) One more NVIDIA data point, on a card not yet in this thread. **Setup:** RTX 5080, driver 620.70, CachyOS (kernel 7.3.5), GE-Proton11-6's Wine with its bundled vkd3d-proton, `ffa1310` cherry-picked onto `main` `ffe310e` (applies cleanly), cross-built with `cargo xwin` for `x86_64-pc-windows-msvc`. | Test | `ffe310e` | `ffe310e` + this PR | |---|---|---| | `indirect::tests::argument_clamp_builds` | fails (`E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'`) | passes | | `emit::clamp::tests::records_are_clamped_in_place` | n/a | passes | | `emit::clamp::tests::records_past_the_budget_run_empty` | n/a | passes | Synthetic tests only; I did not run the title on this tree. For what it is worth as a cross-check of the design: I had written the same thing independently before finding this PR (#1470, now closed as a duplicate). That version gave the same buffers as the HLSL clamp compiled by DXC on 5,461 random records, on a native Linux build of vkd3d-proton, and Microsoft's `libdxil.so` (DXC v1.9.2609) accepted its container.
@ -0,0 +32,4 @@
/// The clamp as a DXIL container. Its user data is four dwords: the kind
/// of record (0 and 1 draws, 2 dispatches, else mesh dispatches), the
/// records' stride in bytes, their count, and one unused.
pub fn argument_clamp() -> Vec<u8> {
Author
Owner

@⁠raffclar on GitHub · 2026-11-24 01:25 UTC · original

The DirectX IL matches op for op with the old HLSL. Same limits, branches etc so it's fine

**@⁠raffclar** on GitHub · 2026-11-24 01:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#discussion_r4674313291) The DirectX IL matches op for op with the old HLSL. Same limits, branches etc so it's fine
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:20 UTC · original

Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: crates/victory-shader/src/emit/host.rs, crates/victory-shader/src/emit/mod.rs, crates/victory-shader/src/emit/shader.rs.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/190#issuecomment-7148406701) <!-- victory-triage v1 head=ffa13108fef5f2bf646ba5db8845cacc67f2a38a verdict=needs-rebase at=2026-11-25T00:13:20Z --> Automated triage for the maintainers. **Needs rebase.** This PR does not merge cleanly into current `main` (ac2525d). Conflicting files: `crates/victory-shader/src/emit/host.rs`, `crates/victory-shader/src/emit/mod.rs`, `crates/victory-shader/src/emit/shader.rs`. The content has not been reviewed yet; it will be once the branch is rebased onto `main`. --- _Generated by [Claude Code](https://claude.ai/code)_

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!190
No description provided.