GPU: shaders of our own that Wine's compiler builds too #2967
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2969"
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 Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-26T01:48:43Z.
Under Wine,
D3DCompileis Wine'sd3dcompiler_47(vkd3d-shader's HLSL). It has no methods on writable byte address buffers (E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'), and it ignores[RootSignature], so the blob carries no root signature to create. Every shader VIctory compiles at run time failed there:no argument clamp: indirect execution dropped, after which every indirect draw and dispatch is dropped asnot bounded;no depth conversion;On Linux this alone keeps the world from drawing. In a run on
mainwith the NVIDIA fixes below, indirect drops summed to about 5,000 a frame, including the mesh dispatches that carry the world's geometry.What changes
compute, compiles a shader and builds its root signature in Rust from the parameters the host binds.main's design: one group, tiles of 64, groupshared costs charged in order, the list's budget, the rest of each record copied. The title's records are now aStructuredBuffer<uint>(t0), and the clamped records and the budget areRWStructuredBuffer<uint>(u0, u1), indexed in words.bound()already refuses addresses and strides that aren't multiples of 4. The root signature is b0 (4 constants), SRV t0, UAV u1, UAV u0, in the orderbound()binds them.[RootSignature]attributes the same way. The marked-write test ORs its page bit through aRWStructuredBuffer<uint>.The approach is @Mumogg's from #1279 (structured buffers indexed in words, the root signature built beside the shader). #1279 no longer applies to
main's rewritten clamp, so this ports it and extends it to the depth conversion. #2093 takes the other route, compiling these shaders on Windows at build time. Either fixes the run-time failure; this one needs no change to the build.Tested on an RTX 5090 (driver 620.73.04), Linux, Wine 11.22, vkd3d-proton 3.1-83 (GE-Proton11-14), with
cargo xtask wine-test(#1218):victory-gpuunder Wine: 225 passed, 6 failed, against 200/30 onmain(63bcca4). The remaining 6 are other Wine gaps, fixed elsewhere (#1722, #2101, #2973).pipeline::library::tests::pipelines_load_on_many_threads_at_onceis one of the 6, and it only fails with this PR. OnmainitsRWByteAddressBuffer/[RootSignature]shader doesn't compile under Wine, so it returned early and counted as passed. Now it compiles and runs into vkd3d-proton refusing a non-null empty pipeline library blob, which #1722 fixes. With #1722 on top, all 11pipeline::librarytests pass (3 of 3 runs).no argument clampand thenot boundeddrops are gone. Indirect drops fell from thousands to about 90 a frame, and draws run from about 800 to 4,900 a frame.cargo clippy --workspace --all-targets(with and withoutdiagnostics) andcargo xtask policyare clean.victory-gpuruns,watch::tests::a_retake_marks_buffer_copies_alonehung with the rest of the suite running beside it. It passed 10 of 10 runs on its own, both with and without this change. Mentioning it in case others see it.Not tested on Windows. Microsoft's compiler accepts the same HLSL, but I haven't run it.
AI-assisted (Claude); measured on my machine, no game data shared.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T02:00:05Z.
Review: COMMENTED
Reviewed and verified against
main(63bcca43) on Windows 11 (RTX 5090 + WARP,VICTORY_D3D12_DEBUG=1) — clean refactor and ready to merge:crates/victory-gpu/src/compute.rscleanly replaces inline[RootSignature]annotations across all 8 call sites with explicitD3D12SerializeRootSignature1.0 builders matching the previous register spaces and slot ordering 1-for-1, and converting writableRWByteAddressBufferusages (indirect.rs,twin.rs,draw.rs,pipeline/library.rs) toStructuredBuffer<uint>/RWStructuredBuffer<uint>preserves 4-byte alignment and atomic bit indexing.Local verification:
victory-gpu(compute::,draw::tests::,bindless::,indirect::,twin::,host::tests::,pipeline::withVICTORY_D3D12_DEBUG=1): 81/81 passed on both RTX 5090 and WARP (excluding pre-existing NVIDIA 1M view-heap baseline test)cargo clippy --locked -p victory-gpu --tests -- -D warnings: 0 warningscargo xtask policy: 192 files okImported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T02:49:19Z.
Review: APPROVED
LGTM — verified the port preserves semantics on Windows while staying inside Wine's compiler subset.
What I checked:
D3D12SerializeRootSignature— this removes theRootSignatureattribute dependency entirely (Wine's d3dcompiler ignores it, so the blob carried no signature to create). Error blobs are still logged on failure.Load(at+4)→args[at+1],Store3(at+8)→dest[at+2..at+4]conditional on kind==1 as before); the draw copy-out writes words +2/+3 unconditionally and +4 only for indexed draws, matching Store2/Store3 exactly. The(stride/4)indexing is safe becausebound()refuses non-4-multiple addresses and strides. Root params preserve the RS order: b0, t0, u1 (budget), u0 (dest).clamped_records_hold_every_wordis a strong test — every output word asserted per kind, budget charged per the cost model, past-budget records run empty while keeping their non-count words.(at16 + y·pitch16)/4 + id.xis exact because each thread owns a 2-pixel pair in one word;x*4bytes =xwords on the 32-bit side. Round-trip constants unchanged (0x37800080 / saturate*65535+0.5), so the tiled-lighting EQUAL-float behavior is preserved.Note (non-blocking): several test-only shaders still use
RWByteAddressBuffer.Store(e.g.dstin bindless/memory tests) — under Wine those tests would still not compile, which is presumably #2973's scope. Runtime paths are all Wine-safe now.Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T03:05:18Z.
I exercised the format-118 depth/stencil conversion through the production
Twin::copypath on Windows. The RTX 5080 and built-in WARP both returned exact results on16080c4and its parent63bcca4. On each adapter and build, all 174,342 depth texels and 174,342 stencil bytes matched in each direction.The fixture uses a 259×257 texture, three mips and two array slices. It covers all 65,536 D16 values, both pixels packed into a word, odd row widths, differing row pitches and an independent stencil pattern. It compares the intermediate D32 bit patterns against the material-depth formula, overwrites the twin, then checks the copy back to D16/S8. As a sensitivity check, deliberately reading the low 16 bits for both pixels failed at (1, 0) on both adapters with
0x00000000instead of0x3f1e379e.The test-only commit
3708bd0can be cherry-picked onto this branch. Runcargo test --locked -p victory-gpu --features diagnostics --lib depth_twin_preserves_every_u16 -- --nocapture. SetVICTORY_D3D12_WARP=1for the software pass. The three twin tests, strict Clippy and asset policy passed here. This measures the Windows conversion path; the in-game Wine observation is the author's.Imported from Marvisak/VIctory. Originally posted by postblink on 2026-11-26T04:22:26Z.
Tested on Linux with an NVIDIA card: it works there too.
Setup: CachyOS (Linux 7.3.6), RTX 5080 (driver 620.73.04), Ryzen 7 9800X3D. GE-Proton11-14's
winerun directly, with vkd3d-proton master71cae091(dxil-spirvb540c8a) in the prefix and DXVK'sdxgi.main63bcca4with #2723 and #189 on top,diagbuild, retail 1.0.2.1, Series X mode.main+ #2723)no argument clamp: indirect execution dropped#189 removes refused wave64 pipelines and doesn't touch the clamp. The indirect numbers moved with the clamp alone: a run with my own port of #1279 instead of #2969, and no #189, already showed about 760 indirect drops and up to 8,600 draws per frame. The remaining indirect drops are not the clamp. Most are
no dynamic slots for root viewson NVIDIA's capped view heap (#747), which I'm comparing separately.Before trying this PR I carried #1279 onto
mainmyself as a check. Itsindirecttests went from 0 of 6 to 6 of 6 under GE-Proton's Wine compiler on the RTX 5080. Yours takes the same approach and covers the depth twin too (I ran its in-game path above, not its tests), so I dropped mine.AI-assisted (Claude), runs and numbers from my own hardware.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T05:36:20Z.
Automated triage for the maintainers.
Merge candidate. The PR moves VIctory's run-time compute shaders (the indirect-argument clamp in
indirect.rs, the depth twin's 16-bit conversion intwin.rs, and the test shaders) offRWByteAddressBuffermethods and[RootSignature]attributes, which Wine'sD3DCompiledoes not support, ontouintstructured buffers indexed in words, with the root signatures built in Rust (newcompute.rs).mainalready makes allowances for Wine (host.rs,pipeline/library.rs,xmem::on_wine), so this is in scope, and it needs no build change, unlike the build-time route in #2093. I checked the clamp's word arithmetic against the old byte offsets (recordsstride / 4words apart;bound()already refuses unaligned addresses and strides), the root parameter order against whatbound()andTwin::copybind, and the twin's(at16 + y * pitch16) / 4 + id.xagainst the oldx * 2byte offset with evenx. The newclamped_records_hold_every_wordexpectations work out by hand. A commenter reports bit-exact twin conversion on Windows (RTX 5080 and WARP) and another reports the in-game effect under Wine.The author has not run it on Windows; a maintainer run of
victory-gputests on a Windows GPU would close that gap.CI: passing. Recommending a look, not approving.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by postblink on 2026-11-26T05:43:36Z.
Follow-up on my earlier comment, which said I hadn't run this PR's tests. I've now run them: the whole
victory-gpusuite under Wine, onmain63bcca4and on this head16080c4. Same machine and prefix (RTX 5080, GE-Proton11-14'swine, vkd3d-proton master71cae091), one top-level module per process.mainindirecttest, 16drawtests that run its compute shaders (the placed-view, marked sub-page UAV and upload tests, pluscompute_view_marks_rebind_after_depth_twin_conversion) andbindless::tests::heap_views_follow_writes_through_another_mapping. The newclamped_records_hold_every_wordpasses.pipeline::library::tests::pipelines_load_on_many_threads_at_once(5 of 5;an empty libraryatlibrary.rs:668). It isn't a regression. Onmain, that test'sRWByteAddressBuffer/[RootSignature]shader doesn't compile under Wine, so it returns at "no shader compiler here" and counts as passed. With this PR the shader builds and the test really runs into vkd3d-proton refusing an empty library blob, which #1722 fixes. With #1722 on top, all 11pipeline::librarytests pass, 3 of 3 runs, includinga_rejected_blob_gives_an_empty_library.descriptor::host::tests::dynamic_slots_are_held_until_released(the NVIDIA heap cap, #747),draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view, andpipeline::library::tests::a_rejected_blob_gives_an_empty_library(#1722).Not run:
resource::tests::a_list_waiting_for_another_queues_write_reads_what_it_wrote, which hangs under Wine on both builds. Run all together, the suite also took the headless X server down after about two minutes, so I ran it one module at a time. This is still Wine, not Windows, so the Windows run the triage asks for is still open.AI-assisted (Claude), runs and numbers from my own hardware.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T07:30:34Z.
Review: APPROVED
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):cargo test -p victory-gpu indirect::tests -- --test-threads=1(RTX 5090 & WARP): 7 passed, 0 failed on both.cargo test -p victory-gpu twin::tests -- --test-threads=1: 2 passed, 0 failed.cargo test -p victory-gpu present_compositor_builds_both_pipeline_states -- --test-threads=1: 1 passed, 0 failed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 192 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-26T10:38:38Z.
@postblink Thanks for running the whole suite. I reproduced it on an RTX 5090 under GE-Proton11-14's Wine and vkd3d-proton, 3 runs per build, with a print at each place the library tests return early:
main, Wine's compiler fails onpipelines_load_on_many_threads_at_once's shader (E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'). The test returns at "no shader compiler here" and counts as passed.an empty library(library.rs:668), 3 of 3.pipeline::librarytests pass, 3 of 3. That includesa_rejected_blob_gives_an_empty_libraryanda_pipeline_loads_while_a_save_holds_the_library. The latter also skips under Wine on bothmainand this PR until #1722.I'm leaving the test as it is, because it now catches a real problem. When there's no saved library yet, the host asks for an empty one the same way, and under Wine without #1722 it ends up with no pipeline library at all. Making the test skip there would hide that, and the fix belongs to #1722. I've added a sentence about it to the description.
In a full
victory-gpurun (one module per process, the hangingresourcetest skipped), this is the only test that fails with this PR and not onmain: 30 failures onmain, 6 with this PR. It's also the only test whose skip at the compile step this PR turns into a real run; the other tests whose shaders fail to compile onmainalready failed rather than skipping.AI-assisted (Claude); measured on my machine, no game data shared.
Imported from Marvisak/VIctory. Originally posted by AIcelos on 2026-11-26T21:37:18Z.
Tested on Linux + NVIDIA (Wine) — this stack now boots GTA VI v1.0.2.1 to a running game window.
Setup that works today (merged all open PRs in branch
nvidia-wine):cargo xwin build --profile diag -p victory --features diagnostics --target x86_64-pc-windows-msvcd3d12.dll/d3d12core.dlland DXVKdxgi.dllfrom GE-Proton 11-14 copied tosystem32/,WINEDLLOVERRIDES="d3d12,d3d12core,dxgi=n,builtin"dxil.dll: Wine's built-in (Wine-mono) DXBC builder works; NVIDIA's Windowsdxil.dllcannot load under Wine and blocks vkd3d-proton. (The team gist "remove all D3D12/DXGI/DXIL + builtin override" fails on stock wine — wine 10 ships nod3d12.dllof its own.)dxcompiler_NN.dllfallback (Wine's is unversioned),IDxcContainerBuilderv1→v2→v3 retry, root-signature fallback,VICTORY_CACHE_DIR.Result on RTX 5090: window appears, swapchain presents (frame 2048+ in 90 s ≈ 20 fps diag build), all 49 ttpf + packs open via dstorage, XUserAddAsync offline user, 52 shaders translated through Wine's dxil→DXBC path. No crash.
The "XCL requires Windows" premise is wrong: the whole layer runs under Wine with vkd3d-proton; only the host tooling assumed Windows.
Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-26T21:43:57Z.
@AIcelos nice, thanks for testing on the same GPU. Two pointers that may save you time:
mainplus #2958, #3120, #2309, #2461 and a few others. Thevictory_gpu::host: N fps, N ms/frame (… preparing; … on the GPU; … copying back)log lines give a breakdown that's easy to compare, if you'd like to post yours once you reach the yard.AI-assisted (Claude); measured on my machine, no game data shared.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.