Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
76311da
Android: deliver Back once, including the Android 13+ system gesture
ymote Oct 1, 2026
ba4cff3
openharmony: NDK input, native XComponent node, ArkWeb system browser
ymote Oct 1, 2026
e514ee4
stitch: a host call no longer leaves its handler's frame on the nativ…
ymote Oct 7, 2026
e3b9271
widgets: MAKEPAD_SPLASH_BUDGET_MS overrides a Splash entry's 64 ms bu…
ymote Oct 8, 2026
c1efe80
platform: an unpackaged build finds its resources beside the executable
sansanyixyz331 Oct 13, 2026
aff1f70
platform: read a font beside the executable, not only from the build …
sansanyixyz331 Oct 13, 2026
136e775
script: the VM query API: two functions, a fixture corpus and a semve…
RoooyHe Oct 13, 2026
ea79d6c
test(script-std): pin net.HttpRequest ignore_ssl_cert script round-trip
kkkkikun Oct 14, 2026
0153e2d
widgets: drain a splash isolate's task queue when host code leaves it
kkkkikun Oct 14, 2026
2e9d8b1
Script VM: value-less if/try/match arms unbalance the join pop (#492)
jscjscjscjscjsc Oct 14, 2026
050581b
Recover D3D11 initialization with the Windows WARP adapter
WeiR-h Oct 15, 2026
043e220
Prepare the shared pinned OctoScript node model for Windows CI
WeiR-h Oct 15, 2026
f5093f8
Expose the Windows SDK WARP driver enum value in existing bindings
WeiR-h Oct 15, 2026
7db2e1b
Preserve frozen font-manifest bytes on Windows checkouts
WeiR-h Oct 15, 2026
edd2bda
Exercise the existing release example on the actual Windows WARP backend
WeiR-h Oct 15, 2026
8911ded
Verify presented WARP frames after bounded startup and retain failed …
WeiR-h Oct 15, 2026
2e12042
win32: treat WA_CLICKACTIVE as focus gained
csheargm Oct 31, 2026
4ec079b
win32: paint a secondary window whose frame clock is ready during the…
csheargm Nov 3, 2026
1250e75
stitch: use sysv64 only on x86-64 Windows
BH3GEI Nov 6, 2026
d81d889
Merge pull request #32
ymote Nov 13, 2026
0b117dc
Merge pull request #106
ymote Nov 13, 2026
d8c9094
Merge pull request #121
ymote Nov 13, 2026
e819745
Merge pull request #122
ymote Nov 13, 2026
9ec3c76
Merge pull request #123
ymote Nov 13, 2026
d63b1d3
Merge pull request #124
ymote Nov 13, 2026
a4923d9
Merge pull request #126
ymote Nov 13, 2026
fb035af
Merge pull request #127
ymote Nov 13, 2026
42128fe
Merge pull request #132
ymote Nov 13, 2026
681eeee
Merge pull request #133
ymote Nov 13, 2026
e1678ea
Merge pull request #125
ymote Nov 13, 2026
1d03ed6
Merge pull request #109
ymote Nov 13, 2026
cd85d5d
Merge pull request #90
ymote Nov 13, 2026
7c82285
widgets: the task drain on isolate exit runs under the isolate's time…
ymote Nov 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,6 @@ Cargo.lock text

.gitattributes export-ignore
.gitignore export-ignore
.gitkeep export-ignore
.gitkeep export-ignore
# Frozen byte manifests use LF on every platform.
platform/tests/fixtures/font-assets-*-v1.txt text eol=lf
97 changes: 97 additions & 0 deletions .github/workflows/windows-renderer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Windows D3D11 renderer
on:
push:
branches: [windows-warp-fallback]
pull_request:
paths:
- 'platform/src/os/windows/d3d11.rs'
- '.github/workflows/windows-renderer.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
native-windows:
runs-on: windows-2025
timeout-minutes: 45
defaults:
run:
working-directory: makepad
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
path: makepad
- uses: actions/checkout@v4
with:
repository: OctoSense-org/Octoscript-Makepad
ref: 6cf2d90aa33ff4ae603f49c7557f3ecf986207f0
path: octoscript-makepad
persist-credentials: false
- run: rustup toolchain install 1.98.0 --profile minimal
- uses: Swatinem/rust-cache@v2
with:
workspaces: makepad -> target
- name: Check the native Windows platform
env:
RUSTUP_TOOLCHAIN: 1.98.0
run: cargo check -p makepad-platform --all-targets
- name: Run existing native platform tests
env:
RUSTUP_TOOLCHAIN: 1.98.0
run: cargo test -p makepad-platform --lib
- name: Build existing native example in release mode
env:
RUSTUP_TOOLCHAIN: 1.98.0
run: cargo build --release -p makepad-example-hello-world
- name: Exercise the existing example on native Windows WARP
shell: pwsh
timeout-minutes: 5
env:
MAKEPAD_D3D11_WARP: '1'
run: |
$ErrorActionPreference='Stop'
$sample=Join-Path $PWD 'local/agent_state/windows-warp-native'
New-Item -ItemType Directory -Path $sample -Force | Out-Null
$owned=Start-Process -FilePath (Join-Path $PWD 'target/release/makepad-example-hello-world.exe') -ArgumentList '--remote=8680' -WorkingDirectory $PWD -WindowStyle Normal -RedirectStandardOutput (Join-Path $sample 'stdout.log') -RedirectStandardError (Join-Path $sample 'stderr.log') -PassThru
try {
$ready=$false
for($attempt=0;$attempt -lt 45;$attempt++){
if($owned.HasExited){throw 'Owned example exited during startup'}
try {
$state=Invoke-RestMethod 'http://127.0.0.1:8680/s' -TimeoutSec 2
if($state.w.Count -gt 0){$ready=$true;break}
} catch {}
Start-Sleep -Milliseconds 500
}
if(!$ready){throw 'Native example remote endpoint did not become ready'}
$tree=Invoke-RestMethod 'http://127.0.0.1:8680/snap?all=1' -TimeoutSec 10
if(!($tree.s | Where-Object {$_.t -eq 'Hello GIF'})){throw 'Existing example widget tree was not rendered'}
$frame=Join-Path $sample 'native-warp.png'
Add-Type -AssemblyName System.Drawing
$drawn=$false
for($capture=0;$capture -lt 4;$capture++){
$candidate=Join-Path $sample ("native-warp-"+$capture+".png")
Invoke-WebRequest 'http://127.0.0.1:8680/g?raw=1' -OutFile $candidate -TimeoutSec 30
$image=[Drawing.Bitmap]::new($candidate)
try {
if($image.Width -lt 200 -or $image.Height -lt 150){throw 'Native frame dimensions invalid'}
$colors=[Collections.Generic.HashSet[int]]::new()
for($y=0;$y -lt $image.Height;$y+=8){for($x=0;$x -lt $image.Width;$x+=8){[void]$colors.Add($image.GetPixel($x,$y).ToArgb())}}
Write-Output ('Native WARP frame '+$capture+': '+$image.Width+'x'+$image.Height+', sampled colors='+$colors.Count)
if($colors.Count -ge 8){Copy-Item -LiteralPath $candidate -Destination $frame;$drawn=$true;break}
} finally {$image.Dispose()}
Start-Sleep -Seconds 1
}
if(!$drawn){throw 'Native frame stayed blank through bounded startup checks'}
$observed=(Get-Content (Join-Path $sample 'stdout.log') -Raw)+(Get-Content (Join-Path $sample 'stderr.log') -Raw)
if($observed -notmatch 'using Windows WARP software rendering'){throw 'Native WARP path was not observed'}
Get-FileHash -LiteralPath $frame -Algorithm SHA256 | Format-List
} finally {
if(!$owned.HasExited){try {Invoke-WebRequest 'http://127.0.0.1:8680/quit' -TimeoutSec 10 | Out-Null} catch {};if(!$owned.WaitForExit(20000)){Stop-Process -Id $owned.Id;throw 'Owned example did not exit gracefully'}}
}
- uses: actions/upload-artifact@v4
if: always()
with:
name: windows-warp-native-frame
path: makepad/local/agent_state/windows-warp-native/
if-no-files-found: error
3 changes: 3 additions & 0 deletions draw/src/text/system_fonts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ pub fn font_dirs() -> Vec<PathBuf> {
}
}
}
} else if cfg!(any(target_os = "android", target_env = "ohos")) {
// Android and OpenHarmony/HarmonyOS keep the system fonts here.
dirs.push(PathBuf::from("/system/fonts"));
} else if cfg!(windows) {
if let Some(windir) = std::env::var_os("WINDIR") {
dirs.push(PathBuf::from(windir).join("Fonts"));
Expand Down
63 changes: 36 additions & 27 deletions libs/stitch/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use {
error::Error,
extern_::UnguardedExtern,
extern_ref::UnguardedExternRef,
func::{Func, FuncEntity, UnguardedFunc},
func::{Func, FuncEntity, HostFuncEntity, UnguardedFunc},
func_ref::UnguardedFuncRef,
global::UnguardedGlobal,
mem::UnguardedMem,
Expand Down Expand Up @@ -40,9 +40,9 @@ use {
///
/// On 64-bit Windows platforms, the "C" ABI corresponds to the "win64" ABI. This ABI allows only
/// the first 4 arguments to be passed in hardware registers, regardless of their type. This is
/// insufficient for our needs, so on Windows platforms, we use the "sysv64" ABI instead.
/// insufficient for our needs, so on x86-64 Windows, we use the "sysv64" ABI instead.

#[cfg(not(windows))]
#[cfg(not(all(windows, target_arch = "x86_64")))]
pub(crate) type ThreadedInstr = unsafe extern "C" fn(
ip: Ip,
sp: Sp,
Expand All @@ -54,7 +54,7 @@ pub(crate) type ThreadedInstr = unsafe extern "C" fn(
cx: Cx,
) -> ControlFlowBits;

#[cfg(windows)]
#[cfg(all(windows, target_arch = "x86_64"))]
pub(crate) type ThreadedInstr = unsafe extern "sysv64" fn(
ip: Ip,
sp: Sp,
Expand Down Expand Up @@ -289,7 +289,7 @@ pub(crate) fn exec(
// Helper macros

/// A helper macro for defining a `ThreadedInstr` with the correct ABI.
#[cfg(windows)]
#[cfg(all(windows, target_arch = "x86_64"))]
macro_rules! threaded_instr {
($name:ident(
$ip:ident: Ip,
Expand All @@ -313,7 +313,7 @@ macro_rules! threaded_instr {
) -> ControlFlowBits $body
};
}
#[cfg(not(windows))]
#[cfg(not(all(windows, target_arch = "x86_64")))]
macro_rules! threaded_instr {
($name:ident(
$ip:ident: Ip,
Expand Down Expand Up @@ -561,6 +561,30 @@ threaded_instr!(call(
next_instr(ip, sp, md, ms, ix, sx, dx, cx)
});

/// Calls a host function on the shared stack, returning `false` (with the
/// error stored in `cx`) if it failed.
///
/// This lives out of line on purpose: the `Result` returned by the
/// trampoline is written through a pointer to a stack slot. If that slot
/// were in a handler's frame, its address would escape, LLVM could no longer
/// turn the handler's call to the next instruction into a sibling call, and
/// every host call would leave a frame behind on the native stack.
#[inline(never)]
unsafe fn call_host_func(func: &HostFuncEntity, sp: Sp, offset: usize, cx: Cx) -> bool {
let mut stack = (*cx).stack.take().unwrap_unchecked();
stack.set_ptr(sp.cast::<u8>().add(offset).cast());
match func.trampoline().clone().call((*cx).store, stack) {
Ok(stack) => {
(*cx).stack = Some(stack);
true
}
Err(error) => {
(*cx).error = Some(error);
false
}
}
}

threaded_instr!(call_host(
ip: Ip,
sp: Sp,
Expand All @@ -576,20 +600,12 @@ threaded_instr!(call_host(
let (offset, ip) = read_imm(ip);
let (mem, ip): (Option<UnguardedMem>, _) = read_imm(ip);

let mut stack = (*cx).stack.take().unwrap_unchecked();
stack.set_ptr(sp.cast::<u8>().add(offset).cast());
let FuncEntity::Host(func) = func.as_ref() else {
hint::unreachable_unchecked();
};
let stack = match func.trampoline().clone().call((*cx).store, stack) {
Ok(stack) => stack,
Err(error) => {
(*cx).error = Some(error);
return ControlFlow::Error.to_bits();
}
};

(*cx).stack = Some(stack);
if !call_host_func(func, sp, offset, cx) {
return ControlFlow::Error.to_bits();
}

let md;
let ms;
Expand Down Expand Up @@ -659,16 +675,9 @@ threaded_instr!(call_indirect(
next_instr(ip, sp, md, ms, ix, sx, dx, cx)
}
FuncEntity::Host(func) => {
let mut stack = (*cx).stack.take().unwrap_unchecked();
stack.set_ptr(sp.cast::<u8>().add(stack_offset).cast());
let stack = match func.trampoline().clone().call((*cx).store, stack) {
Ok(stack) => stack,
Err(error) => {
(*cx).error = Some(error);
return ControlFlow::Error.to_bits();
}
};
(*cx).stack = Some(stack);
if !call_host_func(func, sp, stack_offset, cx) {
return ControlFlow::Error.to_bits();
}

let md;
let ms;
Expand Down
75 changes: 75 additions & 0 deletions libs/stitch/tests/host_calls.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
//! A host function called in a loop must not grow the native stack.
//!
//! Every threaded instruction ends in a sibling call to the next one. A
//! handler that keeps something alive in its frame across that call leaves
//! the frame behind, so a module that calls a host function many times in one
//! invocation runs out of native stack.

use makepad_stitch::{Engine, Func, Linker, Module, Store, Val};

const CALLS: i32 = 1_000_000;

const WAT: &str = r#"
(module
(type $t (func (param i32) (result i32)))
(import "env" "tick" (func $tick (type $t)))
(table 1 funcref)
(elem (i32.const 0) $tick)
(func (export "direct") (param $n i32) (result i32)
(local $i i32) (local $acc i32)
(block $done
(loop $next
(br_if $done (i32.ge_u (local.get $i) (local.get $n)))
(local.set $acc (call $tick (local.get $acc)))
(local.set $i (i32.add (local.get $i) (i32.const 1)))
(br $next)))
(local.get $acc))
(func (export "indirect") (param $n i32) (result i32)
(local $i i32) (local $acc i32)
(block $done
(loop $next
(br_if $done (i32.ge_u (local.get $i) (local.get $n)))
(local.set $acc (call_indirect (type $t) (local.get $acc) (i32.const 0)))
(local.set $i (i32.add (local.get $i) (i32.const 1)))
(br $next)))
(local.get $acc)))
"#;

/// Calls `export(CALLS)` on a thread with a 1 MiB stack: a leak of even a
/// few hundred bytes per host call overflows it long before the loop ends.
fn run(export: &'static str) -> i32 {
std::thread::Builder::new()
.stack_size(1 << 20)
.spawn(move || {
let buf = wast::parser::ParseBuffer::new(WAT).unwrap();
let mut wat: wast::Wat = wast::parser::parse(&buf).unwrap();
let bytes = wat.encode().unwrap();
let engine = Engine::new();
let mut store = Store::new(engine);
let module = Module::new(store.engine(), &bytes).unwrap();
let mut linker = Linker::new();
let tick = Func::wrap(&mut store, |x: i32| -> i32 { x + 1 });
linker.define("env", "tick", tick);
let instance = linker.instantiate(&mut store, &module).unwrap();
let mut results = [Val::I32(0)];
instance
.exported_func(export)
.unwrap()
.call(&mut store, &[Val::I32(CALLS)], &mut results)
.unwrap();
results[0].to_i32().unwrap()
})
.unwrap()
.join()
.unwrap()
}

#[test]
fn host_calls_in_a_loop_keep_the_native_stack_flat() {
assert_eq!(run("direct"), CALLS);
}

#[test]
fn indirect_host_calls_in_a_loop_keep_the_native_stack_flat() {
assert_eq!(run("indirect"), CALLS);
}
1 change: 1 addition & 0 deletions libs/windows/windows-rs/src/Windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107413,6 +107413,7 @@ pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PR
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct D3D_DRIVER_TYPE(pub i32);
pub const D3D_DRIVER_TYPE_UNKNOWN: D3D_DRIVER_TYPE = D3D_DRIVER_TYPE(0i32);
pub const D3D_DRIVER_TYPE_WARP: D3D_DRIVER_TYPE = D3D_DRIVER_TYPE(5i32);
#[repr(transparent)]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct D3D_FEATURE_LEVEL(pub i32);
Expand Down
47 changes: 47 additions & 0 deletions platform/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ fn main() {
// OpenHarmony's sysroot has no xkbcommon; its keyboard comes through ArkUI.
if std::env::var("CARGO_CFG_TARGET_ENV").as_deref() != Ok("ohos") {
println!("cargo:rustc-link-lib=xkbcommon");
} else {
build_ohos_node_shim(&target, &out_dir);
}
}
"android" => {
Expand All @@ -189,3 +191,48 @@ fn main() {
_ => (),
}
}

/// OpenHarmony: compile `node_shim.cpp` (makepad's ArkUI node, created with
/// the NDK) and `web_shim.cpp` (system browsers through ArkWeb's NDK) with the
/// SDK's clang++, which cargo-makepad exports as
/// `CXX_<target>` (and `AR_<target>`), into a static library linked here.
/// No `cc` build dependency: one compiler call and one archive.
fn build_ohos_node_shim(target: &str, out_dir: &str) {
let srcs = ["src/os/linux/open_harmony/node_shim.cpp", "src/os/linux/open_harmony/web_shim.cpp"];
for src in srcs {
println!("cargo:rerun-if-changed={src}");
}
let key = target.replace('-', "_");
println!("cargo:rerun-if-env-changed=CXX_{key}");
println!("cargo:rerun-if-env-changed=AR_{key}");
let (Ok(cxx), Ok(ar)) = (env::var(format!("CXX_{key}")), env::var(format!("AR_{key}"))) else {
println!("cargo:warning=CXX_{key}/AR_{key} not set: building without the OpenHarmony node shim");
return;
};
let lib = Path::new(out_dir).join("libmakepad_ohos_node_shim.a");
let mut objs = Vec::new();
for src in srcs {
let obj = Path::new(out_dir).join(Path::new(src).file_stem().unwrap()).with_extension("o");
let status = std::process::Command::new(&cxx)
// No C++ runtime is linked: no exceptions, RTTI or guarded statics.
.args(["-c", "-fPIC", "-O2", "-std=c++17", "-fno-exceptions", "-fno-rtti", "-fno-threadsafe-statics", src, "-o"])
.arg(&obj)
.status()
.expect("run the OpenHarmony clang++");
assert!(status.success(), "compiling {src} failed");
objs.push(obj);
}
let _ = std::fs::remove_file(&lib);
let status = std::process::Command::new(&ar)
.arg("crs")
.arg(&lib)
.args(&objs)
.status()
.expect("run llvm-ar");
assert!(status.success(), "archiving the OpenHarmony shims failed");
println!("cargo:rustc-link-search=native={out_dir}");
println!("cargo:rustc-link-lib=static=makepad_ohos_node_shim");
println!("cargo:rustc-link-lib=ace_ndk.z");
println!("cargo:rustc-link-lib=ace_napi.z");
println!("cargo:rustc-link-lib=ohweb");
}
3 changes: 3 additions & 0 deletions platform/network/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ pub struct HttpRequest {
pub method: HttpMethod,
#[cfg_attr(feature = "script", live)]
pub headers: BTreeMap<String, Vec<String>>,
/// Skip TLS certificate verification for this request. Intended for
/// loopback/dev endpoints with self-signed certificates; the per-isolate
/// host allowlist still applies, so this cannot widen an app's reach.
#[cfg_attr(feature = "script", live)]
pub ignore_ssl_cert: bool,
#[cfg_attr(feature = "script", live)]
Expand Down
1 change: 1 addition & 0 deletions platform/script/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub mod opcodes_vars;
pub mod pod;
pub mod pod_heap;
pub mod prims;
pub mod query;
pub mod shader;
pub mod shader_backend;
pub mod shader_builtins;
Expand Down
Loading
Loading