mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 02:09:57 -04:00
Retire textures evicted by disuse before freeing them, take them back on any use, and add tex_disuse = 2 to tell the freeing from the marks.
0.6.1.14 faulted the GPU (a read of an invalid address in a pass) about 30 seconds after its last disuse evictions, and no path by which an evicted image is still read was found in the code. An evicted texture is now first retired: the pool refresh gives its slots the stand-in while the image stays whole. It is destroyed only once the texture pool has taken every set of its ring since and the GPU has finished the submissions recorded until then, so no pool set can still be bound with its view. A mark on one of its slots or any lookup outside the pool refresh takes it back as it is, and the perf line counts those, which shows whether the marks miss a real use. tex_disuse = 2 retires and never frees, so the next fault can be put on the freeing or on the marks and stand-ins. The registration shortcut also read a slot's cached entry without checking that the resolution was current, so it could read the record of a destroyed texture; it now checks the slot's generation first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 4c5b2ae2e030ab00a910d8f071c030e610fd78e1)
This commit is contained in:
@@ -496,6 +496,11 @@ extern volatile uint32_t vk_pool_kinds_used; // bit k: a pipeline was mad
|
||||
int vk_pool_marks_enabled(void); // NX2NAVI_TEX_DISUSE: modules get the marks
|
||||
extern volatile int32_t vk_pool_marks_missed; // modules indexing the pool that could not be marked
|
||||
void vk_pool_marks_read(const uint32_t *marks, uint32_t n); // vk_texture.c: slots marked since the last read
|
||||
// The texture pool's ring of descriptor sets (vk_exec_draw.c pool_take_set): a submission's first pool use takes the next
|
||||
// set and brings it up to date. vk_pool_takes counts those takes; once it has moved on by more than VK_POOL_SETS since a
|
||||
// pool entry changed, every set holds the change (vk_texture.c retire_sweep).
|
||||
#define VK_POOL_SETS 4
|
||||
uint64_t vk_pool_takes(void);
|
||||
// Texture lock held: 1 while the texture pool refresh looks its slots up (vk_exec_draw.c pool_sync_entries), 0 after.
|
||||
// Those lookups leave out a texture evicted by disuse, and are not counted as the texture being used.
|
||||
void vk_texture_pool_ctx(int on);
|
||||
|
||||
Reference in New Issue
Block a user