Repository navigation
GPU: giving up a texture leaves the dynamic slots of recorded lists alone - #2598
BastienRodz wants to merge 2 commits into
Conversation
…lone Since 69d1e8e, giving up a host texture (idle, or past the card's budget) nulls every heap slot viewing it (HostHeap::evict). Since ed25c0e it finds them by scanning `kept`, which covers the dynamic slots too: the descriptor tables lists build for their draws. A recorded list not yet reset still uses those (the dynamic slots it took are not released until then), and its table is not made again before it runs, so its draws read a null 2D view, and the slot no longer held the texture. resource.rs: "Lists recorded before hold it until they are reset, so no GPU work reads it freed". evict now leaves dynamic slots a list still holds (taken in `next`), and holds `made` and `next` across the scan and the clearing. Co-Authored-By: Gemini 4 Neon <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fyernald
left a comment
There was a problem hiding this comment.
Tested on an RTX 3080 (617.42), Windows 10 (19045), main 67e8ae1: cargo test -p victory-gpu --lib --locked -- --test-threads=1 gives 193 passed, 3 failed. live_dynamic_slots_keep_a_texture_given_up passes. The 3 failures also fail on main here: the two heap-cap tests (FIND-9) and the Windows 10 castable test (#1999).
I checked the lock order, since evict now holds next too. Every function in descriptor/host.rs that holds more than one of these locks takes made before kept (mirror, describe_slot, unmade_placed). dynamic and release hold next alone and call nothing that locks. So made → next → kept here can't deadlock with them.
One question, not a blocker: a texture given up while a recorded list holds its dynamic slot stays referenced from kept after the list resets. release only clears the taken bit, so the reference goes when the slot is next written by make_at, not at the reset. If evictions are about freeing video memory under pressure, that texture lives until the dynamic cursor comes back round. That's probably fine given how fast the dynamic range cycles, but worth a line in the comment.
Until the slot is next made, not until its list is reset (review by fyernald). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @fyernald, the lock-order check is appreciated. On your question: yes, a held dynamic slot keeps the given-up texture until the slot is next made, not until its list resets, since |
|
Verification of Environment: Windows 11, D3D12 on the WARP software adapter only (
Independent verification by Claude Code (Claude Sonnet 5.5), an AI assistant, run for oni-swr. No game files, dumps, or shader names were used. |
|
Setup: RTX 3080 Ti (driver 621.24), Windows 11, a local stack of open PRs merged with main 67e8ae1. Applied cleanly on that stack, together with #2601, #2576, #2611, #2626. One 10-minute game run reached gameplay with no device removal. These five PRs were not tested one by one, so nothing in that run is attributed to this PR alone. Written with Claude Code; tested locally. |
|
Automated triage for the maintainers. In Generated by Claude Code |
What's wrong
HostHeap::evict(69d1e8e, which scanskeptsince ed25c0e) nulled every slot viewing a given-up texture. That included the dynamic slots of lists recorded but not yet reset: a list's descriptor tables for its draws, released only at reset and not made again before the list runs. Such a list's draws then read a null 2D view, and the slot no longer held the texture.resource.rssays lists recorded before an eviction keep what they use until they are reset.What the fix does
In
HostHeap::evict:index >= count) still taken innext, i.e. held by a list not yet reset;madeandnextbefore scanningkeptand hold them across the clearing, so a slot taken or rewritten meanwhile is not nulled. The order ismade, thennext, thenkept(taken bykeep), and no path holdskeptwhile taking either of the other two.Tests
New
descriptor::host::tests::live_dynamic_slots_keep_a_texture_given_up: a placed texture viewed from a title slot, from a dynamic slot still held, and from a dynamic slot already released. When the texture is given up, the held dynamic slot must keep its view and texture, while the other two are nulled.Results:
main(67e8ae1) it fails:a live dynamic slot keeps its view.resource::tests(17) anddescriptor::host::tests(13). The exception isdynamic_slots_are_held_until_released, which fails onmaintoo under vkd3d-proton because of its heap cap. Run under Wine 10 with vkd3d-proton 3.1 on llvmpipe; without a host device the test returns early.Not tested
No title run, and no AMD/NVIDIA GPU. How often a texture viewed from a held list's table is given up is not measured. It needs either a texture idle for longer than the eviction delay while a list recorded earlier still runs, or the budget pass reaching textures that recorded lists use.
Fixes #2597
AI-assisted (Gemini 4 Neon found and wrote it, Claude Code reviewed and verified it). No game data used.
🤖 Generated with Claude Code