Skip to content

Tests and fixes so the suite runs under Wine - #2973

Open
neonbyte1 wants to merge 6 commits into
Marvisak:mainfrom
neonbyte1:pr/wine-tests
Open

neonbyte1 wants to merge 6 commits into
Marvisak:mainfrom
neonbyte1:pr/wine-tests

Conversation

@neonbyte1

@neonbyte1 neonbyte1 commented Nov 26, 2026 •

Copy link
Copy Markdown

Test changes so that cargo xtask wine-test (#1218) runs the Windows test suite on Linux. Stacked on #2969: the first commit here is that PR, so please review from GPU tests: a capped view heap keeps its documented size on. I'll rebase it out once #2969 is decided.

The runtime fixes this PR used to carry are now separate:

What's left here (tests that assumed Windows or particular hardware):

  • Capped view heap. A capped view heap keeps the size the code documents (vkd3d-proton on NVIDIA allows at most 1,041,451 slots). The test now asks the host for a full heap first.
  • Host capabilities. hosts_that_do_not_fuse_are_named still asserts on Windows that WARP doesn't fuse FMad. Under Wine, "WARP" is vkd3d-proton, which does fuse, so the test reports it instead. The null-buffer-view probe is skipped only where the host can't make the heap.
  • Present test. It waits for the host queue after presenting. Under Wine on NVIDIA, a process that exits right after its first present can hang in the driver's exit handler (Process exit right after the first Present is SIGKILLed on NVIDIA/Wine: swap chain creation on the queue thread races thread termination HansKristian-Work/vkd3d-proton#3524).
  • Skipped under Wine, each printing why:
    • the two page-table memory tests: Wine's compiler has no shader model 5.1 resource arrays (E_NOTIMPL);
    • the NTFS hard-link limit test: Wine's links go to the host filesystem.

Results under Wine 11.22, vkd3d-proton 3.1-83 (GE-Proton11-14) and DXVK dxgi, on an RTX 5090 (driver 620.73.04), with #1218 merged for the runner (passed / failed):

Crate main 63bcca4 this PR Remaining failures, fixed by
victory-gpu 200 / 30 229 / 3 #2101 (placed-view formats), #1722 (two pipeline-library tests)
victory-shader 298 / 4 300 / 2 #2968, #1266; its SIGKILL at exit by #3093
victory-hle 150 / 2 152 / 1 #3091
victory-loader 34 / 1 34 / 1 #3092

cargo clippy --workspace --all-targets (with and without diagnostics) and cargo xtask policy are clean. Not run on Windows: on Windows these changes are skips that don't apply there, or keep the Windows assertion as it was.

AI-assisted (Claude); measured on my machine, no game data shared.

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 fuzeofficlal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and verified against main (63bcca43) on native Windows 11 (RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1 + dxil.dll) — no native Windows regressions observed (note: includes the compute.rs shader migration also in #2969):

  • Explicit D3D12SerializeRootSignature + StructuredBuffer<uint>/RWStructuredBuffer<uint> preserves all 4-byte alignment invariants (indirect::bound, twin::Twin::copy); pipeline/library.rs passing null with length 0 to CreatePipelineLibrary complies with native D3D12 as well as vkd3d-proton.
  • descriptor/host.rs probing HEAP_VIEWS before asserting dynamic_slots_are_held_until_released also fixes that test on native RTX 5090 (1M view-heap limit); net.rs LazyLock lookups preserve native ws2_32.dll passthrough; crash.rs 10 ms append_guard() avoids exception-handler re-entry deadlocks.

Local verification (native Windows 11):

  • victory-hle: 152/152 unit + 2/2 integration passed
  • victory-loader: 35/35 unit (including concurrent_crash_records_stay_together) + 4/4 integration passed
  • victory-gpu (--test-threads=1, VICTORY_D3D12_DEBUG=1): WARP --features diagnostics 246/246 passed (skipping pre-existing compositor_failure_presents_primary_in_the_same_frame); RTX 5090 passed all modified suites (dynamic_slots_are_held_until_released, indirect 7/7, twin 2/2, pipeline::library 11/11, queue 5/5, bindless 3/3)
  • victory-shader: emit::semantics_tests 34/34, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros passed
  • cargo clippy --all-targets -- -D warnings (default & --features diagnostics) + cargo xtask policy (192 files ok): 0 warnings

@kotekompotek kotekompotek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — reviewed the stack on top of #2969 (8db9142..cb61564).

The three real fixes check out:

  • Null-blob pipeline library: bytes.is_empty() → null is the correct fix — an empty Rust slice's pointer is non-null, and vkd3d-proton rejects a non-null pointer with zero length. The raw-vtable CreatePipelineLibrary call with ID3D12PipelineLibrary1::IID + from_raw is sound.
  • Winsock lazy lookups: refusing with WSAENETUNREACH/WSAHOST_NOT_FOUND + a once() log preserves the console-without-network answer instead of panicking; the export-presence test correctly moves these into HOST_MAY_LACK.
  • Crash-record append lock: bounded try-lock (10 ms) that still writes on timeout is the right trade-off for an exception context — a rare interleave beats a deadlock or a lost report; poisoned guards are taken via into_inner.

Test-side changes verified:

  • wait_idle bumps submitted under its lock before Signal — no fence-value collision with the submission path; the queue.rs present-test wait matches the documented vkd3d-proton#3524 hang.
  • Shared SharedDevice {device, queue} per adapter: command queues are free-threaded, WARP stays serialized, and the vkd3d fence-thread teardown motivation is real. Acceptable consequence: a device-removed event would now persist across tests — in practice that's fatal for the run anyway.
  • under_wine() via wine_get_version is the standard probe; both uses are cfg(test)/test-only.
  • Heap-cap probes in descriptor/host.rs and stride_tests.rs ask for the real heap before asserting/skipping — better than name-matching adapters; the (4 + MIN_DYNAMIC) capped assertion pins the documented behavior on NVIDIA.
  • The FMad test now reports rather than asserts under Wine — correct, since vkd3d's WARP legitimately differs from Microsoft's rasterizer.

Marvisak commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate, to land after #2969 (recommending a look, not approving). Thanks for the split. The runtime fixes are now #3091 and #3092, the shared shader-test host is #3093, and the empty-library fix was dropped in favour of #1722. Apart from #2969's commit (16080c4), the branch now changes only tests:

  • dynamic_slots_are_held_until_released (descriptor/host.rs) first probes for a HEAP_VIEWS-slot heap. On a capped host it expects (4 + MIN_DYNAMIC, MIN_DYNAMIC), which matches HostHeap::new's make(count + MIN_DYNAMIC) branch on main.
  • hosts_that_do_not_fuse_are_named keeps the Windows WARP assertion and only reports the answer under Wine.
  • The two page-table memory tests and the hard-link limit test (xgamesave.rs, using the existing xmem::on_wine) skip under Wine with a reason printed.
  • The present test waits for the queue through a test-only Host::wait_idle.

On Windows, each change is either a skip that doesn't trigger or the original assertion. CI check passes.

Nits, none blocking:

  • under_wine is written twice, in victory-gpu/src/compute.rs and victory-shader/src/emit/host.rs.
  • a_heap_buffer_read_where_no_buffer_view_is_reads_zeros no longer fails when no adapter ran. On a machine with no SM 6.6 device it now passes silently.

Its first commit is #2969, so merging #2969 first, then rebasing this, keeps the history clean.


Generated by Claude Code

dynamic_slots_are_held_until_released asserted a view heap of at least
HEAP_VIEWS (2^21) slots, which HostHeap::new only makes where the host
takes that many; a host that caps its heaps (NVIDIA, and vkd3d-proton
on NVIDIA's 32 MiB Vulkan descriptor heaps: at most 1,041,451 slots)
gets the title's slots and MIN_DYNAMIC more, as the code says. The test
now asks the host for a heap of HEAP_VIEWS: where it takes one, the
assertion is as before; elsewhere the heap is the capped one.
lists_share_a_table_and_copies_keep_their_views and
a_submission_that_missed_leaves_the_copies_at_once read and write title
memory through views[NonUniformResourceIndex(...)], an unbounded
resource array of shader model 5.1. Wine's D3DCompile (vkd3d-shader)
has none ("Unbounded resource arrays", "Shader model 5.1+ resource
array" are hlsl_fixme there): the compile fails with E_NOTIMPL. Under
Wine (ntdll exports wine_get_version) the two tests say so and return.
Wine's CreateHardLinkW maps to link(2) on the host filesystem, whose
link limit is not NTFS's 1023, so the test's expectation cannot hold
there. Under Wine it says so and returns.
hosts_that_do_not_fuse_are_named asserted that WARP never fuses FMad.
Under Wine the WARP adapter is vkd3d-proton, which does: there the test
reports what each adapter does, and the assertion stays on Windows.
The null-buffer-view probe is skipped only on hosts that cannot make a
heap with the null view slot (both vkd3d adapters cap their view heaps
below HEAP_VIEWS), instead of failing there.
…exits

A process that exits right after its first present can be killed under
Wine on NVIDIA: vkd3d-proton makes the swap chain on its queue thread
after Present returns, Wine ends that thread inside the driver at exit,
and the driver's exit handler waits for a lock the thread held
(HansKristian-Work/vkd3d-proton#3524). The test now waits for the host
queue after presenting.
@neonbyte1

Copy link
Copy Markdown
Author

Thanks. Split as suggested:

This PR now holds only test changes (body and results table updated). It stays on #2969 until that's decided; then I'll rebase it out.

On crash.rs: the interleaving was within one process. concurrent_crash_records_stay_together writes from several threads, and under Wine two records came out mixed. The lock doesn't cover two processes writing the same log. I haven't seen that case, and #3092 says so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants