Indirect: the argument clamp in a form Wine's HLSL compiler builds too #1009
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1011"
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?
Imported from fxceless/victory-fork. Originally posted by cmt8 on 2026-11-25T15:58:06Z.
What 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.
Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-25T16:22:17Z.
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.Imported from fxceless/victory-fork. Originally posted by cmt8 on 2026-11-25T17:01:57Z.
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