GPU: create host textures without the uses the host refuses #55
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/55"
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 a55uka on 2026-11-23T23:55:10Z.
The console's GPU allows some uses of formats that other GPUs don't. On an RTX 4070 (Linux, vkd3d-proton), two 2560×1440 textures failed to create with
E_INVALIDARG:vkd3d-proton logs:
Requested resource flags #5, but no format in cast list supports it.Tested:
Imported from Marvisak/VIctory. Originally posted by Vyral1978 on 2026-11-24T00:20:41Z.
Tested on native Windows 11 D3D12 (Intel i7-12700 + NVIDIA RTX 3070):
2560x1440textures (format 86with UAV andformat 115with RT); both now create cleanly withdropped=4anddropped=1.ALLOW_RENDER_TARGETis dropped onformat 115,Host::rtv()(called fromdraw.rs::set_targetsandlist.rs::clear_rtv) still callsCreateRenderTargetView/OMSetRenderTargets/ClearRenderTargetViewon that texture, which triggersDXGI_ERROR_INVALID_CALL (0x887A0001)on native Windows D3D12.Option<D3D12_CPU_DESCRIPTOR_HANDLE>fromHost::rtv()(returningNonewhenGetDesc().Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET == 0) and skipping it inset_targets/clear_rtvcompletely fixes the0x887A0001removal (ran ~82s into the world on35b054e).Imported from Marvisak/VIctory. Originally posted by EduAzevedo on 2026-11-24T00:42:09Z.
Tested
56f1d41on NVIDIA GeForce RTX 2070 SUPER (Turing), driver 610.88, Windows 11 (10.0.26200), native D3D12, release build, empty cache: the textures are fixed; the world then ends in device removed withDXGI_ERROR_INVALID_CALL, which confirms the follow-up @Vyral1978 describes, on Turing too.35b054eno host texture(2560×1440, format 86 UAV and format 115 RT)host texture without a use the host refuses)0x887A0004after an 8.6 s submission (a hang)0x887A0001(invalid call), twice, after a 0.5 s submission2c3592e9bbad543f,559fb027c6d5b1db,e4a4da9c0f4d810e).AI-assisted.
Imported from Marvisak/VIctory. Originally posted by EduAzevedo on 2026-11-24T00:54:25Z.
Follow-up to my test above: I implemented the
Host::rtv()change @Vyral1978 describes on top of56f1d41and ran it on the same RTX 2070 SUPER (Turing), driver 610.88, Windows 11, native D3D12, release build. The0x887A0001removal is gone; the world now runs until the hang from #71 / #97.56f1d41)DXGI_ERROR_INVALID_CALL(0x887A0001)0x887A00010x887A0004after a 5.0 s submission holding the same three compute pipelines as on main (2c3592e9bbad543f,559fb027c6d5b1db,e4a4da9c0f4d810e), i.e. the hang in #71 / #97One difference from the suggestion: instead of leaving the target out of
OMSetRenderTargets, it binds a null RTV in its slot, so the targets after it keep their indices (dropping one would move the pixel shader's later outputs onto the wrong textures).clear_rtvreturns without clearing.cargo build --releaseandcargo test -p victory-gpu(39 passed) are clean.Feel free to take it into this PR; I can open it as a separate PR on top of this one instead if you prefer.
Patch (on top of
56f1d41)AI-assisted.
Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T00:56:01Z.
Tested
56f1d41under Wine 11.22 + vkd3d-proton 3.1 on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build withcargo xwin ... --target x86_64-pc-windows-msvc: pass, no regression.\n\n-victory_gpu: 36 passed, 3 failed — the same three environment-only failures asmain(argument_clamp_builds,a_rejected_blob_gives_an_empty_library, #128'sVirtualQueryupload skip).\n- The diff adds no test, so this only shows nothing else broke; the refused-use fallback is not exercised by the suite here.\n\nNo game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).Imported from Marvisak/VIctory. Originally posted by r4tedx on 2026-11-24T03:30:10Z.
Review question (built on
maind2a4bae; tests pass on an RTX 5070). When the host refuses a texture, the fallback retries without the uses it refused (fewer.flags &= !drop), which can take awayALLOW_RENDER_TARGET, as in the B4G4R4A4 case in the description. As far as I can follow it, the title's later render-target binds still reachCreateRenderTargetViewfor that host texture (the draw and clear paths make RTVs for whatever the title binds). Microsoft's description of the flag is "Allows a render target view to be created for the resource", so a view on a texture created without it is invalid, and on a real device that tends to end in a removal rather than a clean error.Is there a check I missed that skips such binds? If not, #89 takes the other route for the packed 16-bit formats (it renders them as R8G8B8A8, keeping the capability), which avoids the problem for that case.
From reading only; I have no copy of the title.
Imported from Marvisak/VIctory. Originally posted by walterwallaceson on 2026-11-24T05:54:37Z.
Tested #55 (
56f1d41) and #89 (081afbd) together on an AMD CPU, so the Intel start-up blocker above doesn't apply: Windows 10 22H2 (19045.6466), RTX 3070, NVIDIA 621.14, Ryzen 5 5600X, release build. Both merged cleanly on top of #233 (3098672) + #175 (19aec59), so this is the four together, not either PR alone.no host texture(2560x1440, formats 86 and 115,0x80070057)0x887A0006, no breadcrumbs)cargo test --workspace:victory-gpu48 passed (43 without these PRs); the only failures are the known Windows 10 ones (#118/#152, #362).host pipeline refusedlines in the run come after the removal (0x887A0005), so they're a consequence of it.no free dynamic descriptor slots: a table is not madeabout 34 s before the removal, the signature #304 and #336 describe. It didn't appear in the #175 + #233 run. Adding #336 on top makes the world last about 2 min instead of 40 s (details on #336).No game data in this report.
AI-assisted (Claude Code); everything above was run on my machine.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T09:13:37Z.
Review: CHANGES_REQUESTED
Tested
56f1d41on Windows 11, RTX 5070, MSVC:cargo test --workspace --no-fail-fastpasses (227 passed, 0 failed; older base). Not tested under vkd3d-proton.Retrying creation without the refused use is a reasonable fallback, but dropping the render-target use opens a new failure path:
crates/victory-gpu/src/draw.rs:282andcrates/victory-gpu/src/list.rs:704create RTVs without checkingALLOW_RENDER_TARGET.host_resourcereturnedNoneand the RT binding was skipped.ALLOW_RENDER_TARGET. When the title binds it as a target, or clears it (list.rs:704),CreateRenderTargetViewis called on a resource that doesn't allow it. That is invalid usage: a debug-layer error, and possibly device removal on some drivers.descriptor/host.rs:592checksALLOW_UNORDERED_ACCESS), so dropping UAV is safe. Dropping the RT use needs the same check beforehost.rtv(Some(texture), …). Write a typed null RTV (as #450 does for null records) and skip the clear, or skip the slot.Smaller point: the retry order drops UAV first, and on failure keeps it dropped before trying to drop RT. A texture whose only problem is RT therefore loses UAV too, which it didn't need to. Trying
!RTalone before!(UAV | RT)would keep it.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by NuraadGit on 2026-11-24T11:45:08Z.
A gap this leaves on NVIDIA: the render-target views are still made, and one of them removes the device.
When the render-target use is dropped (B4G4R4A4 on NVIDIA), the comment says "the views the host cannot make are skipped as for depth". But the RTV paths don't skip them.
draw.rsset_targetsandlist.rsclear_rtvboth callhost.rtv(texture, …)for any host texture.CreateRenderTargetViewon a texture withoutALLOW_RENDER_TARGETwrites an invalid descriptor, and the next use removes the device withDXGI_ERROR_INVALID_CALL.Seen on an RTX 2080 with a stack that includes this change (JMAN730's fork + #493 + #189 + #206 + #667 + 2^18 dynamic slots from #747). That stack makes more world draws run. With the debug layer on (
VICTORY_D3D12_DEBUG=1), the last messages before the removal are:The fix I used is a check in
Host::rtvfor whether the texture allows render targets. If it doesn't, the function makes a typed null view instead (R8G8B8A8_UNORM, TEXTURE2D), which discards the writes. A clear of such a texture returns early:Same build, same input, before and after: the device was removed at world entry 2 of 2 times without it, and the run stayed up for 8 minutes with it (~2,430 draws per frame, median 0.91 s per frame). Main's
rtvtakes&ID3D12Resourcerather thanOption, so there it's the same check with an early null view. #89 is the fuller fix (render 4444 targets as R8G8B8A8). This is the minimum that makes dropping the use safe.AI-assisted (Claude Code): the debug-layer run, fix and runs were automated. The hardware, title copy and runs are the user's.
Imported from Marvisak/VIctory. Originally posted by AgneyaK on 2026-11-24T16:51:44Z.
Test report, and a follow-up fix for what this PR exposes.
Setup: RTX 3050 6 GB Laptop (NVIDIA, driver 32.0.16.2124), i7-13700H, 16 GB RAM, Windows 11 26300, diag build. Title 1.0.2.1, Series X profile. Tree:
mainffe310e+ #208 + the wave64 stack + #452 + #579 + #472/#322/#1024 + #492 (the tree in #1232), plus this PR56f1d41(clean merge).What this PR fixes: the two textures
mainrefuses on this card are created:What it exposes: an invalid call that removes the device. In all three runs with this PR the device was removed 1:41–1:58 in with
The application made a call that is invalid(DXGI_ERROR_INVALID_CALL). None of six runs of the same tree without it ended that way (they ran 2:20–9:27 and ended in hangs, resets or title asserts). The cause:B4G4R4A4texture (format 115) losesALLOW_RENDER_TARGET, but the title still clears it and binds it as a target.list.rs(the clear) makes an RTV of it withhost.rtv, records a raw barrier toRENDER_TARGETand callsClearRenderTargetView. All three are invalid on a resource without that flag.draw.rsset_targetsalso callshost.rtvwith no flag check. The UAV path already checks, throughfits().The fix (below, 47 lines; it applies to this PR's head):
host::renders_to(texture)check;set_targetsbinds a null RTV in that slot (Host::null_rtv), so the other targets keep their slots and the draw writes nothing there. That matches what this PR already does for the views the host cannot make.With the fix, two runs:
clear of a render target the host cannot render to: skippedat 2:18 andrender target the host cannot render to: a null view in its slotat 2:41;patch
Not tested: AMD (where nothing is dropped, so the new paths never run), more runs, a release build. The null view's format is
R8G8B8A8_UNORM, not the dropped format. I have not checked what the debug layer says about the mismatch with the pipeline's RTV format (the debug layer isn't installed here).AI use: Claude Code (Claude Opus 5.5) found the cause, wrote the patch, ran the title on my machine and drafted this note; results are from the runs described.
upstream-sync referenced this pull request2026-11-24 19:03:41 +00:00
Imported from Marvisak/VIctory. Originally posted by AgneyaK on 2026-11-24T19:47:18Z.
The render-target guard from my comment above is now a PR on its own: #1613. It applies to
main, changes nothing there, and stops the invalid-call device removal once this PR lands.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:14:54Z.
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-gpu/src/resource.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
upstream-sync referenced this pull request2026-11-25 04:06:55 +00:00
upstream-sync referenced this pull request2026-11-25 11:05:06 +00:00
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.