Loading…
a327ex.com

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/). Read PLAN.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_iteration in Anchor2/engine/src/anchor.c) is while(running) main_loop_iteration(); with NO sleep — pacing relies entirely on SDL_GL_SwapWindow vsync, and there was no handling for MINIMIZED/HIDDEN (only FOCUS_GAINEDtiming_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_all is a no-op with no video loaded (so it's core-loop, affects all Anchor2 games, not video-specific). vsync_enabled defaults true, render_uncapped false.
  • Design call: per-frame SDL_GetWindowFlags query (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-timestep update() 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 0 u_text_gamma, proving it was built from 9015fec — the commit BEFORE 1d02f12 ("luminance-directional text gamma"). 1d02f12 was committed but never rebuilt/deployed/tested for the renderer (its deploy was blocked the session it landed — confirmed by reading last session's transcript cd12f1cc = "Anchor Website 4" = Private Session 8).
  • First (wrong) workaround: built the minimize fix on the 9015fec base, skipping 1d02f12 → working text but reverted the quality work. User pushed back wanting last session's good text.
  • Healing HEAD: a one-shot fprintf in layer_render logged [textdbg] g_font_gamma=1.6000 u_text_gamma_loc=-1 — the u_text_gamma uniform (used only in the glyph branch) was STRIPPED by the GLSL linker (loc -1) → read 0 → ge=1/0.001=1000pow(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. So vType=7.0 / SHAPE_TYPE_TEXT quads produce zero fragments on this GPU, while identical vType=2.0 sprites draw fine (vertex shader passes vType cleanly; sprites prove the aType attribute works) — an unexplained driver/shape-type quirk.
  • Final fix: revert glyphs to the SPRITE path (process_glyphbatch_add_uv_quad) with coverage gamma BAKED into the atlas alpha (font_blit_to_buffer, the 9015fec look the user likes). Kept 1d02f12's browser-quality image downscaling. Removed dead SHAPE_TYPE_TEXT, batch_add_glyph_quad, the shader text branch, and the u_text_gamma uniform. 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 vType shape-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 + revert 1d02f12 text-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.