GPU: check typed buffer format support before creating descriptors #74
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!74
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-74"
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?
@mattiolocoding on GitHub · 2026-11-27 16:34 UTC · original
mattiolocoding:fix/typed-buffer-format-support→main· +121 −8 · 1 files · 1 commits · merged 2026-11-28 19:01 UTCA typed buffer view can fit its allocation and still use a format the host cannot expose as a buffer. On an RTX 3060 Ti,
buffer_view_ok(R8G8B8A8_UNORM_SRGB, 0, 16, 0, false, 4096)currently returns true even though the device reports noD3D12_FORMAT_SUPPORT1_BUFFERfor that format. Both buffer creation paths rely on this guard before calling the void D3D12 descriptor creation methods.This extends the guard with the host's format capabilities:
BUFFER; typed UAVs require bothBUFFERandTYPED_UNORDERED_ACCESS_VIEW.CheckFeatureSupport, cached with a per-formatOnceLock. Failed queries reject the view.The capability flags are documented in D3D12_FORMAT_SUPPORT1; the format support tables list sRGB and depth examples without buffer support. Unsupported typed formats still need conversion support to render their contents; this change keeps their descriptors away from the driver.
Validation on Windows 11, RTX 3060 Ti 8 GB, driver 617.14, Rust 1.98.1, based on
d12eb1b:formats_without_buffer_support_fail_the_host_checkfails withformat 29 has no buffer support, but its view passed validation.descriptor::host::tests::tests pass, including three new tests for unsupported buffer formats, SRV versus UAV capabilities, and valid typed views and their bounds. Hardware checks ran; the regression did not skip for lack of a device.diagnostics,blake3/pure. Command:cargo test --locked --release -p victory-gpu --features diagnostics,blake3/pure --lib descriptor::host::tests:: -- --test-threads=1.cargo clippy --locked --release -p victory-gpu --all-targets --features diagnostics,blake3/pure --message-format=json --no-depscompletes. Base and branch have exactly the same 59 warning diagnostics (28 unique), compared by message, lint code and primary source file. No warnings added; the base's existing warnings remain relevant to CI's-D warningssetting.cargo run --locked --release -p xtask -- policypasses;git diff --checkpasses.Only synthetic tests and interoperability constants are added. No game files or derived assets are included. AI-assisted with Codex.
@Kal0s-design on GitHub · 2026-11-27 17:24 UTC · original
Verified on NVIDIA (real D3D12 device, pinned 1.98.1 toolchain, offline build).
The PR touches one file, so I took its
crates/victory-gpu/src/descriptor/host.rsonto current main (29d8dbf). That file is unchanged on main since the branch point (1124487), so it applies clean.Tests (
cargo test -p victory-gpu --lib descriptor::host::tests::): 50/50 pass, including the three new ones (formats_without_buffer_support_fail_the_host_check,a_srv_buffer_format_is_not_necessarily_a_uav_format,supported_typed_buffer_views_stay_available) and the updatedbuffer_view_oksignature test.Sensitivity: dropping just the new format-support clause (so
buffer_view_okbehaves as before) fails two of those tests on this device, so the over-acceptance is not only on the 3060 Ti in the description:R8G8B8A8_UNORM_SRGB(format 29) reports noD3D12_FORMAT_SUPPORT1_BUFFERhere, yet the old guard accepted a typed SRV for it.R32G32B32_FLOATreportsBUFFERbut notTYPED_UNORDERED_ACCESS_VIEWon this device, so the old guard accepted a typed UAV it should refuse. The newuavflag draws that line.supported_typed_buffer_views_stay_availablepasses, so supported formats are untouched.One note, not a blocker:
cargo clippy -p victory-gpu --all-targets -- -D warningsis already red on plain main (39 warnings, all in other files). This change adds none (same 39 with and without it), so it is not clippy-clean through no fault of this PR.Not covered: the in-game path (no game data here), the WARP/software adapter, and concurrent first-touch of the per-format
OnceLockcache.AI-assisted: yes.
@fladit123 on GitHub · 2026-11-27 19:43 UTC · original · approved these changes
APPROVE
Thanks for addressing typed buffer format validation. I independently reviewed and tested the pinned revisions on an RTX 4060 and WARP, extending the previous validation to software-adapter coverage, concurrent cache initialization, and numerical readbacks through the actual descriptor writers.
Reviewed HEAD:
1124487ce19f5c5c4912983f7e15534e4a66aa86.Baseline:
d12eb1b23da4cad2f551a3dd49e82a87e564122a.Validation
Adapter identity was verified through the actual D3D12 device LUID in the instrumented runs.
The format matrix covered all 107 IDs known to
resource::element, producing 428 records across both revisions and adapters.Accepted typed formats:
The candidate's decisions matched the expected capability masks throughout the tested matrix.
Production-path correctness
The capability cache queries the same process-owned D3D12 device that creates the descriptors.
Three representative unsupported requests per adapter reached the actual descriptor writers and returned before native descriptor creation.
All 26 synthetic readbacks matched their CPU references, including:
Raw and structured views retained their existing behavior.
Concurrent initialization
Eight threads contended on four previously untouched format-cache slots per adapter, including an unsupported format.
Each slot produced exactly one native capability query, followed by 160,000 successful warm lookups per adapter in total.
The isolated warm-cache lookup median was approximately 19.48 ns on the RTX 4060 and 21.15 ns on WARP in the instrumented debug build.
These measurements are not end-to-end performance or FPS claims.
Non-blocking follow-up
Format ID 191 has different semantics in the console element table and native DXGI: four bytes versus two bytes for
A4B4G4R4_UNORM.WARP reports support for its native format, while the baseline already accepts this numeric alias. Correct format translation should be investigated separately. Its numerical consequences were not tested here.
Conclusion
No blocking regression was found in the tested scope.
The PR correctly introduces device-specific typed buffer validation while preserving the existing raw and structured paths.
Hardware: RTX 4060, driver 610.88, Windows 11, 32 GB RAM; Microsoft WARP.
All experiments used synthetic graphics workloads only. No game files or execution.
AI-assisted review and testing using OpenAI ChatGPT and Codex.