Replaces the software rasteriser (nv2a_pb_exec.c) on Linux. Code: src/vk/. Target: Honeykrisp (Asahi M2), Vulkan 1.3 dynamic rendering. Branch vulkan, worktree .claude/worktrees/vulkan.
cmake -S src/vk -B build-vk -G Ninja && ninja -C build-vk && build-vk/vkr_selftest out.bmp
The executor keeps parsing the pushbuffer, tracking state and running vertex programs on the CPU (nv2a_vsh_run). Its post-program vertices (Nv2aVshOutput: pixel-space pos, w, d0/d1, fog, 4×tex) go to vkr_draw instead of the per-pixel rasteriser. The vertex shader re-expands pos to clip space (xy/size*2-1, z/zmax, w) so the GPU clips and interpolates perspective-correctly. Raster was ~65–70% of executor time, VSH ~15%.
vkr_selftest).nv2a_backend.h, in the toolkit patch): draw / clear / flip callbacks; src/vk/vkr_backend.c registers with RECOMP_GPU=vk. Boots to the frontend; frames come from Vulkan (white: no textures yet). Only the main 32-bit linear surface goes to Vulkan; other targets stay software.sample_tex, cached by content hash, push descriptors, sampler per wrap/filter); intro movie renders. Left: stages 1-3, mips, cube maps, border colour, render-target-as-texture, per-frame hash cost.nv2a_combiner.c (words in a per-draw UBO, one shader), 4 texture stages with project2D/passthru modes, fog in the vertex shader. Select Character renders correctly. Left: cube maps, bump/dot-product stage modes, clip-plane stage, border colour, stencil.../xboxrecomp clone has uncommitted edits that differ from patches/xboxrecomp-local.patch (e.g. RECOMP_LOOP_QUANTUM); the main tree's session is using it. Do not edit it from this worktree: use a separate toolkit clone (XBOXRECOMP_DIR) at base 193e299 + this worktree's patch, and regenerate the patch from there.vkr_flip_submit submits a frame and recording continues in the other of two frame slots; a backend thread waits for it and copies it into the flipped surface a few ms after the flip.sub_001F8760 wrapper, same 0.0 answer). Showing the flare needs Vulkan occlusion queries.gl_FragDepth = w / zmax. The race's z is hyperbolic and sits within 1% of the far end, too coarse in the distance. The software rasteriser still uses z.| 2026-10-14 | Worktree vulkan from linux. Core + selftest on Honeykrisp: depth-tested triangles OK (5ee232b). |
| 2026-10-14 | Backend hook + glue; game builds in the worktree (private toolkit clone tk/, generated sources and game symlinked from the main tree). RECOMP_GPU=vk reaches the frontend, Honeykrisp, 640x480 target. Next: textures. |
| 2026-10-14 | Vulkan 1.4 required (push descriptors core). Stage-0 textures + blend + alpha test: intro movie frame correct under RECOMP_GPU=vk. |
| 2026-10-14 | Frontend menus on Vulkan look right (Select Mode screen). Menu frame rate: Vulkan 43–50 FPS (p50 18–23 ms) vs software 5–8 FPS. Race not tried yet (needs combiners, shadow-map RTs, fog). |
| 2026-10-14 | Black menu backgrounds: stage 0 disabled (stage_program&0x1F == 0) but a stale texture was still sampled. Fixed; backgrounds and panels now draw. Still to compare with software: ~10 px black strip at the left/right screen edge. RECOMP_VKR_TRACE=<flagfile> logs large draws while the file exists. |
| 2026-10-14 | Select Character: rider was transparent because the placeholder shader used d0.a; the vertex-program lighting puts junk there and the combiners produce the real alpha. Combiner GLSL port fixed it. |
| 2026-10-14 | Character screen 12 FPS: RECOMP_VKR_STATS=1 showed 700 of 1000 ms/s in texture lookup, i.e. hashing every bound texture's bytes on every draw (984 draws × up to 4 stages). Hash now memoised per texture per flipped frame: 47 FPS (p50 21 ms). Remaining per frame: flip readback ~3 ms (GPU sync + copy to guest memory), vkr_draw ~1 ms; the rest is guest code + CPU vertex programs. A texture rewritten mid-frame is only seen at the next flip. |
| 2026-10-14 | perf (6 s, character screen): note() (pushbuffer survey, linear scan per word) 33%, read_src 16% + nv2a_vsh_run 11% (CPU vertex programs), sched_yield 11%, Vulkan driver ~3%. note() made O(1). Frame stays ~19–20 ms: menus of any size cap at ~50 FPS, so that screen is probably at the game's own frame pacing (PAL?) — unconfirmed. Next speed target is races; CPU vertex programs (→ SPIR-V) are the biggest known cost. |
| 2026-10-14 | Worktree now has its own generated sources (lifted with this branch's overrides via the private tk/); the symlink to the main tree's gen/ broke when the other session regenerated. |
| 2026-10-14 | Found the shared toolkit clone diverges from the patch; plan a private clone for the backend hook. |
| 2026-10-14 | Race (Snow Jam) 23.6 → 52–54 FPS (p50 18 ms), from perf profiles: per-batch post-transform vertex cache (RECOMP_VSH_CACHE=0 off; 24 → 30); vertex programs pre-decoded once per upload and big batches run on the raster pool; raster pool enabled on POSIX (was _WIN32 only), batch flush threshold 1024 px, texture decode on the pool; LensFX visibility poll no longer blocks; software-method hand-off signalled by an event instead of a 1 ms poll (200 → 20 ms/s executor stall; 30 → 42); flip readback asynchronous, two frames in flight (5 ms/flip executor stall gone; 42 → 53). Near the game's ~50 Hz pacing now. |
| 2026-10-14 | Magenta HUD in races: vkr_set_target (the race intro changes the clip height 468–480) dropped the recorded command buffer, texture uploads included; those textures stayed cached empty until the 768 MB cache drop. Now submitted first. Palette address and contents are part of the texture key (P8 textures). W-buffering (CONTROL0 bit 16) emulated in the fragment shader, for trails seen through distant hills. |