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> Co-Authored-By: Andrew Kesterson <andrew@aklabs.net>
This commit is contained in:
24
TODO.md
24
TODO.md
@@ -1045,20 +1045,20 @@ Ordered by blast radius. Numbering continues the **Defects** list above.
|
|||||||
both functions.
|
both functions.
|
||||||
|
|
||||||
31. **`akgl_game_update` segfaults if `akgl_game_init` did not run.**
|
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
|
**Fixed in 0.5.0**: `akgl_game_update_fps` installs `akgl_game_lowfps` when
|
||||||
check, on every frame where `game.fps` is under 30 — which includes the
|
it finds the hook `NULL`.
|
||||||
first frame, before there is a frame rate to compare against. `akgl_game_init`
|
|
||||||
installs the default; nothing else does.
|
|
||||||
|
|
||||||
That matters because `include/akgl/renderer.h` documents the other path on
|
Worth keeping the reasoning. `game.fps` is 0 for the first second of the
|
||||||
purpose: a host that owns its own window and calls `akgl_render_bind2d`
|
process, which is under the threshold, so the unguarded call fired on frame
|
||||||
instead of `akgl_render_init2d`. An embedder following that documentation
|
one. Only `akgl_game_init` installed the default -- and
|
||||||
and then calling `akgl_game_update` crashes on frame one. `akbasic` is
|
`include/akgl/renderer.h` documents the other path on purpose: a host that
|
||||||
exactly that embedder.
|
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
|
`tests/game.c` clears the hook and calls the function, which is precisely
|
||||||
it finds a NULL. `tests/perf_render.c` installs it by hand as a workaround
|
that state. `tests/perf_render.c` installed the default by hand as a
|
||||||
and points here.
|
workaround and no longer has to.
|
||||||
|
|
||||||
32. **`akgl_game_update` runs the actor update sweep once per tilemap layer.**
|
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
|
`src/game.c:617` loops `i` over `AKGL_TILEMAP_MAX_LAYERS` and the actor
|
||||||
|
|||||||
@@ -793,14 +793,13 @@ int main(void)
|
|||||||
akgl_game.statelock = SDL_CreateMutex();
|
akgl_game.statelock = SDL_CreateMutex();
|
||||||
FAIL_ZERO_BREAK(errctx, akgl_game.statelock, AKGL_ERR_SDL, "%s", SDL_GetError());
|
FAIL_ZERO_BREAK(errctx, akgl_game.statelock, AKGL_ERR_SDL, "%s", SDL_GetError());
|
||||||
|
|
||||||
// And this one is not optional either. akgl_game_update_fps calls
|
// akgl_game.lowfpsfunc is deliberately left NULL. It used to have to be
|
||||||
// game.lowfpsfunc through the pointer, unguarded, on every frame under
|
// installed by hand here, because akgl_game_update_fps called it
|
||||||
// 30 fps -- which includes the first frame, before there is a frame rate
|
// unguarded on every frame under 30 fps -- which includes the first,
|
||||||
// to compare. A host that brings the library up the way renderer.h
|
// before there is a frame rate to compare against -- and a host that
|
||||||
// documents for an embedder, akgl_render_2d_bind over its own window,
|
// binds its own renderer the way renderer.h documents never went through
|
||||||
// segfaults on its first akgl_game_update. Filed in TODO.md; installing
|
// akgl_game_init to get one. It installs the default itself now, and
|
||||||
// the default by hand is the workaround.
|
// leaving it NULL here is what keeps that true.
|
||||||
akgl_game.lowfpsfunc = &akgl_game_lowfps;
|
|
||||||
|
|
||||||
benchfont = TTF_OpenFont(BENCH_FONT_PATH, BENCH_FONT_SIZE);
|
benchfont = TTF_OpenFont(BENCH_FONT_PATH, BENCH_FONT_SIZE);
|
||||||
FAIL_ZERO_BREAK(errctx, benchfont, AKGL_ERR_SDL, "Couldn't open %s: %s", BENCH_FONT_PATH, SDL_GetError());
|
FAIL_ZERO_BREAK(errctx, benchfont, AKGL_ERR_SDL, "Couldn't open %s: %s", BENCH_FONT_PATH, SDL_GetError());
|
||||||
|
|||||||
Reference in New Issue
Block a user