vkback/watch: break texture refill loop and defer unnamed refills #277
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/vktory6--VKtory#277
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@olafix52 on GitHub · 2026-12-02 20:34 UTC · original
Addresses
docs/TASKS.mditem:Texture refill loop.What
Break the ~1,500 texture refills/frame self-feeding loop at its three measured causes while staying 100% faithful to console semantics (zero artificial caps on named textures, zero new toggles):
live_coverfrom self-looping ong.rests()(watch.rs,watch/live.rs):boat-sarc1) showed 100% ofuncoveredfeedback (13.5k-18.2kblocks/s re-injected intolive_written()onlive_take_written) came fromprotect_alias()honouring the 3 msrests()window (fly=0, left=0, fail=0, bad_old=0). Becauselive_protect()re-arms the primary block immediately onlive_take_written, parameterisedprotect_alias(..., honor_rest: bool)withfalsefromlive_cover(truekept for D3D12cover()). Added unit testlive_protect_alias_ignores_rest_when_asked.live_take_writtenonExecute/Present/ explicitflush()(vklive.rs):SignalandCopyPageMappingsRangesaccounted for over half of alllive_take_writtentriggers (exec=418, sig=418, map=36, pres=19, flush=19per sec). Splitflush_now(all queue ops still flush immediately) fromtake_written(ExecuteandPresent).unnamedtextures until named or read (texwatch.rs,refresh.rs,slotwrite.rs,lib.rs):boat-sarc1) belonged to textures with no active descriptor slot (!self.naming.contains_key(&id)). Dirtyunnamedtextures (already filled once) now move toTexWatch::deferredand skipdirtyinwritten/tickuntil named inslotwrite::slot_setor needed by a GPU copy/resolve (ensure_freshviaused_nowoncopy_resource/copy_texture_region/resolve, and oncopy_texture_regionSubresourcedst beforegpu_wrote). Added unit tests intexwatch.rs.docs/learnings/cpu-perf-1.md.The reference
ensure_freshguarantees any texture copied or bound later is refreshed before GPU use.watch::cover()preserves its 3 msrests()behaviour viaprotect_alias(..., honor_rest = true).Evidence
Tested on
RX 9070 XT(Mesa 26.3.1), base4a9dbe5:Automated checks (after final edits):
cargo test -p vkback --lib:173 passed; 0 failed; 6 ignoredcargo test -p vkback --test policy:6 passed; 0 failedcargo clippy -p vkback --all-targets -- -D warnings: pass (0 warnings)cargo xtask policy:asset policy: 535 files ok./tools/build.sh(pe,so,vk-store,translate): builds cleanly (note: the Windows-onlywatch/live.rstest compiles in the PE build step; not run separately under Wine).Interleaved A/B/B/A (
boat-sarc1, 0..140 s world window):current)current)refill-loop)refill-loop)presents/refreshed54,109 MB)72,435 MB)28,305 MB)27,820 MB)gpu: texture fills(GPU time / ops)5.29M)5.58M)994k)1.06M)tex: refresh dirty(CPU time)-10.1 s)live: ev title memory written(CPU time)blocks guarded again(last 5 s avg)GPU busy)33.2 ms)31.5 ms)32.4 ms)30.4 ms)render:slots/descriptorsdominates)boat-sarc0(2 comparison pairs, 110 s launches):refreshed:1,232,059 (68,547 MB)/1,268,775 (15,051 MB)→305,865 (6,739 MB)/317,370 (4,886 MB)(-75% refills)tex: refresh dirty:146 / 157 ms→69 / 47 ms; FPS14.5 / 20.6→19.6 / 20.1boat-sarc0,2560x1440, +12 s world, rule 18): visual check shows identical, complete rendering with zero missing/stale textures;0 UNKNOWNloud errors (63and76known hits).boat-sarc0, ~125 s world,1520shown, rule 30):0new VUIDs; only the 4 listed VUIDs indocs/TASKS.mdappeared:VUID-VkBufferCreateInfo-size-06409VUID-VkComputePipelineCreateInfo-layout-01687VUID-VkGraphicsPipelineCreateInfo-layout-01688VUID-VkRayTracingPipelineCreateInfoKHR-layout-03428loud.txt:3 kind(s), 58 hit(s), 0 without an owner.Checklist (docs/AGENTS.md)
clippy -p vkback --all-targets -- -D warningspasses with zero warningscargo test -p vkback --libandcargo test -p vkback --test policypasscargo xtask policypassestoggles.txtuntouched) and oversize budgets respected (watch.rs/lib.rs)docs/TASKS.mduntouched (rule 29);docs/learnings/cpu-perf-1.mdupdated (rule 28)Pull request details or commits were not available from GitHub; kept as an issue.