Skip to content

fix(earthwidget): Filament KMP 0.7.10, no stale 3D widgets nor shader compile per tab on Windows - #699

Merged
kdroidFilter merged 1 commit into
masterfrom
fix/windows-filament-0.7.10
Oct 17, 2026
Merged

kdroidFilter merged 1 commit into
masterfrom
fix/windows-filament-0.7.10

Conversation

@kdroidFilter

@kdroidFilter kdroidFilter commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Problem (Windows only)

  • 1-2 s latency on every tab open: each new Home compiles its 3D widgets' shaders again. On ANGLE that means HLSL translation plus D3DCompiler, which blocks the UI thread in renderStandaloneView for ~80 ms on the first render of each view, then ~170 ms once the models are loaded.
  • Rendering errors: the window kept showing the first content of one of the two D3D11 textures shared with Filament. A readback showed Filament renders the Earth into both textures, yet the widget could show the Earth missing, a stale frame, or garbage. The cause is a legacy shared texture without a keyed mutex: nothing synchronizes Filament's device with the window's.

Both only show up in the native build (ANGLE). Under ./gradlew run, Filament fails to create its engine on ANGLE (Can't get OpenGL version) and falls back to Vulkan. That is a separate issue, not addressed here.

Fix: Filament KMP 0.7.10

  • The shared textures carry a keyed mutex (D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX), held while Filament renders into them. Nucleus already detects this mode and copies each frame out under the mutex, so Nucleus needs no change.
  • A process-wide cache of program binaries through Filament's blob cache (Platform::setBlobFunc), capped at 32 MB. A rebuilt material (a new tab) loads its programs from it instead of compiling them again.

Verification (native build, RTX 5060 Ti, new tabopen scenario)

before after
UI-thread stall from Filament per new tab ~80 + ~170 ms per view, on every tab none after the first tab (only the very first Home still compiles)
Earth after an open visible at 800 ms, then gone at 1500 ms / 2500 ms visible from 400 ms and stays

New e2e scenario: ZAYIT_E2E_SCENARIO=tabopen (with ZAYIT_E2E_QUICK=1).

Before merging

  • Filament KMP 0.7.10 available on Maven Central (publish in progress)

… compile per tab on Windows

Filament KMP 0.7.10 fixes two Windows (ANGLE) issues of the Home's 3D widgets:
- the D3D11 textures shared between Filament's device and the window's had no keyed
  mutex, so the window kept showing a texture's first frame (the Earth missing once its
  model loaded) or garbage;
- every new tab compiled its widgets' shaders again through D3DCompiler, holding the UI
  thread some 250 ms a view; the program binaries are now cached for the process.

Adds the e2e scenario that reproduces both (ZAYIT_E2E_SCENARIO=tabopen): tabs opened
and switched on the default Home, UI-thread stalls sampled with their stacks, and
exports at fixed times after an open.

Signed-off-by: Elie G. <elyahou.hadass@gmail.com>
@kdroidFilter
kdroidFilter marked this pull request as ready for review October 17, 2026 23:33
@kdroidFilter
kdroidFilter merged commit 6757598 into master Oct 17, 2026
3 of 9 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant