Skip to content

fix: Apple platform and FFI fixes from running a three.js app on Bloom - #176

Merged
proggeramlug merged 1 commit into
codex/rendering-wip-integrated-20260727from
fix/apple-platforms-and-ffi
Nov 6, 2026
Merged

proggeramlug merged 1 commit into
codex/rendering-wip-integrated-20260727from
fix/apple-platforms-and-ffi

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Stacked on #175. Found while running tuichess 3D, a three.js game compiled by Perry, on macOS, iOS, iPadOS and tvOS.

  • Camera clip planes: new setCameraClipPlanes(near, far). begin_mode_3d used a fixed 0.01..1000, which at about 15 units from the camera resolves only about a millimetre of depth. Surfaces 1 mm apart z-fought, and TAA jitter made it worse. Changing the planes invalidates TAA history.
  • Perry string headers: Perry 0.5.1663 sets runtime-internal hint bits (0x1c is common on literals). These don't change the payload, so they're no longer treated as an ABI mismatch. Only HAS_LONE_SURROGATES changes decoding.
  • createTextureRgba8: with alpha >= 128, a << 24 is negative in JS, and the u32 FFI slot saturated it to 0. >>> 0 keeps the value unsigned.
  • Display scale and safe-area insets: new getDisplayScale and getSafeAreaInset. iOS reports them every frame from the trait collection and safeAreaInsets. Other platforms report 1 and 0 (display.rs).
  • Touch taps: iOS delivers touches on the UI thread, so a whole tap could start and end between two begin_frames and be lost. Press and release are now latched until the next frame.
  • tvOS: new setMenuButtonExits(on) switches whether Menu leaves the app or reaches the game.
  • Jolt build cache: Apple simulators now get their own cache (target ABI sim). A shared cache handed simulator objects to a device link.

Tested: cargo test --release --lib in native/shared (483 passed), and the macOS build. These changes ran in tuichess 3D on macOS, an iPad Pro and the iOS simulator.

Found while running tuichess 3D (a three.js game compiled by Perry) on
macOS, iOS, iPadOS and tvOS.

- Camera clip planes: setCameraClipPlanes(near, far). begin_mode_3d used a
  fixed 0.01..1000, which at ~15 units from the camera resolves only about a
  millimetre of depth: surfaces 1 mm apart z-fought (made worse by TAA
  jitter). Changing the planes invalidates TAA history.
- Perry string headers: Perry sets runtime-internal hint bits
  (JSON_ESCAPE_FREE, WTF8_VALIDATED, more in 0.5.1663: 0x1c is common on
  literals). They don't change the payload, so they are no longer treated as
  an ABI mismatch; only HAS_LONE_SURROGATES changes decoding.
- createTextureRgba8: with alpha >= 128, `a << 24` is negative in JS and the
  u32 FFI slot saturated it to 0 (`>>> 0` keeps it unsigned).
- Display scale and safe-area insets (getDisplayScale, getSafeAreaInset):
  iOS reports them every frame from the view's trait collection and
  safeAreaInsets; other platforms report 1 and 0 (display.rs).
- Touch taps: iOS delivers touches on the UI thread, so a whole tap could
  start and end between two begin_frames and be lost; press/release are
  latched until the next frame.
- tvOS: setMenuButtonExits(on) switches whether Menu leaves the app or
  reaches the game, as a game's top level does.
- Jolt build cache: Apple simulators get their own cache (target ABI "sim");
  a shared one handed simulator objects to a device link.
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b22cc001-5b84-4ce5-a6c4-db9678dc83ba

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@proggeramlug
proggeramlug changed the base branch from codex/docs-audit-fixes to codex/rendering-wip-integrated-20260727 November 6, 2026 15:47
@proggeramlug
proggeramlug merged commit 6164ad3 into codex/rendering-wip-integrated-20260727 Nov 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant