Skip to content

Rebase fork changes onto upstream makepad/work - #41

Draft
cursor[bot] wants to merge 2767 commits into
devfrom
cursor/upstream-branch-rebase-4013
Draft

cursor[bot] wants to merge 2767 commits into
devfrom
cursor/upstream-branch-rebase-4013

Conversation

@cursor

@cursor cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Weekly rebase of the dalbrecht/makepad fork onto upstream makepad/makepad.

Upstream's default branch main is still 506ec0510 (Oct 31, Workspace, cargo-makepad, builder and docs), the same commit as last week's PR #40. Development continued on work (fc3dc4ed7, Nov 13). release (dd024da0d, tag release-2026-11-06.5) is an ancestor of work. This PR rebases the fork onto upstream/work so it picks up that week of upstream instead of repeating #40.

Replay started from last week's rebased tip (3570a96b1, first parent of origin/cursor/upstream-fork-rebase-e7cd). git rebase upstream/work carried the fork commits onto that tip. The macOS system-font outline test fix was skipped: upstream removed that module, and fonts now load through HostBuf.

The fork still keeps:

  • Font loading returns Option. Scan and system-fallback callers skip a family that has not loaded.
  • Cx::init_script_vm() stays split out of Cx::new() and is idempotent. New shader tests call it before with_vm.
  • wasm32 ValueMap compiles the HashMap spill out, including reserve. Native spill keeps K: Hash and #[relax_api(plain, run)].
  • Scope-uniform script objects are pinned from the HAL shader compiler and the wasm register_compiled_shader path.
  • Automatic GC stays off on wasm32.
  • TextFlow::reset_draw_state is kept next to upstream last_line_free_space.
  • AnimatorState.apply stays a rooted ScriptObjectRef and is not marked static.

The tip merge (6173b5318) only connects this history to origin/dev so GitHub can open the pull request. Its tree matches the rebased commit bb4117507.

Validated with Rust 1.100.0:

  • cargo +stable check --release -p makepad-draw -p makepad-platform -p makepad-widgets -p makepad-script -p makepad-example-splash
  • cargo +stable test --release -p makepad-script (the compute-kernel tests need spirv-val; 12 passed once it is installed)
  • cargo +stable test --release -p makepad-draw --lib (225 passed)
  • cargo +stable check -p makepad-platform -p makepad-script -p makepad-widgets --target wasm32-unknown-unknown
Open in Web View Automation 

Admin and others added 30 commits November 6, 2026 20:18
3 files, +24 -19. Areas: libs/vulkan, tools/vulkan_codegen.

Part 1 of 5 of work tip 9cd5b26af8 (with commercial f59853273e).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 files, +1093 -373. Areas: tools/run, libs/relax.

Part 2 of 5 of work tip 9cd5b26af8 (with commercial f59853273e).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 files, +11 -1. Areas: platform/shader.

Part 3 of 5 of work tip 9cd5b26af8 (with commercial f59853273e).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 files, +20 -6. Areas: platform/hal.

Part 4 of 5 of work tip 9cd5b26af8 (with commercial f59853273e).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 files, +207 -68. Areas: libs/devhub.

Part 5 of 5 of work tip 9cd5b26af8 (with commercial f59853273e).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 files, +23 -6. Areas: libs/zune, libs/apple_sys.

Part 1 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 files, +323 -38. Areas: libs/git, libs/bounded_http, libs/csg, libs/live_id, libs/math, libs/workspace.

Part 2 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
155 files, +8365 -903. Areas: libs/relax, tools/run.

Part 3 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 files, +765 -227. Areas: platform/script, platform/shader.

Part 4 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
74 files, +3931 -1052. Areas: platform/hal, platform/src, libs/remote, platform/video, platform/cpu_budget.

Part 5 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 files, +1716 -302. Areas: libs/app_registry, code_editor/src, libs/image_tiles, widgets/core, draw/src, libs/makepad_test, widgets/families, code_editor/tests, draw/tests.

