GPU: render targets keep their slots (null views for targets the host cannot bind), and no RTV or clear without the render-target use #1612
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1613"
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 AgneyaK on 2026-11-24T19:47:09Z.
Two commits, rebased onto
main940d32f. The second one (added 2026-11-25) makes this useful onmainby itself, not only with #55.1. Render targets keep their slots (
736fa79, useful onmainnow)State::set_targetsskipped a target it couldn't bind (continue): one with no recorded view, or one with no host texture. Every later target then moved down a slot, so a draw'sSV_Target1landed in the texture bound as target 0, and so on.maintoday. The title's 2560x1440B4G4R4A4_UNORM(format 115) render target is refused by the host (no host texture, #1754 / #1758 / #1781 / #1952), so any pass that binds it before other targets writes them to the wrong outputs.Now every such slot gets a null view and keeps its position: no recorded view, no host texture, a typed null view, or a copy made without the render-target use (part 2).
The null view's format (the triage question): it now takes the title's view format where the host renders to that format (
host::renders_format,D3D12_FORMAT_SUPPORT1_RENDER_TARGET, asked once per format). So it matches the pipeline'sRTVFormatsfor the slot. Only where the host can't render the format at all (or there's no record) is itR8G8B8A8_UNORM. In that case the pipeline with that format is refused by the host anyway, so no draw pairs the two.2. No RTV, barrier or clear for a copy without the render-target use (
7b8c8e3, needed by #55)#55 makes a host texture without a use the host refuses, which on NVIDIA hits format 115 as a render target. The title still clears that texture and binds it, and
host.rtv, the barrier toRENDER_TARGETandClearRenderTargetVieware invalid calls on a resource withoutALLOW_RENDER_TARGET. With #55 on an RTX 3050, 3 of 3 runs lost the device 1:41–1:58 in (The application made a call that is invalid); with this, two runs had no invalid call (5:51 and 8:37). Details: https://github.com/Marvisak/VIctory/pull/55#issuecomment-7138320867host::renders_to(texture): whether the host copy hasALLOW_RENDER_TARGET.set_targetsbinds a null view for it (part 1).Tested (on
940d32f+ this)a_target_that_cannot_be_bound_keeps_the_others_in_their_slots: a pipeline writesSV_Target0red andSV_Target1green, slot 0 can't be bound, and the slot-1 texture is read back.--features diagnostics,VICTORY_D3D12_WARP=1) and the RTX 3050 6 GB (with a local adapter patch, not in this PR).main'sset_targetsit fails in both cases:left: [1.0, 0.0, 0.0, 1.0](red),right: [0.0, 1.0, 0.0, 1.0].cargo test -p victory-gpu --locked: 141 passed, 3 failed. The 3 fail onmainthe same way on this Intel iGPU: the 2 heap-cap tests of #1744, and the castable test #1765 fixes.cargo clippy --workspace --all-targets --locked -- -D warnings, and with--all-features: clean.cargo xtask policy: ok.main+ #1763 (NVIDIA stops at boot without it, #1754) + this, diag build, 55 s from launch. No device removal (frame 611). The refused format-115 texture appears (no host texture), but it isn't bound as a target within 55 s, so the null-view path didn't run in the title there. This laptop can't go further safely (it runs out of memory in the story load).Not tested: the debug layer (not installed here), so whether it has an opinion on a format-matched null view isn't checked; AMD, where nothing is refused, so the new paths only run for the title's typed null views.
No game data. AI use: Claude Code (Claude Opus 5.5) found the causes, wrote the changes and tests, ran the checks and the title on my machine, and drafted this description.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T19:56:48Z.
Review: APPROVED
Verified locally merged onto
origin/main(Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):cargo test -p victory-gpu— 50 passed, 0 failed (1 ignored) on both RTX 5090 hardware andVICTORY_D3D12_WARP=1cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— okClean
renders_toguard andnull_rtv()fallback preventing invalid RTV creation, barriers, or clears on textures withoutD3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET. Looks good.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:06:14Z.
Review: COMMENTED
Static review only: victory-gpu/victory-hle/apps are Windows-only (D3D12/windows_sys), so nothing here compiles or runs on macOS — please rely on the Windows CI leg.
Textures whose host copy lacks
ALLOW_RENDER_TARGETnow get a null RTV in their slot instead of a view the host cannot render to:draw.rspusheshost.null_rtv()(ring slot preserved so target indices stay aligned) andclear_rtvskips with a once-per-resource warning.renders_tochecks the resource flag, which matches howhost_texturemasksd.flags &= PC_FLAGS. Sound; OMSetRenderTargets with a null RTV is valid D3D12 and draws simply discard those outputs.[PR #1613] GPU: no render-target view, barrier or clear for a texture without the render-target useto [PR #1613] GPU: render targets keep their slots (null views for targets the host cannot bind), and no RTV or clear without the render-target useImported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:31:23Z.
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-gpu/src/list.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (merge candidate) was for an older state ofmain.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by AgneyaK on 2026-11-25T03:47:18Z.
Thanks for the triage. Updated (
736fa79, description rewritten), so this no longer depends on #55:maintoday.set_targetsskipped any target with no recorded view or no host texture, which moves every later target down a slot. On NVIDIA the title's 2560x1440 format-115 render target has no host texture onmain(#1754 and the issues linked there), so this happens now. Those slots now get a null view too, and a new test showsmainwritesSV_Target0into the slot-1 texture (fails onmainfor no view and for a typed null view, passes here on Intel, WARP and an RTX 3050).D3D12_FORMAT_SUPPORT1_RENDER_TARGET), so it matches the pipeline'sRTVFormats. It'sR8G8B8A8_UNORMonly when the host can't render that format, where such a pipeline is refused anyway. No debug layer here, so that's not checked against it.AI use: Claude Code (Claude Opus 5.5) wrote the change and this reply.
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.