Repository navigation
GPU: a title buffer view takes a format the host takes, or stays null - #2873
0xkn0wh3r3 wants to merge 2 commits into
Conversation
Title buffer views reached CreateShaderResourceView and
CreateUnorderedAccessView with the title's own format. The title's heap
holds views the host refuses: made for its own runtime, or old ones in
slots it does not use. On WARP with the debug layer:
- a raw view of R32_UINT: "When creating a RAW Shader Resource View,
the format must be DXGI_FORMAT_R32_TYPELESS", then device removal
(DXGI_ERROR_INVALID_CALL) for the shader resource view;
- a structured view with a format: "it must be DXGI_FORMAT_UNKNOWN";
- a typed view of a typeless format: "cannot be used when creating a
typed View of a Buffer".
A raw or structured view reads its bytes whatever its format says, so it
is now made in the format the host wants (R32_TYPELESS, UNKNOWN); a raw
view with a structure stride, or a typed view of no format or a typeless
one, has none and stays null, with a warning once. Structure strides are
left as they are (2, 6 and 4096 are taken by the debug layer).
Test: buffer_views_take_a_format_the_host_takes.
From DexNom/VIctory@570a941
(buffer_view_ok in descriptor/host.rs), reworked: views are corrected
where their bytes do not depend on the format instead of refused, and
the stride limits and the raw 16-byte start, which the debug layer does
not ask for or which Marvisak#123 covers, are left out.
Co-authored-by: DexNom <29156494+DexNom@users.noreply.github.com>
kotekompotek
left a comment
There was a problem hiding this comment.
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.
AwsAli05
left a comment
There was a problem hiding this comment.
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 no D3D12_FORMAT_SUPPORT1_BUFFER for BC1_UNORM. At 0c714c5, the new helper returns Some(BC1_UNORM) for a typed view, and element() 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.
|
Reviewed and verified
Looks clean and ready to merge. |
Review: a typed title buffer view of a format the device's buffer views do not take (block-compressed, depth, sRGB...: BC1_UNORM has no D3D12_FORMAT_SUPPORT1_BUFFER) still reached the device. The typed path now asks the device, once a format and kind: a shader view needs buffer and shader-load support, an unordered view buffer and typed unordered-access support; a view without stays null. Test: typed_buffer_views_take_only_formats_the_device_buffers_take (R32_UINT taken, BC1_UNORM and D32_FLOAT refused, shader and unordered alike; R8G8B8A8_UNORM taken for shader views).
GPU: typed buffer views take only formats the device's buffer views take
…o demo (its update applied)
|
Automated triage for the maintainers. Merge candidate. CI: passing. Generated by Claude Code |
… takes, or stays null
Dukestar69
left a comment
There was a problem hiding this comment.
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).
fuzeofficlal
left a comment
There was a problem hiding this comment.
Verified 5bd7e1c9 locally on Windows 11 (RTX 5090 and WARP, with VICTORY_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, rejecting stride > 0), structured (DXGI_FORMAT_UNKNOWN), and typed (BUFFER + SHADER_LOAD / TYPED_UNORDERED_ACCESS_VIEW, rejecting UNKNOWN and typeless formats) rules match D3D12 requirements cleanly.
Two minor non-blocking nits:
- Running
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.
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 GPU: page view heaps a host caps below the slots shaders index #2121.cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without--features diagnostics: clean.Not tested
Changes after review
D3D12_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.