render3d: 671 frame-reachable allocation sites to 161 - declared, split, or made nothing

@alloc_ok with its reason on what is made once per resource and kept (textures, programs, samplers,
views, layouts, memory blocks, the pipeline cache in gvk_pipe_build), on resize and swapchain
remakes, on screenshots and dumps, on a world being set up (streams, layers, water, post, bakes), on
loads (gltf_load, skin_load, tex_load*, png_decode, fonts) and on R3D_PROF / drawstats.
gltf_cached's hit path is its own and makes nothing; the miss (gltf_cached_load) is declared.
m4_look_at (now over m4_look_at_xyz) and m4_inverse work on scalars, and cam_update makes no scratch.
Left: lazy first-use starts, error and debug prints, and scratch made and freed each call (churn,
plan 25.3). Compiled (steady, and ludic deps over the game).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 15:58:18 +03:00
parent f2dd27f443
commit 5d0f83b81c
21 changed files with 118 additions and 42 deletions

View file

@ -33,10 +33,10 @@ function cam_update(render3d_st: mut Render3dState) -> void {
let cp = Math.cos(render3d_st.cam_pitch); let sp = Math.sin(render3d_st.cam_pitch)
v3_set(render3d_st.cam_fwd, -(sy * cp), sp, -(cy * cp))
v3_set(render3d_st.cam_right, cy, 0.0, -sy)
let at = floats(3)
v3_add(at, render3d_st.cam_pos, render3d_st.cam_fwd)
let up = v3_new(0.0, 1.0, 0.0)
m4_look_at(render3d_st.cam_view, render3d_st.cam_pos, at, up)
let px = render3d_st.cam_pos[0]
let py = render3d_st.cam_pos[1]
let pz = render3d_st.cam_pos[2]
m4_look_at_xyz(render3d_st.cam_view, px, py, pz, px + render3d_st.cam_fwd[0], py + render3d_st.cam_fwd[1], pz + render3d_st.cam_fwd[2], 0.0, 1.0, 0.0)
m4_perspective(render3d_st.cam_proj, render3d_st.cam_fov, render3d_st.cam_aspect, render3d_st.cam_near, render3d_st.cam_far)
m4_mul(render3d_st.cam_vp_clean, render3d_st.cam_proj, render3d_st.cam_view)
m4_inverse(render3d_st.cam_inv_vp_clean, render3d_st.cam_vp_clean)
@ -49,7 +49,6 @@ function cam_update(render3d_st: mut Render3dState) -> void {
m4_mul(render3d_st.cam_vp, render3d_st.cam_proj, render3d_st.cam_view)
m4_inverse(render3d_st.cam_inv_vp, render3d_st.cam_vp)
m4_inverse(render3d_st.cam_inv_proj, render3d_st.cam_proj)
free(at); free(up)
cam_planes_update(render3d_st)
}
function cam_planes_update(render3d_st: mut Render3dState) -> void {