GPU: a title buffer view takes a format the host takes, or stays null #2871
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2873"
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 0xkn0wh3r3 on 2026-11-25T22:51:43Z.
What
Title buffer views reach
CreateShaderResourceViewandCreateUnorderedAccessViewwith the title's own format. The title's heap holds views the host refuses: views made for its own runtime, or old ones in slots it doesn't use. I checked with the D3D12 debug layer on WARP:R32_UINTDXGI_ERROR_INVALID_CALL) for the SRVhost_buffer_formatnow picks the host view's format:R32_TYPELESS,UNKNOWN).Structure strides are left alone, since the debug layer accepts any.
Where it came from
From DexNom's fork, DexNom/VIctory@570a941 (
buffer_view_okindescriptor/host.rs, which they link to a device removal in the title). It's credited withCo-authored-by: DexNomand reworked:Tested
descriptor::host::tests::buffer_views_take_a_format_the_host_takes.CreateShaderResourceView/CreateUnorderedAccessViewon a 64 KiB buffer. It isn't committed, because enabling the debug layer would affect every other device in the test process.cargo test -p victory-gpu(Windows 11, RTX 5070 Ti): 228 passed. The 2 known NVIDIA failures are fixed by #2121.cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without--features diagnostics: clean.Not tested
Changes after review
5bd7e1c: the typed path also asks the device, once per format and kind, whether its buffer views take the format. A shader view needs buffer and shader-load support; an unordered view needs buffer and typed unordered-access support. So block-compressed, depth and sRGB formats (BC1_UNORM has noD3D12_FORMAT_SUPPORT1_BUFFER) stay null. New testtyped_buffer_views_take_only_formats_the_device_buffers_take: R32_UINT is taken; BC1_UNORM and D32_FLOAT are refused for both kinds.cargo test -p victory-gpu: 229 passed, plus the 2 known NVIDIA failures.Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T22:53:15Z.
Review: COMMENTED
Correct D3D12 rules applied: raw views must be R32_TYPELESS with no stride, structured views must be DXGI_FORMAT_UNKNOWN, typed views need a real non-typeless format — and a refused view stays null rather than removing the device, which is exactly the right failure mode for views the title carries but doesn't use. The typeless test mirrors the family-check pattern used elsewhere. LGTM.
Imported from Marvisak/VIctory. Originally posted by AwsAli05 on 2026-11-25T23:04:41Z.
Review: COMMENTED
The raw and structured normalization looks useful. The typed branch still accepts a format the device explicitly declines for buffers. On the RTX 5070 Ti,
CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)reports noD3D12_FORMAT_SUPPORT1_BUFFERforBC1_UNORM. At0c714c5, the new helper returnsSome(BC1_UNORM)for a typed view, andelement()gives it a nonzero element size, so it can reach the native view call.Can the typed path gate on the device's buffer and corresponding SRV/UAV support, with a cached query or suitable allowlist? BC1 is a concrete rejection case to add alongside the current valid and typeless cases. Microsoft's D3D12 format requirements
AI-assisted review. I verified the helper result and device query with a local test.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:04:58Z.
Reviewed and verified
0c714c52on Windows 11 (RTX 5090 +VICTORY_D3D12_DEBUG=1+ WARP) againstmain(842b0cb):host_buffer_format(format, stride, raw)consistently guards bothbuffer_srvandbuffer_uav: raw views enforcestride == 0and rewrite toR32_TYPELESS, structured views rewrite toUNKNOWN, and typed views rejectUNKNOWN (0)and family typeless formats.descriptor::host::tests15/15 anddraw::tests20/20 passed;VICTORY_D3D12_DEBUG=1buffer_views_take_a_format_the_host_takespassed with 0 debug errors; WARPdraw::tests20/20 passed;cargo clippy --locked -p victory-gpu --all-targets(default &--features diagnostics) 0 warnings;cargo xtask policy(190 files ok).!raw && stride == 0), non-base typeless / depth / sRGB / BC formats (e.g.21R32_FLOAT_X8X24_TYPELESS,46,20/40/45,29/91,71..=84, or formats lackingTYPED_UAV) still pass thefamily(f) == f && family(f + 1) == fcheck if a title ever constructs one.Looks clean and ready to merge.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T04:26:50Z.
Automated triage for the maintainers.
Merge candidate.
buffer_srv/buffer_uavindescriptor/host.rsnow fix or refuse title buffer views in formats the host rejects: raw views becomeR32_TYPELESS, structured viewsUNKNOWN, and raw views with a stride or typed views with no, typeless or unsupported formats stay null, with support cached per format viaCheckFeatureSupport. These match the D3D12 view-creation rules and the debug-layer results listed. Note that #2885 also changesdescriptor/host.rs.CI: passing.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T10:08:06Z.
Review: APPROVED
Verified on RTX 5090 & WARP against
origin/main(63bcca4):cargo test -p victory-gpu --lib descriptor:: -- --test-threads=1 --skip dynamic_slots_are_held_until_released: 23/23 passed on RTX 5090 and WARP (includingbuffer_views_take_a_format_the_host_takesandtyped_buffer_views_take_only_formats_the_device_buffers_take).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly ensures typed buffer views only use formats supported by the host device, falling back to null otherwise.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T10:52:58Z.
Review: APPROVED
Verified
5bd7e1c9locally on Windows 11 (RTX 5090 and WARP, withVICTORY_D3D12_DEBUG=1):cargo xtask policyandcargo clippy -p victory-gpu --tests -- -D warnings(default and--all-features): clean.descriptor::tests (including both new testsbuffer_views_take_a_format_the_host_takesandtyped_buffer_views_take_only_formats_the_device_buffers_take): 23/23 passed on RTX 5090, RTX 5090 +VICTORY_D3D12_DEBUG=1, and WARP +VICTORY_D3D12_DEBUG=1(excluding the pre-existingdynamic_slots_are_held_until_releasedbaseline failure).draw::tests: 20/20 passed on RTX 5090 and WARP +VICTORY_D3D12_DEBUG=1.The raw (
R32_TYPELESS, rejectingstride > 0), structured (DXGI_FORMAT_UNKNOWN), and typed (BUFFER+SHADER_LOAD/TYPED_UNORDERED_ACCESS_VIEW, rejectingUNKNOWNand typeless formats) rules match D3D12 requirements cleanly.Two minor non-blocking nits:
host_buffer_formatbeforeshadow::for_viewinbuffer_srvandbuffer_uavwould avoid lazily creating a host shadow buffer / Arena slice for stale or unsupported buffer views that are immediately rejected.f.checked_add(1).is_some_and(|n| family(n) == f)inhost_buffer_formatavoids a debug overflow if it is ever called directly withDXGI_FORMAT(-1)(currently unreachable frombuffer_srv/buffer_uavsinceelement_sizerejects unknown formats first).Looks good to merge.
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.