Indirect: the argument clamp in a form Wine's HLSL compiler builds too #1011
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!1011
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1011/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@cmt8 on GitHub · 2026-11-25 15:58 UTC · original
up/wine-clamp→main· +256 −38 · 2 files · 1 commits · closed without mergingWhat breaks today
Under Wine and Proton,
D3DCompileis Wine'sd3dcompiler_47, whose HLSL compiler is vkd3d-shader's. It refuses the clamp inindirect.rs(noLoad/Interlocked*methods onRWByteAddressBuffer,[allow_uav_condition]not implemented) and ignores[RootSignature]. So the clamp is never made and every indirect execution is dropped ("no argument clamp: indirect execution dropped"). The title's indirect draws and dispatches are then lost on Linux unless a DXC fallback (#20, #174) is in use; we have not counted how many that is onmain. The window check's compare shader and the tests'WORKER_CSfail the same way.The change
The three shaders are rewritten so that Microsoft's compiler and the vkd3d-shader 2.1 compiler in Wine 11.22 and in Proton Experimental (experimental-11.0-20261112) build them. Older Wine is not covered: per avt0m4t48's check below, Debian's Wine 10.0 builds neither
main's shaders nor these (it lacksGroupMemoryBarrierWithGroupSync, theInterlockedAddfunction and stores toRWStructuredBuffer<uint>). The rules stay as they are:MOST_DRAW, the gathered records of465b94f5, one budget charge per group of 64 in lane order, the 2^27 budget, the window rules.RWStructuredBuffer<uint>, indexed in words (dst_at = id.x * (stride / 4), copied words at+ off / 4; budget words 0, 1 and 2 are the old bytes 0, 4 and 8). A root UAV can be either kind of buffer, and strides, offsets and addresses that are not multiples of 4 are already refused (validate_layout,record_clamp_as), so the same bytes are written. The read-only source and count stayByteAddressBuffer, becauseLoadon those builds.Interlocked*are called as functions on the word.[allow_uav_condition]is removed. Microsoft's compiler builds the loop without it.host::root_signature,root_constants,root_view). They are version 1.1 with the same parameters as the old RS strings, and the strings' default flags (root SRVs static while set, root UAVs volatile).clamped_records_land_word_for_word_on_the_host, checks the clamp's output on the host GPU word for word. The WARP value tests skip where there is no WARP adapter, as under Wine, so without this test nothing under Wine checks what the clamp writes.Evidence
Windows test binaries cross-built on Linux and run under Wine 11.22 with Proton Experimental's vkd3d-proton (RX 7900 XTX, RADV, Mesa 26.3). The run uses the
wine-testxtask from Marvisak/VIctory #1218, which is not part of this PR.465b94f5it is 170 passed, 8 failed. Fixed:indirect::tests::argument_clamp_builds,host_list_budget_starts_empty_at_each_submission,host_list_reuses_and_grows_scratch_across_submissions,host_list_window_check_finds_a_record_written_under_its_window,host_list_window_executions_need_no_barrier_of_their_own. No test that passed before fails. The 3 left fail onmainunder Wine for other reasons:drvwatch(Wine'sEvtSubscribeis a stub),pipeline::library,resource::..._twin_....indirect::(16 tests) passes with three compilers: Wine 11.22's builtin, Proton Experimental's own (d3dcompiler_47with itslibvkd3d-shader-1.dll), and Microsoft'sd3dcompiler_4710.0.26100.3916 loaded natively.warp_gathered_records_come_out_as_if_clamped_one_by_one) included;main's clamp does not build there. Two exceptions: the twowarp_card_*tests needCARD_COMPARE/CARD_FETCH, which this PR does not convert, andwarp_budget_saturates_without_wraparound_and_preserves_draw_fieldsfails now and then on a real card on this branch and onmainalike, with Microsoft's compiler too (the second group of 64 can charge the budget first, which WARP never does). The harness change is not part of this PR.Not verified
Related
main. It also convertsCARD_COMPAREand the depth-plane twin (PlanePass), which this PR does not touch. If #127 is rebased, the two overlap only inindirect.rs, and either can take the other's form.Rebased onto
465b94f5(the gather commit): the one conflict was in the clamp, where the new gather branch is kept as it is and reads throughcount_buf, a read-onlyByteAddressBuffer.AI-assisted (Claude Code); no game data.
Under Wine and Proton, D3DCompile is Wine's d3dcompiler_47, whose HLSL compiler is vkd3d-shader's. It refuses the clamp (E5005: no Load or Interlocked* methods on RWByteAddressBuffer; [allow_uav_condition] is "not yet implemented") and ignores [RootSignature], so the clamp is never made and every indirect execution is dropped ("no argument clamp: indirect execution dropped"). The window check's compare shader and the tests' WORKER_CS fail the same way. The three shaders are rewritten with what both compilers take; the rules are unchanged (MOST_DRAW, one budget charge per group of 64 in lane order, the 2^27 budget, the window rules, the gathered records): - The buffers a shader writes are RWStructuredBuffer<uint> indexed in words: the destination record at id.x * (stride / 4), copied words at + off / 4; the budget's words 0, 1, 2 (bytes 0, 4, 8 as before); the window check's results at words 0, 1, 2.., 10... A root UAV can be either kind, and stride, offsets and addresses are already refused unless multiples of 4 (validate_layout, record_clamp_as, gatherable, record_gather_as), so the same bytes are written. The read-only source and count stay ByteAddressBuffer: Load on those builds. Gathered records (bit 2) read their offsets from the table behind count_buf as before and land in slot id.x, in words like the rest. - Interlocked* are called as functions on the buffer's word. - [allow_uav_condition] is dropped: Microsoft's d3dcompiler_47 builds the loop without it. - The root signatures are serialized in code (host::root_signature, root_constants, root_view; version 1.1, the same parameters as the RS strings, root SRVs static while set and root UAVs volatile, the defaults of the strings) and passed to the pipeline. The gather pass binds the same five parameters; its table is upload memory written before the list is submitted, which a root SRV static while set allows. A test checks the clamp's output on the host GPU word by word (offsets into the source, a count at an offset, strides past the smallest, every kind): the WARP value tests skip where there is no WARP adapter, as under Wine. The form descends from Marvisak/VIctory PR #1279 (Mumogg), written for upstream's simpler clamp; fork PR #127 (BitWuehler) did the same for this fork's clamp before the group charge and the window check came in. Tested: cargo xwin build --release -p victory; cargo xtask policy (180 files ok). Windows tests under Wine 11.22 (Arch wine 11.22-1; its d3dcompiler_47 is vkd3d-shader 2.1, Wine bundled) with the vkd3d-proton of Proton Experimental (experimental-11.0-20261112) on an RX 7900 XTX (RADV, Mesa 26.3.1): victory-gpu 176 passed, 3 failed (was 170 passed, 8 failed on this commit's parent); fixed: indirect::tests::argument_clamp_builds, host_list_budget_starts_empty_at_each_submission, host_list_reuses_and_grows_scratch_across_submissions, host_list_window_check_finds_a_record_written_under_its_window, host_list_window_executions_need_no_barrier_of_their_own; no new failure. indirect:: passes (16 of 16) also with Proton Experimental's own d3dcompiler_47 (vkd3d-shader 2.1) and with Microsoft's d3dcompiler_47 10.0.26100.3916 loaded natively (the parent: 10 of 15 with Proton's, 15 of 15 with Microsoft's). With the WARP harness pointed at the RX 7900 XTX for the run only, the WARP value tests, the gathered records' one included, pass under Wine's compiler (the parent's clamp does not build there); warp_budget_saturates_without_wraparound_and_preserves_draw_fields then fails now and then on this commit and on its parent alike, under Microsoft's compiler too (on a real card the second group can charge first). Not run on Windows. Co-Authored-By: Claude Opus 5.5 <[email protected]>@avt0m4t48 on GitHub · 2026-11-25 16:22 UTC · original · edited 2026-11-25 16:58 UTC
Rebase follow-up (November 25). The rebase resolved the conflict against the tested base. I checked base
465b94f54e2f31abd3624cf336697a57a2d6a083and GitHub test merge6f08132ebf822d0f4d6bf66da6da41dbea8c2e77, whose source tree matches rebased PR headd9e68ebb9a58f2abf35def0cf2b5a3ab714068c5.cargo check --offline --locked --target x86_64-pc-windows-msvc -p victory-gpu --all-targets --features diagnostics,blake3/pureon Linux with Rust 1.98.1 and separate target directories. Both emitted the existing test-onlydepth_writtenwarning.d3dcompiler_47atcs_5_1andcs_5_0. The clamp, including the gathered-records branch in this revision, still fails on the missing group barrier. The window check and worker still fail on the missing byte-address atomic method on main and the missing global atomic function on the PR. The synthetic smoke shader compiled at both profiles.action_requiredwith zero jobs. This follow-up covers Windows-target type checking and Wine 10.0 compilation. Wine 11.22, Proton, native Windows linking and execution, and GPU readback remain outside this independent check. No game files were used.At publication, the advertised
mainhad advanced toca8829ff551d2a8558daae74f8aa48d0b1ff7d70. These findings apply to the base, head and test merge listed above. Integration with the newer main is unverified.Earlier verification (before the rebase).
I checked the three changed HLSL strings from main
39731795d2d5117e6f90939273ee130428d28137and the GitHub test mergea11622e931a867e08239d6aa2f987b515a931ef8(PR headf98471783bea4715b5eceb3bf76db0bb3732429b). The merge and head have byte-identicalindirect.rs. I called Debian Wine 10.0's built-ind3dcompiler_47!D3DCompiledirectly with entrymain, profilecs_5_1and flags0, matching the repository calls.GroupMemoryBarrierWithGroupSync.RWByteAddressBuffer.InterlockedAddmethod. The PR reports the missing globalInterlockedAddfunction.RWStructuredBuffer<uint>store reports “Structured buffers store is not implemented.” Running the matrix withcs_5_0produced the same outcomes.This establishes a compatibility limit for Wine 10.0. If the PR description names the tested compiler versions next to the compatibility claim, readers on older Wine versions will know what to expect. The Wine 11.22 and Proton compiler results in the description are outside this check.
Main and the test merge each passed
cargo check --offline --locked --target x86_64-pc-windows-msvc -p victory-gpu --all-targets --features diagnostics,blake3/purefrom Linux with Rust 1.98.1 and separate target directories. Both emitted the existing test-onlydepth_writtenwarning. I exercised shader compilation only. GPU execution and native Windows linking and execution remain unverified by this check. No game files were used. Fork CI run reportedaction_requiredwith zero jobs.While I ran the checks, main advanced to
465b94f54e2f31abd3624cf336697a57a2d6a083. GitHub reports that the PR now conflicts, andgit merge-tree --write-treeindependently reports a content conflict incrates/victory-gpu/src/indirect.rs. Wine 10.0 also rejected all three shader strings on the new main. The clamp changed and still fails on the missing group barrier. The other two strings are byte-identical to the previously tested main. The cross-target check above applies to the earlier test merge.@cmt8 on GitHub · 2026-11-25 17:01 UTC · original
Thanks for checking this against Wine 10.0, and for rechecking after the rebase. We only tested vkd3d-shader 2.1 (Wine 11.22 and Proton Experimental experimental-11.0-20261112) and Microsoft's compiler. The description now names those and notes that Wine 10.0 builds neither main's shaders nor these. The rebase conflict was the new gather branch in the clamp, kept as it is; updated test counts are in the description.
AI-assisted (Claude Code).
Pull request closed