victory-gpu: compile indirect argument clamps as cs_5_0 with explicit root signatures #411

Closed
kwaadrat wants to merge 0 commits from upstream-pr/411 into main
kwaadrat commented 2026-12-01 23:24:37 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by kwaadrat on 2026-12-01T23:24:37Z.


Summary

  • Compile both indirect argument clamp shaders (crates/victory-gpu/src/indirect.rs and crates/victory-gpu/src/indirect/batch.rs) as cs_5_0 instead of cs_5_1 with inline [RootSignature(RS)].
  • Build their compute root signatures explicitly in Rust via D3D12SerializeVersionedRootSignature (clamp_root_signature), keeping the exact same bindings (b0 root constants, t* SRVs, u0/u1 UAVs).
  • Use RWStructuredBuffer<uint> budget : register(u1) with standard HLSL InterlockedOr / InterlockedCompareExchange / InterlockedAdd / InterlockedMax on budget[0..4] instead of RWByteAddressBuffer.Interlocked* methods.
  • Keep [RootSignature( -> cs_5_1 fallback in make_from for custom VICTORY_BENCH_CLAMP shader overrides.

Why

Neither clamp shader uses Shader Model 5.1 features — cs_5_1 was only needed for [RootSignature(RS)] and RWByteAddressBuffer.Interlocked*. Under Wine/Proton (d3dcompiler_47), both fail to compile with E_FAIL (0x80004005):

WARN victory_gpu::indirect: argument clamp: clamp:91:10: E5005: Method 'InterlockedOr' is not defined on type 'RWByteAddressBuffer'.
WARN victory_gpu::indirect: no batched argument clamp: records are clamped one at a time error=Call failed. (0x80004005)
WARN victory_gpu::indirect: argument clamp: clamp:122:10: E5005: Method 'InterlockedOr' is not defined on type 'RWByteAddressBuffer'.
WARN victory_gpu::indirect: no argument clamp: indirect execution dropped error=Call failed. (0x80004005)

When make_from fails, all indirect draws and dispatches are dropped for the entire session.

Verification

  • Built victory.exe on windows-latest (cargo build --release --locked -p victory) and tested on RTX 3060 12 GB (i5-9600KF) under Proton Experimental (vkd3d-proton): all four argument clamp / no batched argument clamp / no argument clamp warnings are completely gone.
<!-- greyfinch-sync:readmet3xt-lab/foxhound:issue:5596513457 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/411). Originally posted by [kwaadrat](https://github.com/kwaadrat) on 2026-12-01T23:24:37Z. --- ## Summary - Compile both indirect argument clamp shaders (`crates/victory-gpu/src/indirect.rs` and `crates/victory-gpu/src/indirect/batch.rs`) as `cs_5_0` instead of `cs_5_1` with inline `[RootSignature(RS)]`. - Build their compute root signatures explicitly in Rust via `D3D12SerializeVersionedRootSignature` (`clamp_root_signature`), keeping the exact same bindings (`b0` root constants, `t*` SRVs, `u0`/`u1` UAVs). - Use `RWStructuredBuffer<uint> budget : register(u1)` with standard HLSL `InterlockedOr` / `InterlockedCompareExchange` / `InterlockedAdd` / `InterlockedMax` on `budget[0..4]` instead of `RWByteAddressBuffer.Interlocked*` methods. - Keep `[RootSignature(` -> `cs_5_1` fallback in `make_from` for custom `VICTORY_BENCH_CLAMP` shader overrides. ## Why Neither clamp shader uses Shader Model 5.1 features — `cs_5_1` was only needed for `[RootSignature(RS)]` and `RWByteAddressBuffer.Interlocked*`. Under Wine/Proton (`d3dcompiler_47`), both fail to compile with `E_FAIL (0x80004005)`: ```text WARN victory_gpu::indirect: argument clamp: clamp:91:10: E5005: Method 'InterlockedOr' is not defined on type 'RWByteAddressBuffer'. WARN victory_gpu::indirect: no batched argument clamp: records are clamped one at a time error=Call failed. (0x80004005) WARN victory_gpu::indirect: argument clamp: clamp:122:10: E5005: Method 'InterlockedOr' is not defined on type 'RWByteAddressBuffer'. WARN victory_gpu::indirect: no argument clamp: indirect execution dropped error=Call failed. (0x80004005) ``` When `make_from` fails, **all indirect draws and dispatches are dropped** for the entire session. ## Verification - Built `victory.exe` on `windows-latest` (`cargo build --release --locked -p victory`) and tested on RTX 3060 12 GB (i5-9600KF) under Proton Experimental (`vkd3d-proton`): all four `argument clamp` / `no batched argument clamp` / `no argument clamp` warnings are completely gone.
readmet3xt-lab commented 2026-12-02 01:48:50 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by readmet3xt-lab on 2026-12-02T01:48:50Z.


Thank you. These pin down exactly which of our own shaders fail under Proton's built-in compiler and what it costs when the card-side compare is missing, which is the clearest data we have on #407. We're going to solve it one level lower: our shaders will ship already compiled, so no shader compiler is asked at run time on any system, and Windows keeps exactly the bytecode it has today. Because of that we won't merge these three as they are (they change the shader model and two buffer types on Windows too). Your findings and measurements go into that change, with credit. When the build is out, a run under Proton with Full logs from you would be the best test we could get.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7332137270 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/411#issuecomment-7332137270). Originally posted by [readmet3xt-lab](https://github.com/readmet3xt-lab) on 2026-12-02T01:48:50Z. --- Thank you. These pin down exactly which of our own shaders fail under Proton's built-in compiler and what it costs when the card-side compare is missing, which is the clearest data we have on #407. We're going to solve it one level lower: our shaders will ship already compiled, so no shader compiler is asked at run time on any system, and Windows keeps exactly the bytecode it has today. Because of that we won't merge these three as they are (they change the shader model and two buffer types on Windows too). Your findings and measurements go into that change, with credit. When the build is out, a run under Proton with Full logs from you would be the best test we could get.

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
readmet3xt-lab/foxhound!411
No description provided.