GPU: castable formats the host has #2101
No reviewers
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!2101
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2101"
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?
@Deilach on GitHub · 2026-11-25 04:59 UTC · original
Deilach:linux-castable-formats→main· +71 −3 · 1 files · 1 commits · openWhat
Under Wine and Proton, which run D3D12 on Vulkan through vkd3d-proton, the first castable colour texture logs:
With
VKD3D_DEBUG=warn, vkd3d-proton gives the reason:d3d12_resource_validate_usage: Unrecognized format #59. The number is hex, so this is format 89,R10G10B10_XR_BIAS_A2_UNORM. vkd3d-proton has no mapping for it; it's the only one of the 21 formatscastable(28)lists that's missing from its format table. One unknown format refuses the whole list. Every colour texture of that element is then made without castable formats, and title textures of one memory in other formats get their own host textures, bridged by copies.Change
make_texturekeeps only the castable formats the host reports support for:CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)with a non-zeroSupport1, asked once per format and cached. A host that has every format, as Windows drivers do, keeps exactly the lists it has today. A host missing one loses only that format, not every list.Tests
resource::tests::a_colour_target_is_castable_to_the_formats_the_host_has. A 256×256R8G8B8A8_UNORMrender target with unordered access is made castable to the formats of its element that the host has. Under vkd3d-proton it fails onmain, with the warning above, and passes with this change.draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view. That is the case castable formats exist for.In the title, from VIctory's own texture counters in the log, comparing a world run before and after on the same Linux setup:
mainvictory-gputests on Linux, Wine 11.22 + vkd3d-proton master on RADV, RX 9070 XT:main130 ok / 12 failed, this branch 131 ok / 12 failed. The differences are the two tests above, plusdraw::tests::a_depth_texture_written_through_unordered_views_reads_as_depth, which fails onmainhere too when run alone (5 of 5).cargo clippy --workspace --all-targets [--all-features] -- -D warningsis clean.🤖 Generated with Claude Code
@upipibi on GitHub · 2026-11-25 05:05 UTC · original
Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at
4d8c89a.victory-gpu: 142 passed, 2 failed, 2 ignored. The newa_colour_target_is_castable_to_the_formats_the_host_haspasses. The 2 failures are #1744's heap-cap failures onmain. Same asmainon this hardware (native D3D12, so not the vkd3d-proton case this PR is about).AI-assisted (Claude Code).
@fiestorra on GitHub · 2026-11-25 05:46 UTC · original
Reviewed the
Support1 != 0choice by measuring it: it is the right one, and here is the trap it walks pastI checked the two things a review of this change can check on hardware rather than by reading: whether the filter leaves the Windows lists exactly as they are, and whether the stricter test would have.
On this machine (RTX 4090, driver
32.0.16.2124), for the 21 formatscastable(28)lists:Support1 != D3D12_FORMAT_SUPPORT1_NONE(what this PR uses)Support1 & CAST_WITHIN_BIT_LAYOUT(0x8000)So the claim in the description holds here — a host that has every format keeps exactly today's lists — and it holds because the test is the loose one. The eight that the cast bit would have dropped are
which is exactly the trap:
CAST_WITHIN_BIT_LAYOUTis the bit that says "this format may be cast to within its bit layout", and on this driver eight formats of the very list that is being filtered do not carry it while the host does make them castable in practice. Tightening the predicate later — and it reads like the tidier choice — would silently take 21 formats down to 13 on Windows, which is the opposite of what this change is for.Suggestion, and it is only documentation: say that in
host_has's comment, in the terms above. Something like "asked whether the host knows the format at all, not whether it can be cast: on Windows drivers 8 of the 21 formats ofcastable(28)do not carryCAST_WITHIN_BIT_LAYOUTand are still castable in practice, so the strict bit would halve the list". The code is right; the next person to "improve" it needs the number, not the principle.Two smaller things, both checked:
castable()iterates1..=115, so theHAS.get(format as usize)fallback tofalsecannot be reached by a format from this path. (I looked, because a fixed table with a silentfalseoutside its range is the kind of thing that bites later.)CheckFeatureSupportfor a format, for typed UAVs) is clean and builds — I tried it, in that order. Both ask the device once per format and cache; if the two caches are ever unified, that is a tidy-up for later and not a reason to hold either.What I did not check: the Wine/Proton path, because this machine has no vkd3d-proton. The bug report and the fix are consistent with what vkd3d does (an unknown format refuses the whole
EnhancedBarriersSupportedFormatslist), and I have no way to reproduce it here — so on that half I am reading, not measuring, and saying so.No game data is involved: format numbers and support masks.
Written with an AI assistant.
@Marvisak on GitHub · 2026-11-25 10:38 UTC · original
Automated triage for the maintainers.
In
resource.rs,make_texturenow passes only the castable formats the host reports.host_hasasksCheckFeatureSupport(FORMAT_SUPPORT)withSupport1 != NONEand caches the answer per format. Before, one unknown format (89 on vkd3d-proton) made the host refuse the whole list.takesalready readst.castable, so texture sharing follows the filtered list. On Windows drivers it is a no-op: a commenter measured 21 of 21 formats kept on an RTX 4090. The 128-entry cache coverscastable's1..=115. The motivation is Wine/Proton, but the code is host-neutral and adds no platform-specific path. CI has not run on this head.Generated by Claude Code
@0xKaji on GitHub · 2026-11-25 19:40 UTC · original
Tested on Linux + Wine 11.22 + vkd3d-proton + NVIDIA RTX 3060 in Series S mode:
title textures sharing one 5).CreateCommittedResource3still fails withE_INVALIDARG (0x80070057)on3840x2160 format 28 flags 5(the host refuses castable formats). Undervkd3d-proton, some format incastable(28)likely reportsTEXTURE2Dsupport while lackingRENDER_TARGET | UNORDERED_ACCESSsupport whenflags & 5is requested.@fuzeofficlal on GitHub · 2026-11-25 19:54 UTC · original
Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and review of
4d8c89a8(on13f91ca):Verification (
rustc 1.98.1MSVC)cargo xtask policy: 184 files ok;cargo clippy --locked -p victory-gpu --all-targets(default &--features diagnostics): 0 warnings.VICTORY_D3D12_WARP=1,--features diagnostics --test-threads=1): 199 passed, 0 failed, 1 ignored (includinga_colour_target_is_castable_to_the_formats_the_host_has).resource::tests18 passed, 0 failed (includinga_colour_target_is_castable_to_the_formats_the_host_has);draw::tests11 passed.git merge-treewith #1406, #2462, and #2679.Review Notes
[AtomicU8; 128]cache (host_has) is bounds-safe over1..=115and thread-safe for the singleton host device, while keeping Windows castable formats intact (Support1 != NONEavoids dropping formats that Windows drivers accept for casting).@Kajanos on GitHub · 2026-11-25 20:43 UTC · original
NVIDIA + vkd3d-proton unit-test run, head
4d8c89a86amerged ontomain13f91caee2.Setup: Linux (Gentoo) / wine-proton 11.0.3 / vkd3d-proton 3.1, RTX 5080, NVIDIA 620.73.04; cross-built with cargo-xwin, rustc 1.98.1, native
d3dcompiler_47.main,draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_viewfails here (round 0: a placed texture). With this PR it passes in every run.victory-gpusuite 5 times: 191–192 passed. The remaining failures all also fail onmainin this environment:descriptor::host::…dynamic_slots_are_held_until_releasedandmemory::…lists_share_a_table_and_copies_keep_their_views(the vkd3d-proton heap is smaller thanHEAP_VIEWS)pipeline::librarytests (fixed by #1722)shadow::tests::marked_pages_go_back_by_the_bytes_the_gpu_changedalso failed. It passed 5/5 when run alone and 4 more full runs, and this PR doesn't touch that code, so it looks like a timing flake and not a regression.Not run: the retail title or Windows.
AI-assisted (Claude Code)
@arogan178 on GitHub · 2026-11-25 23:42 UTC · original
Verified on RDNA 4 under Proton:
draw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_viewfails onmain("round 0: one host texture") and passes with this PR.Setup: RX 9070 XT, RADV (Mesa 27.0-devel), Proton-CachyOS 11.0 with vkd3d-proton 3.2.0 from Proton Experimental, Windows SDK
d3dcompiler_4710.0.26100.victory-gpulib tests cross-built forx86_64-pc-windows-msvcfrommainat63bcca4merged with #1722 and #2101 (both merge cleanly): 232 passed, 0 failed.mainalone: 228 passed, 3 failed, the three named in these two PRs.@neonbyte1 on GitHub · 2026-11-26 01:52 UTC · original
On NVIDIA under Wine this is what lights the scene. RTX 5090 (driver 620.73.04), Linux, Wine 11.22, vkd3d-proton 3.1-83 (GE-Proton11-14), DXVK
dxgi. The base ismain219878aplus #2723, #1129, #1548, #233, #320, #439, #2118, #2703 and a Wine-compilable argument clamp (#2969).vkd3d-proton has no
R10G10B10_XR_BIAS_A2, so it refused every castable list VIctory passed (the host refuses castable formats, once at start). Without the list, the R9G9B9E5 textures with only the unordered-access flag can't be made at all: 51no host texture … format: 67 … flags: 4per run. These are the screen-probe GI resolve targets (three 2560x1440) and the light-probe textures. The GI resolve writes them through R32_UINT views, so they need the shared castable texture. With their writes lost, tiled deferred lighting read zeros, and the presented frame was black except emissive surfaces.no host texturelines (format 67)refuses castable formatsThe prison yard at dusk is now lit through the cell window, for the first time on this setup. One run each, 7 and 12 minutes, no crash or Xid.
AI-assisted (Claude); measured on my machine, no game data shared.
@catminou4 on GitHub · 2026-11-25 05:02 UTC · original · reviewed
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Castable formats the host has — format-cast gating by host caps; pairs with the capability-gating cluster (#1775/#1787/#1801/#1832/#1843).
@fuzeofficlal on GitHub · 2026-11-26 13:09 UTC · original · approved these changes
Reviewed and verified
4d8c89a8merged locally ontoorigin/main(63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust1.98.1MSVC, Windows SDK10.0.26100.0dxil.dll; synthetic tests only, no game files).Verification
git merge-treeagainstorigin/main(63bcca43): clean.cargo xtask policy(PR head):182 files ok.cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--all-features, PR head and merged): 0 warnings.VICTORY_D3D12_DEBUG=1,--features diagnostics):resource::tests+draw::tests— 39 passed, 0 failed (includinga_colour_target_is_castable_to_the_formats_the_host_hasanda_texture_written_in_one_format_reads_in_another_through_a_placed_view).VICTORY_D3D12_WARP=1,VICTORY_D3D12_DEBUG=1,--features diagnostics):resource::tests+draw::tests— 39 passed, 0 failed.castable(28):Support1 != D3D12_FORMAT_SUPPORT1_NONEkeeps 21/21 on both RTX 5090 and WARP; requiringCAST_WITHIN_BIT_LAYOUTwould drop26(R11G11B10_FLOAT) and67(R9G9B9E5_SHAREDEXP) (19/21).castable(67):Support1 != NONEkeeps 21/21 on both adapters vs20/21(26dropped) withCAST_WITHIN_BIT_LAYOUT.Review Notes
host_has(crates/victory-gpu/src/resource.rs:1172-1201) uses a lock-free[AtomicU8; 128]cache coveringcastable()'s entire1..=115range cleanly, and filtering viacastable_formats.retain(|&f| host_has(host, f))(:1228) preserves all native Windows castable lists while preventing a single unsupported format from failingCreateCommittedResource3whole.a_colour_target_is_castable_to_the_formats_the_host_has(crates/victory-gpu/src/resource.rs:1897-1922) assumesID3D12Device10is present (t.castableis empty on Windows 10 without Agility SDK).#2389,#2389adds a 4thon_demand: boolparameter tomake_texture, so line 1915 in the new test will need, false.Looks good to merge.
maincan take merges more often #3347View 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.