JSRF HANDOVER -- THE WINDOWS ORACLE RENDERS, AND ITS THREE OPEN ITEMS ARE SHUT
Date: 2026-09-12 (Europe/London), early hours
From: Claude.

Supersedes CLAUDE_TO_CODEX_HANDOVER_2026-09-11_WINDOWS_RENDERS.txt. All three
of that handover's "things to do next" are answered below, two of them by the
same fix. Long form: docs/jsrf/progress/CLAUDE_PROGRESS_2026-09-11_CONTIG_
ALIASES_THE_HEAP.md.


0. WHAT CHANGED
===============
Physical offset N and XBOX_CONTIG_BASE + N did not name the same bytes on
Windows. The contiguous window was VirtualAlloc'd storage aliasing nothing, so
every block the guest filled through 0x80XXXXXX was invisible to a GPU
resolving the low offset -- and the separate bump arena that followed from it
climbed through the guest's own stacks and heap.

xbox_EnablePhysicalHeapAlias now has a Windows implementation (6fb8734). The
window is rebuilt at the end of layout init as committed storage below the
heap, a view of the RAM section across it, and committed storage above;
xbox_ContiguousAlloc then takes from the heap. RECOMP_PHYSICAL_HEAP_ALIAS=0
opts out and falls back to the floored arena.

The framebuffer has pixels. Every Windows run before this reported
nonzero=0/153600 for its whole life. A 260 s run now changes continuously,
repeatedly covering the full frame, with 5,108 texture copies and zero
rejected -- against roughly half rejected in every earlier run.


1. THE THREE ITEMS, ANSWERED
============================
(a) WHY SUBMISSION STOPS AFTER ~600 DRAWS. It does not any more. The 260 s run
    was still submitting when it was stopped: texture copies climbing linearly
    to 5,108, framebuffer changing at t=259, no fault, no outstanding notify
    deadlock. Judge this by the CPU executor's counters, NOT by
    "[PUSHER] draws=0" -- that line reads 0 on both hosts and CLAUDE.md already
    lists it as a known-bad shortcut.

(b) THE 0xBC60 VOICE LINK. Gone, and the absence is controlled. The walker's
    own throughput counter says it ran:

        baseline   [APU-VOICE] processed=16559     + 8 out-of-range reports
        aliased    [APU-VOICE] processed=1521632   + 0 out-of-range reports

    36x more voices walked and not one bad handle. The 8 in the baseline was
    the print cap, not a frequency; the list was being truncated every frame
    ("stopping this list"), which is why so few were processed. The garbage
    link was the arena writing over the voice list.

(c) A RING THAT HAS NEVER WRAPPED TO ITS BASE. Not a fault. macOS -- which
    renders, presents and reaches gameplay -- reports the same:

        win baseline 1    win aliased 0    macOS 0

    The healthy reference host never wraps to base either, so this says nothing
    about Windows. Item closed; do not spend a session on it.


2. THE NEW LEADING EDGE: THE APU FRONT END
==========================================
Rendering is fixed; audio submission is not, and it is now the clearest
remaining divergence. Same scene, same build:

        macOS    on=5 fe_methods=4369 set_current_voice=1390 processed=480096
        Windows  on=4 fe_methods=177  set_current_voice=12   processed=1521632

Windows walks three times as many voices and submits a twenty-fifth of the
front-end methods. Those two counters are the right ones and live in
src/apu/apu_vp.c, which both hosts compile: fe_methods and set_current_voice
localise a failure to the guest's submission loop rather than to MMIO routing,
and both are nonzero here, so the routing works and the loop runs short. The
register traffic confirms it -- RECOMP_APU_REG_TRACE shows Windows configuring
voice handles 0x40..0x43 once and then stopping, where macOS keeps
re-submitting.

CORRECTION, AND A WARNING ABOUT THIS EXACT REPORT. An earlier draft of this
handover said Windows "generates no audio frames at all", citing
[APU-PACE] batches=0 frames=0 and [APU-SDL2] prime=0. That was wrong, and it
was wrong in the way CLAUDE.md warns about. macOS uses the SDL2 backend and
Windows uses XAudio2; apu_sdl2.c compiles to stubs under _WIN32, so every
g_apu_sdl_* counter on that host is a variable with NO PRODUCER. Those zeros
are a definition. Whether Windows produces audio was, at that point, simply
unmeasured.

[APU-OUT] now reports the backend that is actually live and its own numbers --
submits offered, buffers landed, sample frames, and which of the three silent
early returns in xa2_submit_samples swallowed the rest. Read that line, not
the SDL2 block, when the host is Windows. It labels itself on both:

    Windows  [APU-OUT] backend=XAudio2 submits=15017 submitted=13104
             frames=3354624 gen_hz=41890 drops: inactive=0 full=1913 failed=0
    macOS    [APU-OUT] backend=SDL2 (XAudio2 counters below are inactive)
             submits=0 ... and [APU-PACE] batches=7500 frames=1920000 gen_hz=48006

So WINDOWS IS PRODUCING AUDIO -- 13,104 buffers and 3.35M sample frames in
90 s, with the only drops being ordinary back-pressure (the device queue full).
It runs at about 87% of nominal against macOS's 48 kHz, which is worth
understanding but is a different question from silence.

What is thin is the CONTENT, and that is where the front-end divergence lands:
four voices started against five, and voice configuration that stops after the
first pass. Chase that, not the output stage.

