render3d: terrain_tiles_close - the tiles let go of their file before its map pack is unmounted

A world swap unmounts the old map pack before terrain_reload, and the tiles' file (a baked file in that
pack) stayed open until terrain_unload. terrain_tiles_close closes it and stops the page pool; the next
map's terrain_from_baked / terrain_reload opens its own and makes the pool again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 17:57:15 +03:00
parent f8d811aa97
commit 31df4dba9f

View file

@ -192,3 +192,12 @@ function ltt2_bake_base(path: string, key: string, version: int) -> int {
free(h)
return base
}
# The map's tiles let go of the file they read from, before the pack that holds it is unmounted (a world
# swap): the file closed and the page pool stopped. Until terrain_reload (or terrain_from_baked) opens the
# next map's, the GPU keeps what is resident and the coarse level, and a query answers 0. Nothing else
# render3d reads from a bake stays open: the shadow's and the textures' bytes are copied and closed.
export function terrain_tiles_close(render3d_st: mut Render3dState) -> void {
tt_close(render3d_st)
render3d_st.tp_on = false
}