GPU: no render target view of a format the driver refuses while reporting support #2305
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!2305
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2305"
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?
@fiestorra on GitHub · 2026-11-25 10:10 UTC · original
fiestorra:gpu/rtv-the-vendor-refuses→main· +80 −0 · 1 files · 1 commits · closed without mergingA 1440p
B4G4R4A4_UNORMrender target removes the device, and the support query says it should notWith
VICTORY_D3D12_DEBUG=1andVICTORY_D3D12_DRED=1on an RTX 4090 (32.0.16.2124), the debug layer names the call that ends a run (issue #1952):The obvious guard — refuse the view when
CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)does not reportRENDER_TARGET— does not work here, and I measured why before writing this:So the query is kept for the formats it answers honestly, and a second, vendor-aware refusal covers the case it gets wrong: NVIDIA reports the format as a target and then refuses the view, while AMD takes it (that is the card on which the same title reaches the lit world).
Change:
Hostkeeps the adapter'sVendorId(read fromIDXGIDevice::GetAdapteronce, at creation — the only other use of a vendor id in this file is a diagnostic inwarp_adapter), andrtvasks two things before creating a view:refuses_target(vendor, format): NVIDIA andB4G4R4A4_UNORM— the measured case;takes_render_target(format): the support query, for formats that answer honestly.When either says no, the slot is filled with a null view and the draw goes nowhere, which costs the target and keeps the device and the run. A warning names the format and the vendor on the first refusal of each format.
Verification
--features diagnostics);--all-featuresunder-D warnings;rustfmt --checkshows the same 45 hunksmainalready has in this file and no new one;no render target of this format on this host: a null view.No game data is involved: format numbers, a vendor id, an HRESULT and debug-layer text.
Written with an AI assistant.
@fiestorra on GitHub · 2026-11-25 10:28 UTC · original
A risk I want on the record before this lands: a null view of the 1440p target can turn a crash into a black screen
While tracing where the refused format comes from, I found that
host_descasks the host for format 115 unchanged —pc_formatonly stands in for 118/119/120 — so this 1440p render target reaches D3D12 asB4G4R4A4_UNORM, which NVIDIA refuses.That means the target this pull request turns into a null view is very plausibly the title's scene target (2560×1440, flags
RENDER_TARGET). With the guard, the draw goes nowhere instead of the device dying. For a run, that is better — it survives and can be diagnosed. For a picture, it is not a fix: it can be the black screen the operator reports after the intro (audio and subtitles, no image — issues #904, #1119, #850).So I want this merged as what it is: a run-keeper, not a renderer, and the description now says so. The picture needs a real stand-in for format 115 in
pc_format, which changes the element size (2 bytes per texel today, 4 forR8G8B8A8_UNORM) and therefore the host footprint and every copy of that resource — the same problem the texture ladder in #1630 handles for the other formats, and not a table row.Two consequences I accept, and one I do not want:
If it is preferred that the guard not land before the stand-in, I will hold it; the mechanism and the measurement are in #1952 either way, and a closed pull request with the analysis is worth more than an open one that misleads.
No game data is involved: a format number and code.
Written with an AI assistant.
@Marvisak on GitHub · 2026-11-25 15:22 UTC · original · edited 2026-11-26 03:19 UTC
Automated triage for the maintainers.
Verdict: needs work. Re-reviewed at
d41e177, which now merges cleanly intomain. The fallback inHost::rtv(crates/victory-gpu/src/host.rs) callsCreateRenderTargetView(None, None, handle). D3D12 only accepts a null resource when a view description is given, so this call is itself invalid. KainanP's RTX 4060 run in this thread confirms it: the B4G4R4A4 case still removes the device. A null view needs aD3D12_RENDER_TARGET_VIEW_DESCwith a supported format and the rightViewDimension. artor410 also reports that on an RTX 3070 Ti the support query already refuses format 115, sorefuses_target's fixed NVIDIA + 115 rule needs evidence from more drivers, or it should be dropped in favour of the query.As you say in your own follow-up, a null target only keeps the run alive. Several open PRs widen packed 16-bit targets to a format the host can render instead (#2626, #2767, #2936). Please check whether one of them already covers #1952. If it does, this PR may not be needed.
CI: passing.
Generated by Claude Code
@KainanP on GitHub · 2026-11-25 19:36 UTC · original
RTX 4060 Laptop (610.47), merged onto main
13f91cae(adjacent-test conflict, kept both): the B4G4R4A4 half still removes the device, because the null viewCreateRenderTargetView(None, None, ..)(null resource and null description) is itself an invalid call; the UAV half is unchanged; no new failures. Details and the side-by-side table with the other #1753 PRs: #1753. Tested with the help of an AI assistant (Claude Code).@artor410 on GitHub · 2026-11-25 21:53 UTC · original
Tested on RTX 3070 Ti, driver 610.88, Windows 11 26300, rustc 1.98.1. main
13f91ca. Does not merge into main (conflicts inhost.rs), so only the head dbce84b was tested.cargo test -p victory-gpuon the head: 142 passed, 2 failed (the same heap-cap pair as on main), 2 ignored. Newa_format_a_vendor_refuses_is_known_before_the_view_is_madepasses.CheckFeatureSupporton this card reports no RENDER_TARGET for 115, so the query alone catches it here and the NVIDIA vendor special case is not needed.(Claude Code, Claude Opus 5.5.)
@catminou4 on GitHub · 2026-11-25 10:19 UTC · original · reviewed
No render target view of a format the driver refuses while its support query says it takes it (vendor-id check, #1952). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Vendor workaround tied to issue #1952.
@DenRakEiw on GitHub · 2026-11-25 10:21 UTC · original · approved these changes
Verified against
origin/main(940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:refuses_target(self.vendor, ...)(for NVIDIAB4G4R4A4_UNORM#1952) andtakes_render_targetbeforeCreateRenderTargetView, falling back to a null RTV when unsupported, avoids device removal without penalizing vendors that support the format.cargo test -p victory-gpu host::tests: all 7/7host::tests::*passed on RTX 5090 and 7/7 on WARP (only the pre-existing NVIDIA #1744 baseline failure indescriptor::host::tests::dynamic_slots_are_held_until_releasedmatched the substring).cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.AI-assisted (Gemini 4 Neon).
@fiestorra on GitHub · 2026-11-26 12:22 UTC · original
Closed into #2332, which now carries both halves
You are right that a null target only keeps the run alive, and the two branches were the same cluster: #2332 now asks the host first (does it refuse
B4G4R4A4_UNORMas a target, does it takeB5G5R5A1_UNORM) and makes the texture as the stand-in only then, so a refused target is a real view where the host takes one. The guard this branch added (Host::rtv→ null view with a warning) is kept there as the last resort for a format neither is taken.So there is one place that decides the format (
stand_in_forinhost.rs, called fromhost_desc) and one that decides the view (Host::rtv), instead of two PRs racing to describe the same texture.Head of the surviving branch: #2332 at
31848207.Written with an AI assistant.
Pull request closed