mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 22:15:57 +00:00
Keep texture lookups per slot instead of per global texture generation, and vertex buffer spans while their ranges repeat
TotK finalizes and initializes transient textures every frame: the global tex_gen and slots_gen moved about every 16 draws in the monsters fight, so every cache keyed on them (the slot cache in vk_texture_by_id_locked, the texture types of answers_for, the texture descriptor memo) lived for a few draws. A slot resolves through the entries at its own storage address only, so each address hash now has its own generation and each slot a token (vk_texture_slot_token: registration serial and address generation, lock-free). The memos check the global generation first and the slot's token only when it moved. The descriptor memo no longer drops an entry at each submission (the first binding still makes the storage check; a re-upload writes the same image) or pass (the feedback layout is set on each hit from the kept image), and is twice the size. feedback_scan keeps each handle's sampled subresource across passes instead of looking up every fragment texture after every texture bind. bind_vertex_buffers keeps each stream's resolved span while its range and vk_mem_gen stay the same. Monsters fight on the RX 9070: replay 12.0 -> 10.8 ms per frame; field 8.1 -> 7.4 ms. TOTK_TEX_MEMO=check and TOTK_SHADER_MEMO=check runs found no difference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
353c237208
commit
bcbbcb0b1a
3 files changed
+189
-63
No files matched your search
@@ -264,6 +264,10 @@ VkSampler vk_sampler_by_id_locked(int id);
|
||||
// on the Switch although the game binds a linear sampler (MacNativeGames 6283599). VK_NULL_HANDLE for an empty slot.
|
||||
VkSampler vk_sampler_point_by_id_locked(int id);
|
||||
uint32_t vk_texture_slots_gen(void);
|
||||
// What vk_texture_by_id(id) returns can change only when this does: the slot is registered again, or a texture entry at
|
||||
// its storage address is created, dropped, released or taken back into use. Unlocked; read it before the lookup it
|
||||
// guards (a lookup may create an entry). 0 when the slot was never registered: nothing is kept under 0.
|
||||
uint64_t vk_texture_slot_token(int id);
|
||||
uint32_t vk_sampler_gen(void); // changes whenever a sampler slot is registered
|
||||
void vk_texture_gpu_written(const tex_t *t); // rendered or copied into by the GPU: no re-upload from storage
|
||||
void vk_texture_storage_bound_locked(const VkTexImage *img); // bound as a storage image in the recording submission
|
||||
|
||||
Reference in new issue
Block a user