mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-05 13:20:11 +00:00
A result memo miss resolves every image table of the snapshot again: ResolveImageTables decodes each distinct T#, builds the element and poison indices and fills one map record per key, which is most of a miss for a large table. A miss whose table did not change is common: another buffer, flat SRT word or user data word changes the result key while the column is the one the column memo shares. ResolveImageTablesShared keeps the last resolutions and hands one out by reference when the variant (its id), the reducing state of the direct samplers paired with table images and every column match: base, size, records, keys, fault, outside, and the column's codes and distinct T#s by identity. The memo holds those shared values, so a block it compares cannot be freed and reused for other words; a column read again is a new block and resolves again even when its words are equal. It keeps at most 4 resolutions per variant and 256 in all within 8 Mi words, counting the columns their keys keep alive, least recently used first out, under one mutex. A resolution is immutable once made and is shared between threads read-only. APS5_NO_TABLE_RESOLUTION_REUSE=1 turns it off. ImageTableReuseCounts gains the resolutions made and the ones shared.