Anchor Website 6
Opus 4.8
Summary
Set out to fix the parked "unfocus hang" in the shared Anchor 2 engine; it turned into a multi-layer debugging saga that also uncovered and fixed a latent invisible-text regression (1d02f12). Both are now fixed, deployed, and committed; Anchor2 HEAD is healthy again.
Session orientation:
- Resumed the Anchor Website renderer (a327ex.com reimplemented in Anchor 2, at
a327ex-site/renderer/). ReadPLAN.md+ project memory. Content-complete; remaining roadmap = web delivery, M2b full media pull, per-post fidelity. User chose to tackle the parked minimize/unfocus hang.
Minimized-window hang — diagnosis & fix:
- Repro: any Anchor program left minimized/unfocused long enough becomes unresponsive ("Not Responding") and needs a force-kill.
- Root cause (NOT the old "texture-leak hypothesis"): the desktop main loop (
main_loop_iterationinAnchor2/engine/src/anchor.c) iswhile(running) main_loop_iteration();with NO sleep — pacing relies entirely onSDL_GL_SwapWindowvsync, and there was no handling forMINIMIZED/HIDDEN(onlyFOCUS_GAINED→timing_resync). Minimized, SwapWindow either returns instantly (vsync can't pace an unpresentable surface → CPU free-spin) or stalls in the present (main thread blocks → "Not Responding"). - Confirmed
video_pump_allis a no-op with no video loaded (so it's core-loop, affects all Anchor2 games, not video-specific).vsync_enableddefaults true,render_uncappedfalse. - Design call: per-frame
SDL_GetWindowFlagsquery (free field-read, can't desync) over event-tracking a flag (user's initial idea — events can desync). Knobs chosen: keep game logic + audio running while minimized; leave unfocused-but-visible at full 60fps. - Fix: before the render gate,
window_unpresentable = SDL_GetWindowFlags(window) & (SDL_WINDOW_MINIMIZED|SDL_WINDOW_HIDDEN); if set,should_render=false; after the render block,if (window_unpresentable) SDL_Delay(10). Desktop-only (#ifndef __EMSCRIPTEN__); events + fixed-timestepupdate()still run. User-verified the hang is gone.
Invisible-text regression saga (1d02f12):
- First rebuild deploy → user: "text not drawn at all." Established it was NOT the minimize edits: the committed working binary (
b315da9) had 0u_text_gamma, proving it was built from9015fec— the commit BEFORE1d02f12("luminance-directional text gamma").1d02f12was committed but never rebuilt/deployed/tested for the renderer (its deploy was blocked the session it landed — confirmed by reading last session's transcriptcd12f1cc= "Anchor Website 4" = Private Session 8). - First (wrong) workaround: built the minimize fix on the
9015fecbase, skipping1d02f12→ working text but reverted the quality work. User pushed back wanting last session's good text. - Healing HEAD: a one-shot
fprintfinlayer_renderlogged[textdbg] g_font_gamma=1.6000 u_text_gamma_loc=-1— theu_text_gammauniform (used only in the glyph branch) was STRIPPED by the GLSL linker (loc -1) → read 0 →ge=1/0.001=1000→pow(cov,1000)≈0→ invisible AA text. - First fix (bake gamma + remove uniform): STILL invisible. Deeper bisect — forced the glyph shader branch to solid opaque red + logged
process_glyph: glyphs ARE processed (5 logged, atlas tex=21) but NO red appeared. SovType=7.0/SHAPE_TYPE_TEXTquads produce zero fragments on this GPU, while identicalvType=2.0sprites draw fine (vertex shader passesvTypecleanly; sprites prove theaTypeattribute works) — an unexplained driver/shape-type quirk. - Final fix: revert glyphs to the SPRITE path (
process_glyph→batch_add_uv_quad) with coverage gamma BAKED into the atlas alpha (font_blit_to_buffer, the9015feclook the user likes). Kept1d02f12's browser-quality image downscaling. Removed deadSHAPE_TYPE_TEXT,batch_add_glyph_quad, the shader text branch, and theu_text_gammauniform. User confirmed text visible + images crisp. Dropped: the directional dark-on-light over-bolding fix (never validated; a retry would need per-vertex gamma, not a branch-only uniform/shape-type).
Lessons (saved to memory):
- A shader uniform used only in a single rarely-taken branch can be linked out (loc -1 → reads 0) on some GPUs — prefer baking or per-vertex data.
- High
vTypeshape-types (7.0) rendered nothing on the dev GPU even forced opaque — don't rely on new shape-type branches without testing. - Deploy hygiene: the whole regression existed because
1d02f12's source was committed while the binary was never deployed/tested — the committed renderer binary and its engine source must match.
Commits:
- Anchor2
4096ff6(pushed to GitHub): minimized-window render throttle + revert1d02f12text-gamma to baked. - a327ex-site
2f97d46(pushed to a327ex.com): renderer deploy (baked-gamma text + hang fix) + PLAN notes.
Remaining roadmap (next session): web delivery (WASM build, browser-<video>, HTTP range-stream, R2 + the music-video DMCA decision); M2b full ~106-video pull; per-post fidelity pass; small niceties (avatar circular-crop, X glyph, old-posts skin details).
🔒 Only the summary of this log is public. Private because it contains too many website internal details.