Drop the perf suite's lowfpsfunc workaround, and record item 31

akgl_game_update_fps installs the default itself now, so the benchmark no
longer has to. Leaving the hook NULL there is what keeps that true.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-01 00:33:34 -04:00
parent 21d69192e3
commit 8a90cbf275
2 changed files with 19 additions and 20 deletions

24
TODO.md
View File

@@ -1045,20 +1045,20 @@ Ordered by blast radius. Numbering continues the **Defects** list above.
both functions.
31. **`akgl_game_update` segfaults if `akgl_game_init` did not run.**
`src/game.c:182` calls `game.lowfpsfunc()` through the pointer with no NULL
check, on every frame where `game.fps` is under 30 — which includes the
first frame, before there is a frame rate to compare against. `akgl_game_init`
installs the default; nothing else does.
**Fixed in 0.5.0**: `akgl_game_update_fps` installs `akgl_game_lowfps` when
it finds the hook `NULL`.
That matters because `include/akgl/renderer.h` documents the other path on
purpose: a host that owns its own window and calls `akgl_render_bind2d`
instead of `akgl_render_init2d`. An embedder following that documentation
and then calling `akgl_game_update` crashes on frame one. `akbasic` is
exactly that embedder.
Worth keeping the reasoning. `game.fps` is 0 for the first second of the
process, which is under the threshold, so the unguarded call fired on frame
one. Only `akgl_game_init` installed the default -- and
`include/akgl/renderer.h` documents the other path on purpose: a host that
owns its own window calls `akgl_render_2d_bind` instead of
`akgl_render_2d_init`. An embedder following that documentation crashed on
its first frame, and `akbasic` is exactly that embedder.
Fix: guard the call, or have `akgl_game_updateFPS` install the default when
it finds a NULL. `tests/perf_render.c` installs it by hand as a workaround
and points here.
`tests/game.c` clears the hook and calls the function, which is precisely
that state. `tests/perf_render.c` installed the default by hand as a
workaround and no longer has to.
32. **`akgl_game_update` runs the actor update sweep once per tilemap layer.**
`src/game.c:617` loops `i` over `AKGL_TILEMAP_MAX_LAYERS` and the actor