render3d: recycle texture and buffer ids, free a released model whole, actor_release
A freed texture or buffer id goes on a spare list the next one takes; tex_note_size keeps sizes by id. model_release frees prims, meshes, material names, the skin and leaves gltf_cached. actor_release takes an actor off the stage and actor_new reuses its record (ECS's Things come and go all day). steady.ludic: an actor round at 0 bytes over 2000. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2fe4018d28
commit
9b482d609a
14 changed files with 208 additions and 39 deletions
|
|
@ -227,3 +227,21 @@ function skin_clone(src: Skin) -> Skin {
|
|||
skin_pose(sk)
|
||||
return sk
|
||||
}
|
||||
|
||||
# A skin loaded with a model, let go with it (model_release): every array it owns, its joints' names
|
||||
# and itself. The views into gmat, inv_bind and bones are slices of those, and freeing a view would
|
||||
# free its owner's data again, so only the lists that hold them go (a few bytes a joint stay).
|
||||
function skin_free(sk: Skin) -> void {
|
||||
if sk == null { return }
|
||||
if sk.names != null {
|
||||
for i in 0 .. len(sk.names) { if sk.names[i] != null and len(sk.names[i]) > 0 { free(sk.names[i]) } }
|
||||
free(sk.names)
|
||||
}
|
||||
free(sk.par); free(sk.walk); free(sk.rest_t); free(sk.rest_r); free(sk.rest_s); free(sk.rest_g)
|
||||
free(sk.pose_r); free(sk.pose_t); free(sk.gmat); free(sk.joints); free(sk.inv_bind); free(sk.bones)
|
||||
free(sk.tmp_l); free(sk.tmp_q); free(sk.tmp_a); free(sk.tmp_b); free(sk.tmp_c); free(sk.tmp_v)
|
||||
if sk.gmat_v != null { free(sk.gmat_v) }
|
||||
if sk.inv_v != null { free(sk.inv_v) }
|
||||
if sk.bones_v != null { free(sk.bones_v) }
|
||||
free(sk)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue