Repository navigation
Conversation
Under Wine, D3DCompile is Wine's d3dcompiler_47 (vkd3d-shader HLSL): it
has no methods on writable byte address buffers (E5005 'Load' is not
defined on RWByteAddressBuffer) and ignores a [RootSignature] attribute,
so the code holds no root signature to make. Every run-time shader of
ours failed there: the argument clamp ("no argument clamp: indirect
execution dropped", every indirect draw and dispatch then dropped as
not bounded), the depth twin's 16-bit conversion ("no depth
conversion"), and the tests' own shaders.
A new module, compute, compiles a shader and serializes its root
signature in Rust from the parameters the host binds. The clamp keeps
main's design (one group, tiles of 64, groupshared costs charged in
order, the list's budget, the record's rest copied) with the title's
records a StructuredBuffer<uint> (t0) and the clamped records and the
budget RWStructuredBuffer<uint> (u0, u1), indexed in words: bound()
already refuses addresses and strides not multiples of 4. Its root
signature is b0 (4 constants), SRV t0, UAV u1, UAV u0, as bound()
binds them. The depth conversion indexes its scratch buffer in words
(footprint offsets and pitches are multiples of 4) with b0 (8
constants) and UAV u0. Test shaders lose their RootSignature
attributes the same way.
A new test checks every word the clamp writes for draws, indexed
draws, dispatches, mesh dispatches, records past the budget and the
budget spent.
The approach is Mumogg's (Marvisak#1279: structured buffers indexed in words,
the root signature serialized beside the shader), ported to main's
rewritten clamp and extended to the depth conversion.
The tests that bound their own root signatures:
The marked-UAV, placed-view and depth-twin rebind tests compile their
shaders with a [RootSignature] attribute Wine's compiler ignores, and
the marked write ORs its page bit through a byte address buffer method
it lacks. Their root signatures are made with crate::compute from what
the tests bind, and the bitmap is a RWStructuredBuffer<uint> indexed in
words.
fuzeofficlal
left a comment
There was a problem hiding this comment.
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.- Native Windows FXC compilation and D3D12 Debug Layer run with zero warnings on both hardware and WARP.
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 ok
kotekompotek
left a comment
There was a problem hiding this comment.
LGTM — verified the port preserves semantics on Windows while staying inside Wine's compiler subset.
What I checked:
- compute.rs: root parameters built in Rust and serialized via
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. - indirect.rs: byte→word conversions are consistent throughout (
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. - twin.rs:
(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. - memory.rs test pipelines: table/root-view/constants params match the old RS strings register-for-register, including space=2 placements and unbounded ranges.
Note (non-blocking): several test-only shaders still use RWByteAddressBuffer.Store (e.g. dst in bindless/memory tests) — under Wine those tests would still not compile, which is presumably #2973's scope. Runtime paths are all Wine-safe now.
|
I exercised the format-118 depth/stencil conversion through the production 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 The test-only commit |
|
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
#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 Before trying this PR I carried #1279 onto AI-assisted (Claude), runs and numbers from my own hardware. |
|
Automated triage for the maintainers. Merge candidate. The PR moves VIctory's run-time compute shaders (the indirect-argument clamp in The author has not run it on Windows; a maintainer run of CI: passing. Recommending a look, not approving. Generated by Claude Code |
|
Follow-up on my earlier comment, which said I hadn't run this PR's tests. I've now run them: the whole
Not run: AI-assisted (Claude), runs and numbers from my own hardware. |
Dukestar69
left a comment
There was a problem hiding this comment.
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).
|
@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:
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 AI-assisted (Claude); measured on my machine, no game data shared. |
Both were HLSL compiled at first use with D3DCompile. Under Wine that is vkd3d-shader's compiler, which refuses them (no methods on RWByteAddressBuffer, [RootSignature] ignored), so indirect execution was dropped and 16-bit depth written through unordered views never reached the depth texture. The rewrites in Marvisak#2913, Marvisak#2919 and Marvisak#2969 still need a Wine of 11.22 or later. victory-shader now writes both programs itself with its DXIL builder (emit::argument_clamp, emit::depth_conversion), the same algorithm and clamps as the HLSL, and victory-gpu makes their root signatures in code (own.rs). No shader compiler runs, whatever the Wine version. Tests: every_word_of_each_kind checks each word the clamp writes for every record kind; depth_converts_both_ways runs the conversion both ways on a buffer, with no compiler for the test either; our_programs_validate runs both through the DXIL validator where the SDK has one. Under Wine 10 and vkd3d-proton 3.1 the 7 indirect tests and the new depth test pass (6 indirect tests failed before), and the two draw tests that read converted depth pass with a native compiler for their own shaders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 (GPU: the host pipeline library works under Wine (null blob for an empty library) #1722, GPU: castable formats the host has #2101, Tests and fixes so the suite runs under Wine #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 GPU: the host pipeline library works under Wine (null blob for an empty library) #1722 fixes. With GPU: the host pipeline library works under Wine (null blob for an empty library) #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.