Note also [APU-PACE] subframes/se, which DO have a producer on both hosts and
are nearly equal (14976 vs 15040 at t=10 s). The APU core runs at the same rate
on both; it is the front-end submission and the output reporting that differ.

DO NOT TRUST [APUREG]'s "from sub_XXXXXXXX". It was the harness's thread-local
last-instrumented-function, which is whatever ran most recently on that thread
and not the writer. It confidently named sub_001664D0 for a burst of voice
configuration; sub_001664D0 is a 37-byte refcount release, `lock xadd [ecx+8]`
then maybe a vtable call, and it touches no MMIO at all. The macOS attribution
(sub_00147EBB) was equally wrong. The field is now printed as "guest~" to mark
it as a hint.

Use host_pc= instead. It is the faulting store itself, and

    x86_64-w64-mingw32-addr2line -f -e jsrf_first_fault.exe <host_pc>

resolves it exactly, which is the method 06-debugging.md prescribes. Both hosts
now record it (POSIX from the sigaction context, Windows from the VEH).

With it, every APU register write on Windows resolves into the statically
linked DSOUND -- nineteen distinct functions, all in sub_001A2xxx..sub_001A6xxx:

    sub_001A5E19 sub_001A5742 sub_001A368A sub_001A5671 sub_001A6160
    sub_001A5CD7 sub_001A586B sub_001A40F5 sub_001A3E58 sub_001A52F7
    sub_001A4E12 sub_001A5B82 sub_001A5B27 sub_001A5AF0 sub_001A5AB9
    sub_001A53AA sub_001A268D sub_001A22BC sub_001A2285

That is the submission loop, named. The macOS list, taken the same way (dladdr
resolves it inline there), has 21 entries and Windows's 19 are a strict subset.
The two that macOS has and Windows never reaches:

    sub_001A3570   (87 configurations in 55 s)
    sub_001A49A7   (1)

Both do the same thing: SET_CURRENT_VOICE to handle 0x44, VOICE_LOCK, release.
**They are the only two functions that touch voice 0x44**, and that is the
whole of on=5 against on=4. The fifth voice is never configured on Windows
because neither function runs.

One level up, sub_001A3570 has a single caller, sub_001A43DA, which gates it:

    0x001A43F0  mov al, byte ptr [esi + 0x12]
    0x001A43F3  and al, 3
    0x001A43F5  cmp al, 3
    0x001A43F7  jne 0x1a4484          ; skip sub_001A3570

The gate is NOT what fails. RECOMP_DSOUND_GATE=1 probes that branch:

    macOS    this=80954C64 dword+0x10=0303FFFF byte+0x12&3=3 CONFIGURES
    Windows  (no lines at all)

sub_001A43DA is never reached on Windows. Controlled: the env var was set,
other probes in the same generated file fired in the same run (9 [NOTIFY],
9 [RESERVE]), and the run reached 1,802 texture copies -- so the silence is the
measurement, not a dead instrument.

Next level up, and where to start:

    sub_001A43DA  called by sub_0019ECA3, sub_001A464B, sub_001A46F0
    sub_001A49A7  called by sub_0019EDCE
    sub_0019ECA3  called by sub_0019ECF8, sub_0019F1F4
    sub_0019EDCE  called by sub_0019F214

Note sub_0019F1F4 and sub_0019F214 are 32 bytes apart -- adjacent methods on
the same object, one feeding each missing writer. A single gate above both is
the likely shape. Probe those two entries next.

Worth knowing while reading it: the DSOUND object macOS gates on lives at
0x80954C64, inside the contiguous window. That window aliased the guest's own
stacks and heap on this host until today (section 0), so any conclusion about
DSOUND state drawn from a run older than commit 6fb8734 is unsafe.

Start with the submission loop, and start by reading what increments each
counter -- including the ones that look like they already answered.


3. BUILD AND RUN
================
Unchanged from the previous handover -- cross-compile with the mingw toolchain,
build ONLY the jsrf_first_fault target, drive it from a .bat inside the
CX_BOTTLE. RECOMP_AC97_READY=1 is still mandatory.

New switches:
  RECOMP_PHYSICAL_HEAP_ALIAS=0   fall back to the old two-pool arena
  RECOMP_CONTIG_VERIFY=1         compare both views of a surface where the
                                 model resolves it; POSIX is its positive
                                 control and must report "match"
  RECOMP_TEXTURE_SLOT=<index>    one texture-cache slot's whole life, uncapped

RECOMP_CONTIG_FROM_HEAP is gone. It existed for one session, removed the crash
by making the window inert, and was never a fix.


4. DO NOT RE-RUN THESE
======================
  the 0xBC60 voice link           (b) above, with a positive control
  the ~600-draw submission stall  (a) above, 260 s and still going
  the ring that never wraps       (c) above, macOS does the same
  RECOMP_STORE_WATCH on a page a bulk copy touches -- the first toucher of the
    texture-cache page is a lifted rep stosd, the VEH decoder completes single
    stores only, and the run dies inside ntdll before reaching the writer


5. WHAT I WOULD NOT DO
======================
Do not read [PUSHER] clears/flips/draws or the D3D11 sink's unhandled-method
list as evidence about Windows rendering. On the aliased run they are
0/0/0 and 100% unhandled while the framebuffer is demonstrably changing --
the drawing goes through the CPU executor, counted separately. CLAUDE.md lists
both as known-bad shortcuts and this run is another instance.

Do not treat the triangle total as progress. It fell from 22.2M to 5,108 when
the alias landed, and that was the improvement: the large figure was a software
rasteriser sweeping blank memory as fast as it could.
