GPU: validate RTV and DSV dimensions, ranges, formats, and flags #3205
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!3205
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3205"
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?
@fuzeofficlal on GitHub · 2026-11-26 12:42 UTC · original
fuzeofficlal:fix/gpu-validate-rtv-dsv→main· +670 −8 · 3 files · 1 commits · openSummary
Host::rtvandHost::dsvpreviously forwarded title-supplied render target and depth-stencil view descriptions directly toID3D12Device::CreateRenderTargetViewandID3D12Device::CreateDepthStencilViewwithout validating resource flags, formats, view dimensions, mip/slice/plane ranges, or DSV flags.Because both D3D12 view creation methods return
void, an invalid RTV or DSV description permanently removes the retail D3D12 device (GetDeviceRemovedReason() == DXGI_ERROR_INVALID_CALL/0x887A0001) even without the debug layer enabled, aborting the process on the next submission.What Changed
crates/victory-gpu/src/host.rs:Host::try_rtvandHost::try_dsvbacked byrtv_fits,dsv_fits, cachedrenders_format(D3D12_FEATURE_FORMAT_SUPPORT/D3D12_FORMAT_SUPPORT1_RENDER_TARGET), cachedformat_planes(D3D12_FEATURE_FORMAT_INFO), and overflow-freeview_range_fits(supporting D3D12'su32::MAXremaining-range sentinel).ALLOW_RENDER_TARGET/ALLOW_DEPTH_STENCIL, format compatibility (rejecting typeless/unsupported view formats,None/UNKNOWNon typeless textures, and non-depth or cross-family DSV formats, while preservingID3D12Device10castable-format RTVs),ViewDimensionvs resourceDimensionandSampleDesc.Count,MipSlice, array slice ranges, mip-scaled 3D RTV W-slice ranges, RTVPlaneSlice, andD3D12_DSV_FLAGS(rejecting unknown flag bits andD3D12_DSV_FLAG_READ_ONLY_STENCILon depth-only formats without stencil).crates/victory-gpu/src/draw.rs&crates/victory-gpu/src/list.rs:State::set_targets,list::clear_rtv, andlist::clear_dsvthroughHost::try_rtvandHost::try_dsv, avoiding invalid view creation and dead resource transitions when a view is refused.invalid_rtv_and_dsv_descriptions_are_refused_without_device_removalexercisingOMSetRenderTargets,ClearRenderTargetView, andClearDepthStencilViewacross 56 invalid and valid boundary RTV/DSV cases (including castable-format RTVs).Verification
main(63bcca43) — retail D3D12 permanently removed the device withDXGI_ERROR_INVALID_CALL (0x887A0001)and debug builds fatally aborted (exit code 2173) — and GREEN with the fix across retail hardware D3D12, hardware--features diagnosticswithVICTORY_D3D12_DEBUG=1, and WARP (VICTORY_D3D12_WARP=1) withVICTORY_D3D12_DEBUG=1.cargo test -p victory-gpu --libpassed across default hardware (231 passed), hardware diagnostics+debug (244 passed), and WARP diagnostics+debug (244 passed) runs.cargo clippy --workspace --all-targets --locked -- -D warnings(default and--all-features),rustfmt --edition 2024,git diff --check, andcargo run --locked -p xtask -- policyall passed.@Dukestar69 on GitHub · 2026-11-26 12:47 UTC · original · approved these changes
Verified on RTX 5090 against
origin/main(63bcca4):cargo test -p victory-gpu --lib list:: -- --test-threads=1: passed.cargo test -p victory-gpu --lib descriptor:: -- --test-threads=1 --skip dynamic_slots_are_held_until_released: 21/21 passed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly validates RTV and DSV dimensions, mip/array ranges, formats, and flags.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@oni-swr on GitHub · 2026-11-26 13:25 UTC · original
WARP test report (head
2ecc9ef, on top of current main63bcca4)Environment: Windows 11, WARP only (
VICTORY_D3D12_WARP=1with--features diagnostics, plusVICTORY_WARP=1), rustc/cargo 1.98.1.cargo test -p victory-gpu --lib --locked --features diagnostics -- --test-threads=1: 247 passed, 0 failed, 1 ignored, includinglist::tests::invalid_rtv_and_dsv_descriptions_are_refused_without_device_removal(all invalid RTV/DSV cases refused, all boundary cases accepted, device not removed, no CreateRenderTargetView/CreateDepthStencilView debug errors).try_rtv/try_dsvshims that callrtv/dsvunvalidated): FAILS atrtv_no_rt_flag(a resource without the render-target flag is accepted). So the test needs the validation. The shims are needed because the test callstry_rtv/try_dsvdirectly.Diff review: no blocking problem. Notes: the
TEXTURE2DMSview on a single-sample texture is treated as valid (rtv_2dms_on_s1); WARP and its validation accept it, but I could not check a hardware driver.renders_formatandformat_planescache per format in process-wide statics, which is fine with one host device.AI use: Claude Code (Claude Sonnet 5.5), coordinated by Claude Code (Claude Opus 5.5). Synthetic tests only; no game files, dumps, shader names or retail hashes.
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.