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

@ -37,6 +37,7 @@ function r3d_find_root(render3d_st: mut Render3dState) -> void {
# Build a program from a vertex + fragment file pair (defines apply to both).
# R3D_PROGRAMS_LOG=<file>: append every program built (vertex, fragment, defines) - the list a
# backend that cannot compile shaders at run time (Vulkan: SPIR-V is built ahead) must cover
@alloc_ok("profiling and statistics, only under R3D_PROF / R3D_DRAWSTATS")
function r3d_program_log(render3d_st: mut Render3dState, vs: string, fs: string, defines: string) -> void {
if render3d_st.r3d_prog_log < 0 { render3d_st.r3d_prog_log = 0; if r3d_env_has(render3d_st, "R3D_PROGRAMS_LOG") { render3d_st.r3d_prog_log = 1 } }
if render3d_st.r3d_prog_log == 0 { return }
@ -48,6 +49,7 @@ function r3d_program_log(render3d_st: mut Render3dState, vs: string, fs: string,
file_write(f, line, len(line))
file_close(f)
}
@alloc_ok("made once per resource and kept for its life (a texture, program, sampler, view, layout or memory block is created when first asked for)")
function r3d_program(render3d_st: mut Render3dState, vs: string, fs: string, defines: string) -> int {
r3d_program_log(render3d_st, vs, fs, defines)
let p = gpu_program(render3d_st, vs, fs, `{render3d_st.r3d_global_defs}{defines}`)
@ -67,6 +69,7 @@ property Target {
w: int = 0,
h: int = 0
}
@alloc_ok("made once per resource and kept for its life (a texture, program, sampler, view, layout or memory block is created when first asked for)")
function target_new(render3d_st: mut Render3dState, w: int, h: int, ifmt: int, fmt: int, ty: int, with_depth: bool, filter: int) -> Target {
let t = new Target
t.w = w; t.h = h