mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-18 23:07:07 -05:00
When the write tracker vouched for an unwritten image table column, the capture still copied each of its words into ShaderMemory's pages (supplyWords) so they would be in the captured regions, and Regions() then found them again bit by bit. On a 32,768-record column that is a 1 MiB copy per capture (about 120 us here) and a scan of 262,144 read bits per Regions() call (about 230 us), and the draw path calls TakeRecentRegions() and Regions() once each per stage. The memo now keeps a column's words in one immutable block (SrtGuestWords), and supplyWords hands that block over. ShaderMemory keeps a reference and reports its runs page by page, the regions a read of the same words reports, merged in address order with the pages and the initial regions; a second stage that supplies the same block only marks it recent again. The words reach pages only when they must: a later read in the same ShaderMemory that touches them first moves the whole block into its pages (spilled), so a word is never reported twice, and a block that overlaps pages already fetched or another block's runs is copied as before. A spilled block stays referenced until the ShaderMemory goes, so the regions already taken from it stay valid. ShaderMemory::Supplies() counts the words shared, copied and spilled.