Part 6 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 files, +7934 -855. Areas: libs/devhub, apps/devhub.

Part 7 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 files, +1371 -309. Areas: libs/csg, libs/milkdrop.

Part 8 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 files, +1575 -182. Areas: libs/audio_synth, libs/beat, libs/score_player.

Part 9 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 files, +392 -61. Areas: libs/ai, apps/aichat, apps/aihub, apps/translator, libs/diffusion, libs/model_install.

Part 10 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files, +8 -8. Areas: apps/browser, apps/browser_host.

Part 11 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 files, +501 -117. Areas: libs/xr_stream, apps/xr_bridge, apps/xr_remote, examples/xr.

Part 12 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 files, +609 -150. Areas: apps/wm, tools/arch_usb, apps/deskhost, apps/desklink, apps/task, apps/terminal, apps/wm-phone, libs/wayland_server.

Part 13 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 files, +397 -235. Areas: apps/amp, apps/devhub_panel, examples/text_atlas_stress, apps/calculator, apps/calendar, apps/camera, apps/clock, apps/code, apps/fabric, apps/files, apps/finance, apps/flow and 15 more.

Part 14 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 files, +1144 -2. Areas: tools/arch_installer, Cargo.toml, docs/agents.

Part 15 of 15 of work tip 2852b8c528 (with commercial dbdb570ff7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 files, +2681 -631. Areas: libs/relax, tools/run, libs/relax_api.

Part 1 of 13 of work tip 20432cfc83 (with commercial a049c32099).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 files, +744 -100. Areas: platform/script, splash.md.

Part 2 of 13 of work tip 20432cfc83 (with commercial a049c32099).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 files, +2569 -541. Areas: platform/hal, platform/src, libs/remote, platform/cpu_budget, platform/network, platform/Cargo.toml.

Part 3 of 13 of work tip 20432cfc83 (with commercial a049c32099).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 files, +535 -930. Areas: widgets/core, draw/src, libs/makepad_test, draw/Cargo.toml, widgets/families.

Part 4 of 13 of work tip 20432cfc83 (with commercial a049c32099).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 files, +5007 -996. Areas: libs/devhub, apps/devhub, tools/devhub.

Part 5 of 13 of work tip 20432cfc83 (with commercial a049c32099).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 files, +5380 -264. Areas: libs/csg, libs/box3d.

Part 6 of 13 of work tip 20432cfc83 (with commercial a049c32099).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 files, +19 -1. Areas: libs/score_live.

Part 7 of 13 of work tip 20432cfc83 (with commercial a049c32099).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 files, +2472 -317. Areas: libs/ai, apps/aichat, apps/aihub, apps/translator.

Part 8 of 13 of work tip 20432cfc83 (with commercial a049c32099).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files, +8 -8. Areas: apps/browser, apps/browser_host.

Part 9 of 13 of work tip 20432cfc83 (with commercial a049c32099).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 files, +925 -166. Areas: libs/xr_stream, apps/xr_remote, xr/src, xr/tests, apps/xr_bridge.

Part 10 of 13 of work tip 20432cfc83 (with commercial a049c32099).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dalbrecht and others added 30 commits November 14, 2026 08:03
The `color` property on DrawSvg was a bare shader variable (compiled as
a constant), so the #[live] field value never reached the GPU at runtime.
Changing it to `instance(...)` makes it per-instance data that syncs
from the Rust struct to the GPU draw call.

Also fix get_color to do color REPLACEMENT (not multiplication). The
previous formula `color.rgb * color.a * base.a` multiplied by the vertex
color RGB, which produced black when the vertex color was black (from
currentColor). The new formula `color.rgb * base.a` replaces RGB
entirely while preserving the alpha shape from tessellation.
Replace the O(n²) linear scan in webgl_compile_shaders() with a
HashMap lookup. The previous code compared vertex+pixel GLSL source
strings against ALL existing shaders for each new shader in the
compile set. For apps with many draw types (~288 shader constructs),
this caused ~82,000 string comparisons that blocked Chrome's main
thread past its execution budget, hanging the browser tab.

The HashMap reduces deduplication from O(n²) to O(n) and eliminates
the Chrome hang for large WASM binaries.
…ebGL

When shader compilation fails (e.g., Script VM can't resolve a property
in the shader prototype chain), the draw list can retain references to
items beyond the live buffer bounds. This causes RuntimeError: unreachable
in WASM builds during the render pass after font loading.

Skip draw items with invalid indices instead of panicking. Add regression
tests verifying draw_item_id_at_order_index returns None for stale indices
after clear_draw_items.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…M OOB

CxDrawItems::clear() previously set used=0 but left buffer entries with
stale DrawCall kinds. When Areas or other code paths access draw_items
by index from a previous frame, they find stale DrawCall entries with
invalid shader/instance data, causing assertion panics in WASM builds.

Now clear() marks all live entries as CxDrawKind::Empty before resetting
the used count. Code that accesses stale entries safely skips Empty items
via the existing draw_call()/draw_call_mut() checks.

Also remove temporary size_of diagnostics from render_view.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When the Script VM fails to resolve a property during shader code
generation (e.g., 'key vertex not found in prototype chain'), it
outputs the literal 'unknown' as a placeholder. This produces invalid
GLSL that fails WebGL compilation, but the WASM side has already set
os_shader_id = Some(id), so the renderer proceeds with a corrupt
shader mapping — causing RuntimeError: unreachable in WASM builds.

Skip shaders whose generated GLSL contains 'unknown' before sending
them to WebGL. This leaves os_shader_id = None, so render_view
correctly skips draw items using the failed shader.

Also mark stale draw items as CxDrawKind::Empty in CxDrawItems::clear()
for defense-in-depth against stale buffer entry access.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e death

A single WASM trap (RuntimeError: unreachable) from corrupt shader
mappings kills the entire page because the uncaught error propagates
through the rAF callback chain. Subsequent frames would work fine
since shader compilation is a one-time operation, but the uncaught
error prevents them from ever running.

Wrap the wasm_process_msg/dispatch_on_app/free cycle in try/catch
to contain the error to a single frame, allowing recovery on the
next animation frame.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…g unwrap panic

GenVec check_generation panics on stale ScriptObject references, which
kills the WASM render loop. Stale refs are caused by platform-level Rust
structs holding ScriptObject handles outside the GC's reach. On WASM,
suppress the check — the reused slot data is compatible and the stale
access is harmless.

Also replace event_handler.take().unwrap() with if-let in cx_shared.rs.
After a panic corrupts state, the event handler is None on subsequent
frames, causing an infinite unwrap panic loop that floods the console.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Instead of skipping shaders whose GLSL contains 'unknown' type
placeholders (from unresolved Script VM properties), replace 'unknown'
with 'float' so the shader can still compile and render. This fixes text
rendering on WASM where the text shader's vertex function lookup fails
due to evaluation order differences.

Also reverts the value_deep change in object_method which caused OOB
crashes by traversing stale prototype chain references.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On WASM, shader stage functions (vertex, fragment) can be stored in
vec instead of map due to Script VM evaluation order differences. Add
a targeted vec key scan on WASM after the map lookup fails, without
the full value_deep traversal that causes OOB from stale string refs.

Also reverts the crude 'unknown' → 'float' GLSL string replacement
which broke shader compilation. Restores the skip-shader guard as
fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dumps the full prototype chain (map keys + vec keys) when the vertex
method lookup fails during shader compilation on WASM. This diagnostic
helps identify why the prototype chain differs from native.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The WASM compiler (LLVM → wasm32) miscompiles HashMap insertion when
map_insert is inlined into the caller, causing certain LiveId keys
(notably `vertex`) to be silently dropped during DSL evaluation. This
manifests as shader compilation failures ("key vertex not found in
prototype chain") and broken text rendering.

Adding #[inline(never)] on wasm32 prevents the miscompilation by
keeping map_insert as a separate function call, which changes the
LLVM optimization profile enough to produce correct code.

Also removes diagnostic logging from object_heap.rs and mod_shader.rs
that was used to trace the root cause.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds automated CI with check, clippy, test, wasm-check, and fmt jobs.
Runs on push to dev and fix/wasm-shader-batching, and on PRs to dev.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
After rebase onto dev, get_or_load_font returns Option. Add .expect()
in the caching test to unwrap it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The makepad-test runtime's UI tests spawn a subprocess build that
needs a GPU/display server. These fail on headless Ubuntu CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
All 5 examples with makepad-test UI tests need a GPU/display server
and fail on headless Ubuntu CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The full workspace has pre-existing upstream test failures:
- UI tests need display server (5 example crates)
- CRC32 SIMD mismatch on CI CPUs (fast_inflate)
- widget_tree test regressions (makepad-widgets)

Scope to the crates we actually maintain fixes for.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- loader.rs: handle Option return from get_or_load_font in tests
- layouter.rs: fix get_or_load_font_family Option handling with cloned()
- draw_svg.rs: premultiply RGB by color alpha for correct blending
- turtle.rs: return f64::MAX instead of panicking on empty turtle stack
- draw_glyph.rs: reset pending_flags after fill_layer to prevent sticky state

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
C dependencies compiled to wasm32 (e.g. tree-sitter) may reference
calloc, which is not provided by dlmalloc. Add calloc to the JS env
imports, implemented via the WASM module's exported malloc + zeroing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… bug

LLVM's wasm32 backend miscompiles both HashMap::insert and BTreeMap
internal navigation, silently dropping keys during DSL evaluation.
Replace ValueMap's internal storage with Vec<(K,V)> + linear scan.

Vec operations (array indexing + equality comparison) are too simple
for LLVM to miscompile. Performance is equivalent for the small maps
used here (typically 3-57 entries).

This replaces the fragile error!() workaround in map_insert which
only partially mitigated the issue.

Refs: #6

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract Script VM initialization from `Cx::new()` into a new
`Cx::init_script_vm()` method. On native platforms (desktop, Android,
ohos) the method is called synchronously right after construction,
preserving existing behavior. On WASM, initialization is deferred to
the first `wasm_process_msg()` call, allowing Chrome's event loop to
regain control after loading the binary and preventing the browser from
hanging during the expensive `script_mod()` registration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Don Albrecht <dalbrecht@users.noreply.github.com>
Co-authored-by: Don Albrecht <dalbrecht@users.noreply.github.com>
New upstream callers still assumed get_or_load_font_family returned a
font family directly. Keep the WASM-safe Option path, unwrap in tests,
and initialize the Script VM before with_vm in new draw tests.

Co-authored-by: Don Albrecht <dalbrecht@users.noreply.github.com>
Upstream line breaking added LaidoutText fields and TextStyle helpers that
still assumed a font family always loads. Keep the empty layout when the
family is missing, and return a hyphen or an empty shape instead of panicking.

Co-authored-by: Don Albrecht <dalbrecht@users.noreply.github.com>
New upstream text paths still called fonts() on the Option returned by
get_or_load_font_family. Skip the scan or fallback when the family has
not loaded instead of panicking.

Co-authored-by: Don Albrecht <dalbrecht@users.noreply.github.com>
Cx::new no longer builds the script VM, so backend compile tests that
enter with_vm need init_script_vm first.

Co-authored-by: Don Albrecht <dalbrecht@users.noreply.github.com>
Upstream shader tests call with_vm on a bare Cx. init_script_vm has to
run first or with_vm reports re-entrant access.

Co-authored-by: Don Albrecht <dalbrecht@users.noreply.github.com>
Records origin/dev as a second parent so GitHub can open a pull request.
The tree stays the rebased upstream/work tip.
Co-authored-by: Don Albrecht <dalbrecht@users.noreply.github.com>
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.

2 participants