← board

Demo — real-time auto-zoom Mandelbrot with a per-target ASM iteration kernel

Why this demo (and why FLOAT is fine here)

The existing Mandelbrots are deliberately portable (Double / Q4.28) — the point there is a deterministic cross-target checksum. THIS demo is the opposite: it is allowed to be optimized, because a real Mandelbrot's hot loop is a tiny hand-written kernel. So it doubles as a showcase of the inline-asm frontend: a small per-target asm iteration kernel (x86-64 SSE2, aarch64 NEON/VFP, i386 x87/ SSE, arm32 VFP) computes the escape count for a pixel (or a whole scanline), called from the parallel scanline loop. That is honest — we advertise "you can drop to asm where it matters", and this proves it — while the portable kernels stay the correctness oracle.

Goal (the "usual attractive stuff")

An interactive/animated Mandelbrot that looks good:

  1. Auto-zoom — cycle through a handful of well-known deep-zoom target points (e.g. seahorse valley -0.743643887037, 0.131825904205; the classic -0.7436447860, 0.1318252536; a minibrot at -1.25066, 0.02012; Misiurewicz points), zooming in smoothly then out / cutting to the next. Precomputed path, no interaction required.
  2. Double-buffer + swap — render the next frame into a back buffer while the front is shown; swap on completion (tear-free).
  3. Palette rotation — cycle the colour LUT each frame for the shimmering-band look; cheap (LUT index offset), independent of the escape counts.
  4. Image rotation — optional slow rotation of the sampling basis (rotate the complex-plane axes per frame) for extra motion.
  5. Parallel renderparallel(pdOnDemand) for row := ... over scanlines (or tiles), each worker calling the asm kernel; on-demand distribution because deep zooms have very uneven per-row cost (in-set rows hit MAXIT).

Surfaces (phase it)

The asm kernel (the interesting bit)

function EscapeAsm(cre, cim: Double; maxit: Integer): Integer; — one per target, behind {$ifdef CPU*}, using the inline-asm frontend (asm ... end, or an .asm-frontend unit). Kernel = the z:=z²+c escape loop in registers:

Constraints

Acceptance

Log