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
|
|
@ -599,7 +599,9 @@ function gpu_tex_free(render3d_st: mut Render3dState, tex: int) -> void {
|
|||
if tex == 0 { return }
|
||||
let ids = gpu_tmp(render3d_st)
|
||||
ids[0] = tex
|
||||
gvk_flush(render3d_st); if tex < len(render3d_st.gvk_tex_image) { gvk_tex_release(render3d_st, tex) }
|
||||
gvk_flush(render3d_st)
|
||||
gvk_tex_give_back(render3d_st, tex)
|
||||
tex_note_forget(render3d_st, tex)
|
||||
if render3d_st.gpu_unit_2d != null { for i in 0 .. 32 { if render3d_st.gpu_unit_2d[i] == tex { render3d_st.gpu_unit_2d[i] = 0 } } }
|
||||
if render3d_st.gpu_bound_2d == tex { render3d_st.gpu_bound_2d = 0 }
|
||||
let o = gpu_tx_at(render3d_st, tex)
|
||||
|
|
@ -699,7 +701,8 @@ function gpu_fb_free(render3d_st: mut Render3dState, fb: int) -> void {
|
|||
gvk_fb_forget(render3d_st, fb); let fo = gpu_fb_at(render3d_st, fb); if fo >= 0 { for i in 0 .. GPU_FB_W { render3d_st.gpu_fb[fo + i] = 0 } }
|
||||
}
|
||||
function gpu_rb_free(render3d_st: mut Render3dState, rb: int) -> void {
|
||||
gvk_flush(render3d_st); if rb > 0 and rb < len(render3d_st.gvk_tex_image) { gvk_tex_release(render3d_st, rb) }
|
||||
gvk_flush(render3d_st)
|
||||
gvk_tex_give_back(render3d_st, rb)
|
||||
}
|
||||
function gpu_viewport(render3d_st: mut Render3dState, x: int, y: int, w: int, h: int) -> void { gvk_viewport(render3d_st, x, y, w, h) }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue