Skip to content

feat(material): cache versioned static backgrounds - #65

Draft
Moriafly wants to merge 1 commit into
mainfrom
material-source-cache
Draft

Moriafly wants to merge 1 commit into
mainfrom
material-source-cache

Conversation

@Moriafly

Copy link
Copy Markdown
Owner

Add opt-in MaterialSourceMode.Static while preserving live rendering by
default and the previous MaterialSource binary entry point. Share
half-resolution material pixels between eligible consumers, reserve up to 16 MiB per source, retain at most one idle image, and fall back to Haze for unsupported geometry, multiple sources, inherited styles or readback errors.

Separate source registration and consumer leases from cache state, offscreen capture and material drawing so invalidation and resource ownership are explicit. Keep content changes under immutable version keys: cover loading, image updates and resolved theme-dependent inputs must update the key; the cache does not enumerate theme palettes or observe arbitrary content reads.

Add a navigable sample with cache, wallpaper, appearance and moving-panel controls, plus a non-debuggable Android benchmark variant and a script that exports raw frame timing, readback latency, memory and repeated comparisons.

Validation:

  • 17 desktop material rendering tests passed, including native-window pixels, geometry boundaries, budgets, readback failures and cancellation during a source version change, and inherited-style fallback and cache reentry.
  • Four hardware-rendered Android tests passed on the API 36.1 emulator.
  • The Android sample navigation/control/recreation test passed with real input.
  • The benchmark script completed a Mica/Small Dynamic-versus-Static smoke run with one 1000 ms sample per mode and exported reports. Static GPU time was slightly higher in that emulator run; this is not evidence of a speedup.
  • Desktop sample compilation and ui2/shared iOS metadata compilation passed. iOS binaries and runtime rendering were not tested on this Windows host.
  • javap confirmed both old and new MaterialSource JVM signatures.
  • git diff --cached --check passed.

Add opt-in MaterialSourceMode.Static while preserving live rendering by
 default and the previous MaterialSource binary entry point. Share
half-resolution material pixels between eligible consumers, reserve up to
16 MiB per source, retain at most one idle image, and fall back to Haze for
unsupported geometry, multiple sources, inherited styles or readback errors.

Separate source registration and consumer leases from cache state, offscreen
capture and material drawing so invalidation and resource ownership are
explicit. Keep content changes under immutable version keys: cover loading,
image updates and resolved theme-dependent inputs must update the key;
the cache does not enumerate theme palettes or observe arbitrary content reads.

Add a navigable sample with cache, wallpaper, appearance and moving-panel
controls, plus a non-debuggable Android benchmark variant and a script that
exports raw frame timing, readback latency, memory and repeated comparisons.

Validation:
- 17 desktop material rendering tests passed, including native-window pixels,
  geometry boundaries, budgets, readback failures and cancellation during a
  source version change, and inherited-style fallback and cache reentry.
- Four hardware-rendered Android tests passed on the API 36.1 emulator.
- The Android sample navigation/control/recreation test passed with real input.
- The benchmark script completed a Mica/Small Dynamic-versus-Static smoke run
  with one 1000 ms sample per mode and exported reports. Static GPU time was
  slightly higher in that emulator run; this is not evidence of a speedup.
- Desktop sample compilation and ui2/shared iOS metadata compilation passed.
  iOS binaries and runtime rendering were not tested on this Windows host.
- javap confirmed both old and new MaterialSource JVM signatures.
- git diff --cached --check passed.
@Moriafly
Moriafly marked this pull request as draft October 24, 2026 07:03
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