Repository navigation
chore(sokol): un-pin from labelle-toolkit/sokol-zig fork; use upstream - #134
Conversation
The fork's `feat/expose-cached-metal-drawable` branch restored a `sapp_metal_get_current_drawable` accessor for the early Path B Metal/IOSurface readback experiment (#128). Path A (#132 / v0.22.0) renders directly into IOSurfaces via offscreen render targets and never reaches for the post-frame drawable, so the fork patch is vestigial. Re-pin to floooh/sokol-zig@8b1a651 (current upstream master, the exact commit the fork was branched from). See floooh/sokol#1510 (closed) for the upstream rationale. `zig build test`: 16/16 steps green, 305/309 pass + 4 skipped. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PR SummaryLow Risk Overview Updates the inline comment to document why the fork was previously required for a Metal drawable accessor and why it’s no longer needed with the current IOSurface offscreen render-target approach. Reviewed by Cursor Bugbot for commit d72911d. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Code Review
This pull request updates the sokol dependency in backends/sokol/build.zig.zon to point back to the upstream floooh/sokol-zig repository, replacing the previous labelle-toolkit fork. The change includes an updated hash and revised comments explaining that the fork's specific Metal/IOSurface readback functionality is no longer required due to architectural changes. I have no feedback to provide.
Minor release completing the **sokol-Metal Path A** stack: - **#133 / #135** — route the game's `sg.beginPass` into the Path-A offscreen IOSurface render target. New gfx-layer shim in `backends/sokol/src/window.zig` (`setEditorRenderTarget` / `clearEditorRenderTarget`); new template slot `{{preview_pre_render}}` fires before the game render to arm the shim with the current ring slot's `sg.View` + `sg.Attachments`. The existing `{{preview_readback}}` slot disarms it and calls `signalSlotReady` after the render. - **#134** — un-pinned `backends/sokol/build.zig.zon` from the labelle-toolkit/sokol-zig fork (`feat/expose-cached-metal-drawable` branch) back to upstream `floooh/sokol-zig@8b1a651e`. Path A doesn't need the fork's `sapp_metal_get_current_drawable` accessor. Together with assembler v0.22.0's Path A scaffolding and engine v1.37.4's `getIOSurfaceAt`/`signalSlotReady` APIs, the sokol-Metal PIE producer is now **end-to-end functional**: the game renders directly into IOSurface-backed `sg.Image`s, the editor samples them zero-copy via `CGLTexImageIOSurface2D`, no post-frame blit, no drawable lifetime concerns. Plus bonus latent compile fix from #132's Path A bringup that codegen tests didn't catch (#135 surfaced it during live build). Review-fix from #135: null-check `makeImage`/`makeView` returns + extend the rollback loop to cover the just-failed slot's partial state (caught a leak path). Out of scope: the sokol-zig fork repo itself (un-archive cleanup is a separate task; harmless to leave it alive). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
backends/sokol/build.zig.zon's.sokoldep from thelabelle-toolkit/sokol-zigfork (branchfeat/expose-cached-metal-drawable) to upstreamfloooh/sokol-zig@8b1a651e— the commit the fork was branched from.Why
The fork's only patch exposed
sapp_metal_get_current_drawable, which the early Path B Metal/IOSurface readback (#128) needed to grab the just-rendered drawable. Path A (#132 / v0.22.0) flipped the producer side: the engine owns an offscreen IOSurface-backed render target and sokol writes straight into it viasg_image.mtl_textures[…]. Path A never reads the post-frame drawable, so the fork patch is vestigial. floooh/sokol#1510 (closed) confirmed the offscreen render target is the canonical approach.The fork repo stays alive for now; archiving it is a separate low-priority cleanup.
Test plan
zig build test --summary all— 16/16 steps green, 305/309 pass + 4 skipped (matches v0.22.0 baseline).backends/sokol/build.zig.zonreads cleanly.🤖 Generated with Claude Code