makepad/platform/script
Kevin Boos baa43c46a3
Animate draw_pass.time shaders on every backend, and repaint only the passes that use them (#1305)
* Shaders: detect `draw_pass.time` reads on every backend

`uses_time` came from searching the generated source for `draw_pass->time`, which only
Metal emits (GLSL and WGSL write `unibuf_draw_pass.time`, HLSL `u_io_draw_pass.f_time`).
So on Android, Linux, Windows and the web a time-driven shader like `LoadingSpinner`
never kept its pass repainting, and it froze whenever nothing else redrew.

The shader compiler now flags the read itself in `handle_field`.

* Repaint only the passes that draw a time-driven shader

A shader reading `draw_pass.time` made `compute_pass_repaint_order` re-dirty every live
pass in every window, so one spinner also re-rendered cached views every frame.
* backends set `CxDrawPass::repaint_next` on the pass they paint (a time shader drawn, or a
  skipped draw that must retry), and only those passes repaint; `demo_time_repaint` now
  just keeps the frame loop awake
* `draw_pass.time` comes from `Cx::pass_time`, whose origin rebases while nothing
  time-driven is on screen, so the f32 stays precise in long-running apps
* closed windows' passes stop repainting, and Android overlays every open popup

* Windows: keep polling while a time-driven pass needs its next frame

The event loop never looked at `demo_time_repaint`, so a `LoadingSpinner` froze right
after its first paint. Both EventFlow decisions now include it, and a tick that presents
nothing because it only painted an offscreen time pass sleeps 8 ms instead of spinning.

* OpenHarmony, hosted Android: keep repainting while a time-driven pass needs its next frame

Neither loop looked at `demo_time_repaint`, so a `LoadingSpinner` froze right after its
first paint: OpenHarmony's vsync handler only repainted when a pass was already dirty, and a
WM-hosted Android child never asked its host for another tick. The hosted child now also
takes `draw_pass.time` from `Cx::pass_time` like every other backend.

* LoadingSpinner: remove the unused `border_size` uniform

The pixel shader never read it (the stroke is `stroke_width`), so setting it did nothing.

* Progress, StatusSpinner: only read the pass clock while something moves

`ProgressBarFlat`/`ProgressRingFlat` read `draw_pass.time` in the same shader as their fill,
and `StatusSpinner` drew its time shader even when quiet or showing a finished mark, so all
of them repainted their pass every frame while nothing moved.
* the shaders read the time through `self.clock()`, and a twin of `draw_bg` with the other
  clock (`draw_sweep` while indeterminate, `draw_still` once a mark has finished) is drawn in
  its place, so only a moving sweep or arc reads the pass clock
* `apply_draw_twin` builds each twin from the applied `draw_bg`, so every override reaches it
* a quiet `StatusSpinner` draws nothing and just keeps its space
2026-10-12 22:39:41 +02:00
..
derive Script derive: reload a field back to its own #[live] default (#1278) 2026-10-03 09:26:30 +02:00
src Animate draw_pass.time shaders on every backend, and repaint only the passes that use them (#1305) 2026-10-12 22:39:41 +02:00
std Constrain Splash external I/O to the host service bridge (#1243) 2026-09-25 00:56:09 +02:00
test platform: rename the CPU simulated-GPU backend from headless to gpusim 2026-09-15 13:40:28 +02:00
tests Script derive: reload a field back to its own #[live] default (#1278) 2026-10-03 09:26:30 +02:00
Cargo.toml platform: faster builds and sturdier runs -- #[derive(Script)] emits one helper call per field, studio-protocol no longer waits for script, an app's package dir, icons and bundle name rebuild only that app, MAKEPAD=gpusim builds again, and a contained panic on macOS no longer frees the windows under AppKit 2026-09-26 20:10:03 +02:00