Wine/vkd3d: deferred uploads are skipped because VirtualQuery() reports mapped memory as MEM_FREE #128
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#128
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@DaviTostes on GitHub · 2026-11-24 00:45 UTC · original
Under Wine + vkd3d-proton, every deferred copy into a host-mapped destination is skipped, because the guard in
copy_mappedchecksVirtualQuery(...).State == MEM_COMMITand vkd3d-proton's mapped memory is not in Wine's virtual-memory bookkeeping.Environment
vkd3d-proton-bin); AMD Radeon RX 9060 XT (RADV 26.3.1).main7d33c46:cargo xwin build/test --release --target x86_64-pc-windows-msvc(cargo-xwin 0.24.1, rustc 1.98.1).victory.toml(synthetic tests only).Reproducer
victory_gpu-*.exe resource::tests::buffer_data_reaches_the_host_texturefails:The rest of the crate's host-GPU tests pass: 36 passed, 3 failed (the other two are environment gaps, listed below).
Cause
HostList::run_deferredrunsStep::Copyasand
copy_mappedstarts withtexture::committed(crates/victory-gpu/src/texture.rs:260) walks the range withVirtualQueryand requiresMEM_COMMIT. In this environmentVirtualQueryon the staging upload buffer thatMaphanded out returns:so the copy is skipped and the texture keeps zeros. The address is a vkd3d-proton allocation (large mmap arena) that Wine's
VirtualQueryreports as free.Scope
copy_texture_region's staging path usesdefer_copy(crates/victory-gpu/src/list.rs:529), andcopy_buffer_region/copy_resourceuse the sameStep::Copyarm, so any deferred copy whose destination is host-mapped memory is exposed. On Windows the same guard readsMEM_COMMIT; this shows up only under Wine/vkd3d.Confirmed fix direction
Changing the
Step::Copycall locally to passtitle_dst = falsemakes the test pass under Wine:The flag also drives
watch::writing, so the real fix should distinguish a destination we mapped ourselves (the staging buffer fromHostList::upload/Host::upload_buffer, known committed) from title memory that needs the guard — a per-step flag or a registry of our mapped ranges — rather than flipping it globally.Other failures in the same run (environment, not this issue)
indirect::tests::argument_clamp_builds: Wine's builtind3dcompiler_47cannot compile the clamp shader —E5005: Method 'Load' is not defined on type 'RWByteAddressBuffer'. Under Wine this also drops indirect execution at runtime (clamp()returnsNone); a native Microsoftd3dcompiler_47.dllin the prefix is the likely workaround.pipeline::library::tests::a_rejected_blob_gives_an_empty_library: vkd3d-proton returnsD3D12_ERROR_DRIVER_VERSION_MISMATCH(0x887E0002) for the damaged blob (expected) andE_INVALIDARG(0x80070057) for the empty library, soopen()returnsNone. The runtime handles that (no pipeline cache), only the test's expectation differs.No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).
@arthurprudenteres on GitHub · 2026-11-24 00:55 UTC · original
I'd like to take this issue. I will focus on deferred host upload destinations in
crates/victory-gpu/src/host.rsandlist.rs, with synthetic copy coverage in the GPU crate. The reported texture-upload path uses a staging allocation owned by the host list. I will verify how the buffer-copy callers choose their destinations and preserve the existing commitment checks and write tracking for title-memory destinations. I will post Windows and Wine/vkd3d validation results separately.@arthurprudenteres on GitHub · 2026-11-24 01:02 UTC · original
The texture staging allocation already has the destination-specific operation it needs:
HostList::defer_fillwrites to mapped upload memory before execution and uses the same source-read path asdefer_copy. The two buffer-to-buffer call sites obtain their destinations from title resources and should keepdefer_copy.I am testing the existing buffer-to-texture readback fixture on Windows against a validation-only forced negative commitment result. The upstream test build also has the duplicate module reported in #129; the name change will be local to validation. I do not have a Wine/vkd3d runtime on this Windows machine.
@LaunchDoesntCode on GitHub · 2026-11-24 01:03 UTC · original
Wine/vkd3d validation for the
defer_filldirection described above, since that runtime is the missing piece.Setup:
mainatd2a4bae, cross-built forx86_64-pc-windows-msvcon Linux Mint, run under Proton 10.0 (wine-10.0, its vkd3d-proton and DXVK dxgi), NVIDIA RTX 5090, driver 595.99.2.Change tested: only the buffer-to-texture staging path in
copy_texture_region(crates/victory-gpu/src/list.rs) switched fromdefer_copytodefer_fill; the two buffer-to-buffer call sites untouched.cargo test -p victory-gpu --lib:mainresource::tests::buffer_data_reaches_the_host_texturegoes from failing (row 0 all zeros) to passing. The two that still fail are the environment gaps already listed in this issue (indirect::tests::argument_clamp_builds,pipeline::library::tests::a_rejected_blob_gives_an_empty_library).The one-line commit is at
LaunchDoesntCode/VIctory@d5447c8(branchfix/wine-deferred-copy) if it is useful to pick up or compare against. I have not opened a pull request since this issue is claimed; happy to if that helps.Not tested here: Windows, and the title itself. No game data used. AI-assisted (Claude Code).
@DaviTostes on GitHub · 2026-11-24 01:04 UTC · original
Extra evidence that this is specific to vkd3d-proton's memory mapping, not to mapped memory in general:
victory_gpusuite passes 52/52, includingresource::tests::buffer_data_reaches_the_host_texture.d3dcompiler_47(to remove the unrelated compiler gap) does not change it — 50 passed / 2 failed (this one plus the pipeline-library one).So
VirtualQuerydoes reportMEM_COMMITfor Wine's own D3D12 mappings; it is vkd3d-proton'sMapmemory that reads asMEM_FREE. The same suite also confirms the test passes as soon as the guard is skipped (title_dst = false).AI-assisted (DeepSeek V4.1 Flash coding agent).
@ghost on GitHub · 2026-11-24 07:35 UTC · original
An NVIDIA data point for this (the report above is on AMD/RADV), with two of the open fixes.
Setup:
d3dcompiler_47), vkd3d-proton 3.1.victory-gputests cross-built forx86_64-pc-windows-gnu(rustc 1.98.1),mainatd2a4bae.resource::tests::buffer_data_reaches_the_host_texture:main: fails with zeros, exactly as reported.main+ #680 (af22e5d): passes.main+ #322 (b58d198): passes.Whole
victory-gpusuite under this setup:main: 3 failures. This test, the argument clamp (#170), andpipeline::library::tests::a_rejected_blob_gives_an_empty_library.main+ #190 + #680 + #347: 43 passed, 0 failed, 1 ignored. #347 (197c7ac) fixes the pipeline-library test on vkd3d-proton.AI-assisted (Claude Code); the runs are mine.
@arthurprudenteres on GitHub · 2026-11-25 00:28 UTC · original
I confirmed the staging path distinction independently on Windows 11 build 26300.9974, Rust 1.98.1. In the synthetic buffer-to-texture readback, forcing the title-destination commitment check to reject the staging address left row 0 all zeros on WARP (exit 101). Changing only the upload call to
defer_fillrestored the expected bytes on WARP and RTX 5060 Ti (621.24), both exit 0. With the forced result removed, the diagnostics workspace on the original base plus the local test-module rename passed 267 tests (4 ignored).I found #680 already merged with that same upload routing. The Proton runs above cover that runtime, so this is supplemental Windows evidence. I did not open a duplicate PR. AI-assisted.