-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCargo.toml
More file actions
90 lines (77 loc) · 3.88 KB
/
Copy pathCargo.toml
File metadata and controls
90 lines (77 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
[package]
name = "perry-ext-webgpu"
version = "0.1.2"
edition = "2021"
license = "MIT"
description = "Native bindings for the WebGPU spec (backed by `wgpu`) for the Perry TypeScript-to-native compiler. Spec-faithful surface so shaders + pipelines authored against the browser WebGPU API run unmodified under perry. Closes PerryTS/perry#571."
repository = "https://github.com/PerryTS/webgpu"
homepage = "https://github.com/PerryTS/webgpu"
readme = "README.md"
[lib]
crate-type = ["staticlib", "rlib"]
[dependencies]
# Tracks the perry-ffi v0.5 ABI surface published from the
# `PerryTS/perry` workspace. Pinned to a git rev rather than a
# crates.io release until perry-ffi is published on crates.io —
# same model as iroh-bindings.
perry-ffi = { git = "https://github.com/PerryTS/perry", branch = "main" }
# wgpu is the native implementation of the WebGPU spec. We track
# the latest stable release; it carries naga (the WGSL compiler)
# transitively so we don't need to depend on it directly.
wgpu = "22"
# Async dispatch — every WebGPU async method (`requestAdapter`,
# `requestDevice`, `createComputePipelineAsync`, `mapAsync`,
# `onSubmittedWorkDone`) routes through `spawn_blocking` + a
# tokio `block_on` to wait on the wgpu future, mirroring the
# iroh-bindings async pattern.
tokio = { version = "1", features = ["rt-multi-thread", "sync", "time", "macros"] }
# pollster's `block_on` is needed for the no-runtime fallback in
# `device.poll()` — wgpu's poll loop runs synchronously and we
# don't always have a tokio runtime in scope when GC kicks in.
pollster = "0.3"
# Once wgpu surfaces a callback we have to materialise on the
# main thread, parking_lot's lighter Mutex avoids contention vs.
# std's poison-tracking variant.
parking_lot = "0.12"
# Descriptor passing: WebGPU's descriptor objects (`GPUBufferDescriptor`,
# `GPUBindGroupLayoutDescriptor`, `GPURenderPipelineDescriptor`, …) are
# deeply nested with many optional fields. Rather than exploding each
# descriptor into a wide function-arg list, the TS side calls
# `JSON.stringify(descriptor)` and we deserialize on the Rust side. This
# keeps the FFI surface small (one descriptor JSON string + a few handles
# per call) and the TS surface obvious (the object literal is the
# argument exactly as in the spec).
serde = { version = "1", features = ["derive"] }
serde_json = "1"
# On-screen surface (`GPUSurface` / `GPUCanvasContext`). We build a
# native view per platform and hand its raw handle to wgpu's
# `create_surface_unsafe`, so we depend on `raw-window-handle` directly
# (the same 0.6 line wgpu 22 re-exports). The native view is then handed
# to perry-ui's `perry_ui_embed_*` hook by the caller — see the
# "On-screen surface" section in lib.rs.
raw-window-handle = "0.6"
# ─── Per-platform native-view creation ──────────────────────────────
#
# Versions track the `perry-ui-*` backends so the linked binary pulls a
# single copy of each objc2 / windows / jni crate. Only the host
# target's block compiles; wgpu's HAL turns the bare view handle into a
# swapchain-capable layer (CAMetalLayer / DXGI / Vulkan surface).
[target.'cfg(target_os = "macos")'.dependencies]
objc2 = "0.6"
objc2-foundation = { version = "0.3", features = ["NSGeometry"] }
objc2-app-kit = { version = "0.3", features = ["NSView", "NSResponder"] }
[target.'cfg(target_os = "ios")'.dependencies]
objc2 = "0.6"
objc2-foundation = { version = "0.3", features = ["NSGeometry"] }
objc2-ui-kit = { version = "0.3", features = ["UIView", "UIResponder"] }
objc2-quartz-core = { version = "0.3", features = ["CAMetalLayer", "CALayer"] }
[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.58", features = [
"Win32_Foundation",
"Win32_UI_WindowsAndMessaging",
"Win32_System_LibraryLoader",
"Win32_Graphics_Gdi",
] }
[target.'cfg(target_os = "android")'.dependencies]
jni = "0.21"
ndk = "0.9"