mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-09 20:31:29 +11:00
Hacky attempt to get running in browser
This commit is contained in:
parent
571822248c
commit
340ac1d69c
384
Cargo.lock
generated
384
Cargo.lock
generated
|
@ -28,6 +28,12 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6"
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
version = "0.3.6"
|
||||
|
@ -61,6 +67,16 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"safemem",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit-set"
|
||||
version = "0.5.3"
|
||||
|
@ -133,6 +149,17 @@ dependencies = [
|
|||
"vec_map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo-run-wasm"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "611b811fad83eebfcdcf47ae1e425c82d1249608bc571d537448d706be08cf27"
|
||||
dependencies = [
|
||||
"devserver_lib",
|
||||
"pico-args",
|
||||
"wasm-bindgen-cli-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.73"
|
||||
|
@ -201,6 +228,26 @@ dependencies = [
|
|||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console_error_panic_hook"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console_log"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494"
|
||||
dependencies = [
|
||||
"log",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.3"
|
||||
|
@ -338,6 +385,12 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "devserver_lib"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fb4b71acc1405be2431a93892a79a0d82ed5ba6885649ddbdfc62caa4d67b1c"
|
||||
|
||||
[[package]]
|
||||
name = "dispatch"
|
||||
version = "0.2.0"
|
||||
|
@ -383,6 +436,15 @@ dependencies = [
|
|||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
|
||||
dependencies = [
|
||||
"instant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.24"
|
||||
|
@ -560,12 +622,27 @@ dependencies = [
|
|||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
|
||||
dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hexf-parse"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
||||
|
||||
[[package]]
|
||||
name = "id-arena"
|
||||
version = "2.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005"
|
||||
|
||||
[[package]]
|
||||
name = "ident_case"
|
||||
version = "1.0.1"
|
||||
|
@ -594,6 +671,12 @@ dependencies = [
|
|||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
|
||||
|
||||
[[package]]
|
||||
name = "jni-sys"
|
||||
version = "0.3.0"
|
||||
|
@ -635,6 +718,12 @@ version = "1.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "leb128"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.135"
|
||||
|
@ -944,6 +1033,12 @@ version = "2.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
|
||||
|
||||
[[package]]
|
||||
name = "pico-args"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
|
||||
|
||||
[[package]]
|
||||
name = "piet-scene"
|
||||
version = "0.1.0"
|
||||
|
@ -959,10 +1054,16 @@ name = "piet-wgsl"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"console_error_panic_hook",
|
||||
"console_log",
|
||||
"futures-intrusive",
|
||||
"js-sys",
|
||||
"parking_lot",
|
||||
"piet-scene",
|
||||
"raw-window-handle 0.5.0",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"wgpu",
|
||||
]
|
||||
|
||||
|
@ -1064,6 +1165,15 @@ dependencies = [
|
|||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "remove_dir_all"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "renderdoc-sys"
|
||||
version = "0.7.1"
|
||||
|
@ -1079,12 +1189,31 @@ dependencies = [
|
|||
"xmlparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "run-wasm"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cargo-run-wasm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
|
||||
|
||||
[[package]]
|
||||
name = "safe_arch"
|
||||
version = "0.5.2"
|
||||
|
@ -1094,6 +1223,12 @@ dependencies = [
|
|||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "safemem"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
|
||||
|
||||
[[package]]
|
||||
name = "scoped-tls"
|
||||
version = "1.0.0"
|
||||
|
@ -1135,6 +1270,17 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "servo-fontconfig"
|
||||
version = "0.5.1"
|
||||
|
@ -1223,6 +1369,20 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"remove_dir_all",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.3"
|
||||
|
@ -1292,6 +1452,12 @@ version = "1.0.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.10"
|
||||
|
@ -1316,6 +1482,32 @@ version = "0.9.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "walrus"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4eb08e48cde54c05f363d984bb54ce374f49e242def9468d2e1b6c2372d291f8"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"id-arena",
|
||||
"leb128",
|
||||
"log",
|
||||
"walrus-macro",
|
||||
"wasmparser 0.77.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "walrus-macro"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a6e5bd22c71e77d60140b0bd5be56155a37e5bd14e24f5f87298040d0cc40d7"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
|
@ -1347,6 +1539,40 @@ dependencies = [
|
|||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-cli-support"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03f35e0387a2c787ca5ee299bfb4259352b2a2184b406f8ee9f978c3c4671645"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
"log",
|
||||
"rustc-demangle",
|
||||
"serde_json",
|
||||
"tempfile",
|
||||
"walrus",
|
||||
"wasm-bindgen-externref-xform",
|
||||
"wasm-bindgen-multi-value-xform",
|
||||
"wasm-bindgen-shared",
|
||||
"wasm-bindgen-threads-xform",
|
||||
"wasm-bindgen-wasm-conventions",
|
||||
"wasm-bindgen-wasm-interpreter",
|
||||
"wit-text",
|
||||
"wit-validator",
|
||||
"wit-walrus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-externref-xform"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d010a32a516a793adbea5835eab6f736d11c0cdd10ebe0c762c420f67510244"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"walrus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.33"
|
||||
|
@ -1382,12 +1608,76 @@ dependencies = [
|
|||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-multi-value-xform"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78b8c8d5dcc451b7e6a9c98d8fd966ff768a1e8f8afb270a829780086f2885ac"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"walrus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-threads-xform"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d10f9246c4daa911283a7096fc3be9f1fab9e3e36400478a4ab8d7056701420"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"walrus",
|
||||
"wasm-bindgen-wasm-conventions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-wasm-conventions"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4a5ab217f12f73b7c3ff23cbbbb5d36f7ee97dd65bb0be44beebda887df9002"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"walrus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-wasm-interpreter"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fbb6c773b486889b7c1211d27a7a08eebaf54ec4269380266cadf69e269cd91"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"log",
|
||||
"walrus",
|
||||
"wasm-bindgen-wasm-conventions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a950e6a618f62147fd514ff445b2a0b53120d382751960797f85f058c7eda9b9"
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.77.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b35c86d22e720a07d954ebbed772d01180501afe7d03d464f413bb5f8914a8d6"
|
||||
|
||||
[[package]]
|
||||
name = "wast"
|
||||
version = "21.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b1844f66a2bc8526d71690104c0e78a8e59ffa1597b7245769d174ebb91deb5"
|
||||
dependencies = [
|
||||
"leb128",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
version = "0.29.5"
|
||||
|
@ -1696,18 +1986,6 @@ version = "0.42.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
|
||||
|
||||
[[package]]
|
||||
name = "winit"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"piet-scene",
|
||||
"piet-wgsl",
|
||||
"pollster",
|
||||
"roxmltree",
|
||||
"wgpu",
|
||||
"winit 0.27.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winit"
|
||||
version = "0.27.5"
|
||||
|
@ -1741,6 +2019,24 @@ dependencies = [
|
|||
"x11-dl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winit-demo"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"console_error_panic_hook",
|
||||
"console_log",
|
||||
"js-sys",
|
||||
"piet-scene",
|
||||
"piet-wgsl",
|
||||
"pollster",
|
||||
"roxmltree",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"wgpu",
|
||||
"winit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wio"
|
||||
version = "0.2.2"
|
||||
|
@ -1750,6 +2046,70 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-parser"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f5fd97866f4b9c8e1ed57bcf9446f3d0d8ba37e2dd01c3c612c046c053b06f7"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"leb128",
|
||||
"wit-schema-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-schema-version"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfee4a6a4716eefa0682e7a3b836152e894a3e4f34a9d6c2c3e1c94429bfe36a"
|
||||
|
||||
[[package]]
|
||||
name = "wit-text"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33358e95c77d660f1c7c07f4a93c2bd89768965e844e3c50730bb4b42658df5f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"wast",
|
||||
"wit-writer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-validator"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c11d93d925420e7872b226c4161849c32be38385ccab026b88df99d8ddc6ba6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"wasmparser 0.59.0",
|
||||
"wit-parser",
|
||||
"wit-schema-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-walrus"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad559e3e4c6404b2a6a675d44129d62a3836e3b951b90112fa1c5feb852757cd"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"id-arena",
|
||||
"walrus",
|
||||
"wit-parser",
|
||||
"wit-schema-version",
|
||||
"wit-writer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-writer"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2ad01ba5e9cbcff799a0689e56a153776ea694cec777f605938cb9880d41a09"
|
||||
dependencies = [
|
||||
"leb128",
|
||||
"wit-schema-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11-dl"
|
||||
version = "2.20.0"
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
[workspace]
|
||||
resolver = "2"
|
||||
|
||||
members = ["piet-scene", "piet-wgsl", "piet-wgsl/examples/winit"]
|
||||
members = ["piet-scene", "piet-wgsl", "piet-wgsl/examples/winit", "run-wasm"]
|
||||
|
||||
[workspace.package]
|
||||
edition = "2021"
|
||||
version = "0.1.0"
|
||||
authors = ["piet-gpu developers"]
|
||||
|
||||
[patch.crates-io]
|
||||
# Required for metal support to work on wgpu
|
||||
|
|
|
@ -7,8 +7,144 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
wgpu = "0.14"
|
||||
wasm-bindgen = "0.2"
|
||||
raw-window-handle = "0.5"
|
||||
futures-intrusive = "0.5.0"
|
||||
parking_lot = "0.12"
|
||||
bytemuck = { version = "1.12.1", features = ["derive"] }
|
||||
piet-scene = { path = "../piet-scene" }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
console_error_panic_hook = "0.1.7"
|
||||
console_log = "0.2"
|
||||
wasm-bindgen-futures = "0.4.33"
|
||||
js-sys = "0.3.60"
|
||||
web-sys = { version = "0.3.60", features = [
|
||||
"Document",
|
||||
"Navigator",
|
||||
"Node",
|
||||
"NodeList",
|
||||
"Gpu",
|
||||
"GpuAdapter",
|
||||
"GpuAddressMode",
|
||||
"GpuAutoLayoutMode",
|
||||
"GpuBindGroup",
|
||||
"GpuBindGroupDescriptor",
|
||||
"GpuBindGroupEntry",
|
||||
"GpuBindGroupLayout",
|
||||
"GpuBindGroupLayoutDescriptor",
|
||||
"GpuBindGroupLayoutEntry",
|
||||
"GpuBlendComponent",
|
||||
"GpuBlendFactor",
|
||||
"GpuBlendOperation",
|
||||
"GpuBlendState",
|
||||
"GpuBuffer",
|
||||
"GpuBufferBinding",
|
||||
"GpuBufferBindingLayout",
|
||||
"GpuBufferBindingType",
|
||||
"GpuBufferDescriptor",
|
||||
"GpuCanvasAlphaMode",
|
||||
"GpuCanvasContext",
|
||||
"GpuCanvasConfiguration",
|
||||
"GpuColorDict",
|
||||
"GpuColorTargetState",
|
||||
"GpuCommandBuffer",
|
||||
"GpuCommandBufferDescriptor",
|
||||
"GpuCommandEncoder",
|
||||
"GpuCommandEncoderDescriptor",
|
||||
"GpuCompareFunction",
|
||||
"GpuCompilationInfo",
|
||||
"GpuCompilationMessage",
|
||||
"GpuCompilationMessageType",
|
||||
"GpuComputePassDescriptor",
|
||||
"GpuComputePassEncoder",
|
||||
"GpuComputePipeline",
|
||||
"GpuComputePipelineDescriptor",
|
||||
"GpuCullMode",
|
||||
"GpuDepthStencilState",
|
||||
"GpuDevice",
|
||||
"GpuDeviceDescriptor",
|
||||
"GpuDeviceLostInfo",
|
||||
"GpuDeviceLostReason",
|
||||
"GpuError",
|
||||
"GpuErrorFilter",
|
||||
"GpuExtent3dDict",
|
||||
"GpuFeatureName",
|
||||
"GpuFilterMode",
|
||||
"GpuFragmentState",
|
||||
"GpuFrontFace",
|
||||
"GpuImageCopyBuffer",
|
||||
"GpuImageCopyExternalImage",
|
||||
"GpuImageCopyTexture",
|
||||
"GpuImageCopyTextureTagged",
|
||||
"GpuImageDataLayout",
|
||||
"GpuIndexFormat",
|
||||
"GpuLoadOp",
|
||||
"gpu_map_mode",
|
||||
"GpuMipmapFilterMode",
|
||||
"GpuMultisampleState",
|
||||
"GpuObjectDescriptorBase",
|
||||
"GpuOrigin2dDict",
|
||||
"GpuOrigin3dDict",
|
||||
"GpuOutOfMemoryError",
|
||||
"GpuPipelineDescriptorBase",
|
||||
"GpuPipelineLayout",
|
||||
"GpuPipelineLayoutDescriptor",
|
||||
"GpuPowerPreference",
|
||||
"GpuPrimitiveState",
|
||||
"GpuPrimitiveTopology",
|
||||
"GpuProgrammableStage",
|
||||
"GpuQuerySet",
|
||||
"GpuQuerySetDescriptor",
|
||||
"GpuQueryType",
|
||||
"GpuQueue",
|
||||
"GpuRenderBundle",
|
||||
"GpuRenderBundleDescriptor",
|
||||
"GpuRenderBundleEncoder",
|
||||
"GpuRenderBundleEncoderDescriptor",
|
||||
"GpuRenderPassColorAttachment",
|
||||
"GpuRenderPassDepthStencilAttachment",
|
||||
"GpuRenderPassDescriptor",
|
||||
"GpuRenderPassEncoder",
|
||||
"GpuRenderPipeline",
|
||||
"GpuRenderPipelineDescriptor",
|
||||
"GpuRequestAdapterOptions",
|
||||
"GpuSampler",
|
||||
"GpuSamplerBindingLayout",
|
||||
"GpuSamplerBindingType",
|
||||
"GpuSamplerDescriptor",
|
||||
"GpuShaderModule",
|
||||
"GpuShaderModuleDescriptor",
|
||||
"GpuStencilFaceState",
|
||||
"GpuStencilOperation",
|
||||
"GpuStorageTextureAccess",
|
||||
"GpuStorageTextureBindingLayout",
|
||||
"GpuStoreOp",
|
||||
"GpuSupportedFeatures",
|
||||
"GpuSupportedLimits",
|
||||
"GpuTexture",
|
||||
"GpuTextureAspect",
|
||||
"GpuTextureBindingLayout",
|
||||
"GpuTextureDescriptor",
|
||||
"GpuTextureDimension",
|
||||
"GpuTextureFormat",
|
||||
"GpuTextureSampleType",
|
||||
"GpuTextureView",
|
||||
"GpuTextureViewDescriptor",
|
||||
"GpuTextureViewDimension",
|
||||
"GpuUncapturedErrorEvent",
|
||||
"GpuUncapturedErrorEventInit",
|
||||
"GpuValidationError",
|
||||
"GpuVertexAttribute",
|
||||
"GpuVertexBufferLayout",
|
||||
"GpuVertexFormat",
|
||||
"GpuVertexState",
|
||||
"GpuVertexStepMode",
|
||||
"HtmlCanvasElement",
|
||||
"OffscreenCanvas",
|
||||
"ImageBitmap",
|
||||
"ImageBitmapRenderingContext",
|
||||
"Window",
|
||||
"WorkerGlobalScope",
|
||||
"WorkerNavigator"
|
||||
] }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "winit"
|
||||
name = "winit-demo"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
@ -11,6 +11,142 @@ wgpu = "0.14"
|
|||
piet-wgsl = { path = "../../../piet-wgsl" }
|
||||
piet-scene = { path = "../../../piet-scene" }
|
||||
winit = "0.27.5"
|
||||
wasm-bindgen = "0.2"
|
||||
pollster = "0.2.5"
|
||||
# for picosvg
|
||||
roxmltree = "0.13"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
console_error_panic_hook = "0.1.7"
|
||||
console_log = "0.2"
|
||||
wasm-bindgen-futures = "0.4.33"
|
||||
js-sys = "0.3.60"
|
||||
web-sys = { version = "0.3.60", features = [
|
||||
"Document",
|
||||
"Navigator",
|
||||
"Node",
|
||||
"NodeList",
|
||||
"Gpu",
|
||||
"GpuAdapter",
|
||||
"GpuAddressMode",
|
||||
"GpuAutoLayoutMode",
|
||||
"GpuBindGroup",
|
||||
"GpuBindGroupDescriptor",
|
||||
"GpuBindGroupEntry",
|
||||
"GpuBindGroupLayout",
|
||||
"GpuBindGroupLayoutDescriptor",
|
||||
"GpuBindGroupLayoutEntry",
|
||||
"GpuBlendComponent",
|
||||
"GpuBlendFactor",
|
||||
"GpuBlendOperation",
|
||||
"GpuBlendState",
|
||||
"GpuBuffer",
|
||||
"GpuBufferBinding",
|
||||
"GpuBufferBindingLayout",
|
||||
"GpuBufferBindingType",
|
||||
"GpuBufferDescriptor",
|
||||
"GpuCanvasAlphaMode",
|
||||
"GpuCanvasContext",
|
||||
"GpuCanvasConfiguration",
|
||||
"GpuColorDict",
|
||||
"GpuColorTargetState",
|
||||
"GpuCommandBuffer",
|
||||
"GpuCommandBufferDescriptor",
|
||||
"GpuCommandEncoder",
|
||||
"GpuCommandEncoderDescriptor",
|
||||
"GpuCompareFunction",
|
||||
"GpuCompilationInfo",
|
||||
"GpuCompilationMessage",
|
||||
"GpuCompilationMessageType",
|
||||
"GpuComputePassDescriptor",
|
||||
"GpuComputePassEncoder",
|
||||
"GpuComputePipeline",
|
||||
"GpuComputePipelineDescriptor",
|
||||
"GpuCullMode",
|
||||
"GpuDepthStencilState",
|
||||
"GpuDevice",
|
||||
"GpuDeviceDescriptor",
|
||||
"GpuDeviceLostInfo",
|
||||
"GpuDeviceLostReason",
|
||||
"GpuError",
|
||||
"GpuErrorFilter",
|
||||
"GpuExtent3dDict",
|
||||
"GpuFeatureName",
|
||||
"GpuFilterMode",
|
||||
"GpuFragmentState",
|
||||
"GpuFrontFace",
|
||||
"GpuImageCopyBuffer",
|
||||
"GpuImageCopyExternalImage",
|
||||
"GpuImageCopyTexture",
|
||||
"GpuImageCopyTextureTagged",
|
||||
"GpuImageDataLayout",
|
||||
"GpuIndexFormat",
|
||||
"GpuLoadOp",
|
||||
"gpu_map_mode",
|
||||
"GpuMipmapFilterMode",
|
||||
"GpuMultisampleState",
|
||||
"GpuObjectDescriptorBase",
|
||||
"GpuOrigin2dDict",
|
||||
"GpuOrigin3dDict",
|
||||
"GpuOutOfMemoryError",
|
||||
"GpuPipelineDescriptorBase",
|
||||
"GpuPipelineLayout",
|
||||
"GpuPipelineLayoutDescriptor",
|
||||
"GpuPowerPreference",
|
||||
"GpuPrimitiveState",
|
||||
"GpuPrimitiveTopology",
|
||||
"GpuProgrammableStage",
|
||||
"GpuQuerySet",
|
||||
"GpuQuerySetDescriptor",
|
||||
"GpuQueryType",
|
||||
"GpuQueue",
|
||||
"GpuRenderBundle",
|
||||
"GpuRenderBundleDescriptor",
|
||||
"GpuRenderBundleEncoder",
|
||||
"GpuRenderBundleEncoderDescriptor",
|
||||
"GpuRenderPassColorAttachment",
|
||||
"GpuRenderPassDepthStencilAttachment",
|
||||
"GpuRenderPassDescriptor",
|
||||
"GpuRenderPassEncoder",
|
||||
"GpuRenderPipeline",
|
||||
"GpuRenderPipelineDescriptor",
|
||||
"GpuRequestAdapterOptions",
|
||||
"GpuSampler",
|
||||
"GpuSamplerBindingLayout",
|
||||
"GpuSamplerBindingType",
|
||||
"GpuSamplerDescriptor",
|
||||
"GpuShaderModule",
|
||||
"GpuShaderModuleDescriptor",
|
||||
"GpuStencilFaceState",
|
||||
"GpuStencilOperation",
|
||||
"GpuStorageTextureAccess",
|
||||
"GpuStorageTextureBindingLayout",
|
||||
"GpuStoreOp",
|
||||
"GpuSupportedFeatures",
|
||||
"GpuSupportedLimits",
|
||||
"GpuTexture",
|
||||
"GpuTextureAspect",
|
||||
"GpuTextureBindingLayout",
|
||||
"GpuTextureDescriptor",
|
||||
"GpuTextureDimension",
|
||||
"GpuTextureFormat",
|
||||
"GpuTextureSampleType",
|
||||
"GpuTextureView",
|
||||
"GpuTextureViewDescriptor",
|
||||
"GpuTextureViewDimension",
|
||||
"GpuUncapturedErrorEvent",
|
||||
"GpuUncapturedErrorEventInit",
|
||||
"GpuValidationError",
|
||||
"GpuVertexAttribute",
|
||||
"GpuVertexBufferLayout",
|
||||
"GpuVertexFormat",
|
||||
"GpuVertexState",
|
||||
"GpuVertexStepMode",
|
||||
"HtmlCanvasElement",
|
||||
"OffscreenCanvas",
|
||||
"ImageBitmap",
|
||||
"ImageBitmapRenderingContext",
|
||||
"Window",
|
||||
"WorkerGlobalScope",
|
||||
"WorkerNavigator"
|
||||
] }
|
||||
|
|
|
@ -19,13 +19,12 @@ mod simple_text;
|
|||
mod test_scene;
|
||||
|
||||
use piet_scene::{Scene, SceneBuilder};
|
||||
use piet_wgsl::{util::RenderContext, Renderer, Result};
|
||||
use piet_wgsl::{util::RenderContext, Renderer};
|
||||
use winit::{event_loop::EventLoop, window::Window};
|
||||
|
||||
async fn run() -> Result<()> {
|
||||
async fn run() {
|
||||
use winit::{
|
||||
dpi::LogicalSize,
|
||||
event::*,
|
||||
event_loop::{ControlFlow, EventLoop},
|
||||
window::WindowBuilder,
|
||||
};
|
||||
let event_loop = EventLoop::new();
|
||||
|
@ -34,10 +33,18 @@ async fn run() -> Result<()> {
|
|||
.with_resizable(true)
|
||||
.build(&event_loop)
|
||||
.unwrap();
|
||||
let render_cx = RenderContext::new().await?;
|
||||
run_wasm(event_loop, window).await
|
||||
}
|
||||
|
||||
async fn run_wasm(event_loop: EventLoop<()>, window: Window) {
|
||||
use winit::{
|
||||
event::*,
|
||||
event_loop::ControlFlow,
|
||||
};
|
||||
let render_cx = RenderContext::new().await.unwrap();
|
||||
let size = window.inner_size();
|
||||
let mut surface = render_cx.create_surface(&window, size.width, size.height);
|
||||
let mut renderer = Renderer::new(&render_cx.device)?;
|
||||
let mut renderer = Renderer::new(&render_cx.device).unwrap();
|
||||
let mut simple_text = simple_text::SimpleText::new();
|
||||
let mut current_frame = 0usize;
|
||||
let mut scene_ix = 0usize;
|
||||
|
@ -103,5 +110,28 @@ async fn run() -> Result<()> {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
pollster::block_on(run()).unwrap();
|
||||
}
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
pollster::block_on(run()).unwrap();
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{
|
||||
let event_loop = EventLoop::new();
|
||||
let window = winit::window::Window::new(&event_loop).unwrap();
|
||||
|
||||
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
|
||||
console_log::init().expect("could not initialize logger");
|
||||
use winit::platform::web::WindowExtWebSys;
|
||||
|
||||
// On wasm, append the canvas to the document body
|
||||
let canvas = window.canvas();
|
||||
canvas.set_width(1024);
|
||||
canvas.set_height(1024);
|
||||
web_sys::window()
|
||||
.and_then(|win| win.document())
|
||||
.and_then(|doc| doc.body())
|
||||
.and_then(|body| body.append_child(&web_sys::Element::from(canvas)).ok())
|
||||
.expect("couldn't append canvas to document body");
|
||||
wasm_bindgen_futures::spawn_local(run_wasm(event_loop, window));
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ var<storage> paths: array<Path>;
|
|||
@group(0) @binding(2)
|
||||
var<storage, read_write> tiles: array<Tile>;
|
||||
|
||||
let WG_SIZE = 256u;
|
||||
const WG_SIZE = 256u;
|
||||
|
||||
var<workgroup> sh_row_width: array<u32, WG_SIZE>;
|
||||
var<workgroup> sh_row_count: array<u32, WG_SIZE>;
|
||||
|
|
|
@ -38,15 +38,15 @@ struct BinHeader {
|
|||
var<storage, read_write> bin_header: array<BinHeader>;
|
||||
|
||||
// conversion factors from coordinates to bin
|
||||
let SX = 0.00390625;
|
||||
let SY = 0.00390625;
|
||||
const SX = 0.00390625;
|
||||
const SY = 0.00390625;
|
||||
//let SX = 1.0 / f32(N_TILE_X * TILE_WIDTH);
|
||||
//let SY = 1.0 / f32(N_TILE_Y * TILE_HEIGHT);
|
||||
|
||||
let WG_SIZE = 256u;
|
||||
let N_SLICE = 8u;
|
||||
//let N_SLICE = WG_SIZE / 32u;
|
||||
let N_SUBSLICE = 4u;
|
||||
const WG_SIZE = 256u;
|
||||
const N_SLICE = 8u;
|
||||
//const N_SLICE = WG_SIZE / 32u;
|
||||
const N_SUBSLICE = 4u;
|
||||
|
||||
var<workgroup> sh_bitmaps: array<array<atomic<u32>, N_TILE>, N_SLICE>;
|
||||
// store count values packed two u16's to a u32
|
||||
|
|
|
@ -26,15 +26,15 @@ var<storage, read_write> draw_monoids: array<DrawMonoid>;
|
|||
@group(0) @binding(6)
|
||||
var<storage, read_write> clip_bboxes: array<vec4<f32>>;
|
||||
|
||||
let WG_SIZE = 256u;
|
||||
const WG_SIZE = 256u;
|
||||
var<workgroup> sh_bic: array<Bic, 510 >;
|
||||
var<workgroup> sh_stack: array<u32, WG_SIZE>;
|
||||
var<workgroup> sh_stack_bbox: array<vec4<f32>, WG_SIZE>;
|
||||
var<workgroup> sh_bbox: array<vec4<f32>, WG_SIZE>;
|
||||
var<workgroup> sh_link: array<i32, WG_SIZE>;
|
||||
|
||||
fn search_link(bic: ptr<function, Bic>, ix: u32) -> i32 {
|
||||
var ix = ix;
|
||||
fn search_link(bic: ptr<function, Bic>, ix_in: u32) -> i32 {
|
||||
var ix = ix_in;
|
||||
var j = 0u;
|
||||
while j < firstTrailingBit(WG_SIZE) {
|
||||
let base = 2u * WG_SIZE - (2u << (firstTrailingBit(WG_SIZE) - j));
|
||||
|
@ -130,7 +130,7 @@ fn main(
|
|||
// Read input and compute Bic binary tree
|
||||
let inp = load_clip_path(global_id.x);
|
||||
let is_push = inp >= 0;
|
||||
var bic = Bic(1u - u32(is_push), u32(is_push));
|
||||
bic = Bic(1u - u32(is_push), u32(is_push));
|
||||
sh_bic[local_id.x] = bic;
|
||||
if is_push {
|
||||
let path_bbox = path_bboxes[inp];
|
||||
|
|
|
@ -19,7 +19,7 @@ var<storage, read_write> reduced: array<Bic>;
|
|||
@group(0) @binding(4)
|
||||
var<storage, read_write> clip_out: array<ClipEl>;
|
||||
|
||||
let WG_SIZE = 256u;
|
||||
const WG_SIZE = 256u;
|
||||
var<workgroup> sh_bic: array<Bic, WG_SIZE>;
|
||||
var<workgroup> sh_parent: array<u32, WG_SIZE>;
|
||||
var<workgroup> sh_path_ix: array<u32, WG_SIZE>;
|
||||
|
|
|
@ -45,9 +45,9 @@ var<storage, read_write> ptcl: array<u32>;
|
|||
|
||||
// Much of this code assumes WG_SIZE == N_TILE. If these diverge, then
|
||||
// a fair amount of fixup is needed.
|
||||
let WG_SIZE = 256u;
|
||||
//let N_SLICE = WG_SIZE / 32u;
|
||||
let N_SLICE = 8u;
|
||||
const WG_SIZE = 256u;
|
||||
//const N_SLICE = WG_SIZE / 32u;
|
||||
const N_SLICE = 8u;
|
||||
|
||||
var<workgroup> sh_bitmaps: array<array<atomic<u32>, N_TILE>, N_SLICE>;
|
||||
var<workgroup> sh_part_count: array<u32, WG_SIZE>;
|
||||
|
@ -55,8 +55,7 @@ var<workgroup> sh_part_offsets: array<u32, WG_SIZE>;
|
|||
var<workgroup> sh_drawobj_ix: array<u32, WG_SIZE>;
|
||||
var<workgroup> sh_tile_stride: array<u32, WG_SIZE>;
|
||||
var<workgroup> sh_tile_width: array<u32, WG_SIZE>;
|
||||
var<workgroup> sh_tile_x0: array<u32, WG_SIZE>;
|
||||
var<workgroup> sh_tile_y0: array<u32, WG_SIZE>;
|
||||
var<workgroup> sh_tile_x0y0: array<u32, WG_SIZE>;
|
||||
var<workgroup> sh_tile_count: array<u32, WG_SIZE>;
|
||||
var<workgroup> sh_tile_base: array<u32, WG_SIZE>;
|
||||
|
||||
|
@ -235,8 +234,7 @@ fn main(
|
|||
let x1 = clamp(i32(path.bbox.z) - i32(bin_tile_x), 0, i32(N_TILE_X));
|
||||
let y1 = clamp(i32(path.bbox.w) - i32(bin_tile_y), 0, i32(N_TILE_Y));
|
||||
sh_tile_width[local_id.x] = u32(x1 - x0);
|
||||
sh_tile_x0[local_id.x] = u32(x0);
|
||||
sh_tile_y0[local_id.x] = u32(y0);
|
||||
sh_tile_x0y0[local_id.x] = u32(x0) | u32(y0 << 16u);
|
||||
tile_count = u32(x1 - x0) * u32(y1 - y0);
|
||||
// base relative to bin
|
||||
let base = path.tiles - u32(dy * i32(stride) + dx);
|
||||
|
@ -270,8 +268,9 @@ fn main(
|
|||
tag = scene[config.drawtag_base + drawobj_ix];
|
||||
let seq_ix = ix - select(0u, sh_tile_count[el_ix - 1u], el_ix > 0u);
|
||||
let width = sh_tile_width[el_ix];
|
||||
let x = sh_tile_x0[el_ix] + seq_ix % width;
|
||||
let y = sh_tile_y0[el_ix] + seq_ix / width;
|
||||
let x0y0 = sh_tile_x0y0[el_ix];
|
||||
let x = (x0y0 & 0xffffu) + seq_ix % width;
|
||||
let y = (x0y0 >> 16u) + seq_ix / width;
|
||||
let tile_ix = sh_tile_base[el_ix] + sh_tile_stride[el_ix] * y + x;
|
||||
let tile = tiles[tile_ix];
|
||||
let is_clip = (tag & 1u) != 0u;
|
||||
|
|
|
@ -28,7 +28,7 @@ var<storage, read_write> info: array<u32>;
|
|||
@group(0) @binding(6)
|
||||
var<storage, read_write> clip_inp: array<ClipInp>;
|
||||
|
||||
let WG_SIZE = 256u;
|
||||
const WG_SIZE = 256u;
|
||||
|
||||
// Possibly dedup?
|
||||
struct Transform {
|
||||
|
|
|
@ -12,7 +12,7 @@ var<storage> scene: array<u32>;
|
|||
@group(0) @binding(2)
|
||||
var<storage, read_write> reduced: array<DrawMonoid>;
|
||||
|
||||
let WG_SIZE = 256u;
|
||||
const WG_SIZE = 256u;
|
||||
|
||||
var<workgroup> sh_scratch: array<DrawMonoid, WG_SIZE>;
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ var<storage> segments: array<Segment>;
|
|||
#import blend
|
||||
#import ptcl
|
||||
|
||||
let GRADIENT_WIDTH = 512;
|
||||
let BLEND_STACK_SPLIT = 4u;
|
||||
const GRADIENT_WIDTH = 512;
|
||||
const BLEND_STACK_SPLIT = 4u;
|
||||
|
||||
@group(0) @binding(3)
|
||||
var output: texture_storage_2d<rgba8unorm, write>;
|
||||
|
@ -95,7 +95,7 @@ var output: texture_storage_2d<r8, write>;
|
|||
|
||||
#endif
|
||||
|
||||
let PIXELS_PER_THREAD = 4u;
|
||||
const PIXELS_PER_THREAD = 4u;
|
||||
|
||||
fn fill_path(tile: Tile, xy: vec2<f32>) -> array<f32, PIXELS_PER_THREAD> {
|
||||
var area: array<f32, PIXELS_PER_THREAD>;
|
||||
|
|
|
@ -45,12 +45,12 @@ struct SubdivResult {
|
|||
a2: f32,
|
||||
}
|
||||
|
||||
let D = 0.67;
|
||||
const D = 0.67;
|
||||
fn approx_parabola_integral(x: f32) -> f32 {
|
||||
return x * inverseSqrt(sqrt(1.0 - D + (D * D * D * D + 0.25 * x * x)));
|
||||
}
|
||||
|
||||
let B = 0.39;
|
||||
const B = 0.39;
|
||||
fn approx_parabola_inv_integral(x: f32) -> f32 {
|
||||
return x * sqrt(1.0 - B + (B * B + 0.5 * x * x));
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ fn alloc_segment() -> u32 {
|
|||
return atomicAdd(&bump.segments, 1u) + 1u;
|
||||
}
|
||||
|
||||
let MAX_QUADS = 16u;
|
||||
const MAX_QUADS = 16u;
|
||||
|
||||
@compute @workgroup_size(256)
|
||||
fn main(
|
||||
|
|
|
@ -12,8 +12,8 @@ var<storage> scene: array<u32>;
|
|||
@group(0) @binding(2)
|
||||
var<storage, read_write> reduced: array<TagMonoid>;
|
||||
|
||||
let LG_WG_SIZE = 8u;
|
||||
let WG_SIZE = 256u;
|
||||
const LG_WG_SIZE = 8u;
|
||||
const WG_SIZE = 256u;
|
||||
|
||||
var<workgroup> sh_scratch: array<TagMonoid, WG_SIZE>;
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ var<storage> reduced: array<TagMonoid>;
|
|||
@group(0) @binding(3)
|
||||
var<storage, read_write> tag_monoids: array<TagMonoid>;
|
||||
|
||||
let LG_WG_SIZE = 8u;
|
||||
let WG_SIZE = 256u;
|
||||
const LG_WG_SIZE = 8u;
|
||||
const WG_SIZE = 256u;
|
||||
|
||||
var<workgroup> sh_parent: array<TagMonoid, WG_SIZE>;
|
||||
// These could be combined?
|
||||
|
|
|
@ -2,23 +2,23 @@
|
|||
|
||||
// Color mixing modes
|
||||
|
||||
let MIX_NORMAL = 0u;
|
||||
let MIX_MULTIPLY = 1u;
|
||||
let MIX_SCREEN = 2u;
|
||||
let MIX_OVERLAY = 3u;
|
||||
let MIX_DARKEN = 4u;
|
||||
let MIX_LIGHTEN = 5u;
|
||||
let MIX_COLOR_DODGE = 6u;
|
||||
let MIX_COLOR_BURN = 7u;
|
||||
let MIX_HARD_LIGHT = 8u;
|
||||
let MIX_SOFT_LIGHT = 9u;
|
||||
let MIX_DIFFERENCE = 10u;
|
||||
let MIX_EXCLUSION = 11u;
|
||||
let MIX_HUE = 12u;
|
||||
let MIX_SATURATION = 13u;
|
||||
let MIX_COLOR = 14u;
|
||||
let MIX_LUMINOSITY = 15u;
|
||||
let MIX_CLIP = 128u;
|
||||
const MIX_NORMAL = 0u;
|
||||
const MIX_MULTIPLY = 1u;
|
||||
const MIX_SCREEN = 2u;
|
||||
const MIX_OVERLAY = 3u;
|
||||
const MIX_DARKEN = 4u;
|
||||
const MIX_LIGHTEN = 5u;
|
||||
const MIX_COLOR_DODGE = 6u;
|
||||
const MIX_COLOR_BURN = 7u;
|
||||
const MIX_HARD_LIGHT = 8u;
|
||||
const MIX_SOFT_LIGHT = 9u;
|
||||
const MIX_DIFFERENCE = 10u;
|
||||
const MIX_EXCLUSION = 11u;
|
||||
const MIX_HUE = 12u;
|
||||
const MIX_SATURATION = 13u;
|
||||
const MIX_COLOR = 14u;
|
||||
const MIX_LUMINOSITY = 15u;
|
||||
const MIX_CLIP = 128u;
|
||||
|
||||
fn screen(cb: vec3<f32>, cs: vec3<f32>) -> vec3<f32> {
|
||||
return cb + cs - (cb * cs);
|
||||
|
@ -74,8 +74,8 @@ fn lum(c: vec3<f32>) -> f32 {
|
|||
return dot(c, f);
|
||||
}
|
||||
|
||||
fn clip_color(c: vec3<f32>) -> vec3<f32> {
|
||||
var c = c;
|
||||
fn clip_color(c_in: vec3<f32>) -> vec3<f32> {
|
||||
var c = c_in;
|
||||
let l = lum(c);
|
||||
let n = min(c.x, min(c.y, c.z));
|
||||
let x = max(c.x, max(c.y, c.z));
|
||||
|
@ -210,20 +210,20 @@ fn blend_mix(cb: vec3<f32>, cs: vec3<f32>, mode: u32) -> vec3<f32> {
|
|||
|
||||
// Composition modes
|
||||
|
||||
let COMPOSE_CLEAR = 0u;
|
||||
let COMPOSE_COPY = 1u;
|
||||
let COMPOSE_DEST = 2u;
|
||||
let COMPOSE_SRC_OVER = 3u;
|
||||
let COMPOSE_DEST_OVER = 4u;
|
||||
let COMPOSE_SRC_IN = 5u;
|
||||
let COMPOSE_DEST_IN = 6u;
|
||||
let COMPOSE_SRC_OUT = 7u;
|
||||
let COMPOSE_DEST_OUT = 8u;
|
||||
let COMPOSE_SRC_ATOP = 9u;
|
||||
let COMPOSE_DEST_ATOP = 10u;
|
||||
let COMPOSE_XOR = 11u;
|
||||
let COMPOSE_PLUS = 12u;
|
||||
let COMPOSE_PLUS_LIGHTER = 13u;
|
||||
const COMPOSE_CLEAR = 0u;
|
||||
const COMPOSE_COPY = 1u;
|
||||
const COMPOSE_DEST = 2u;
|
||||
const COMPOSE_SRC_OVER = 3u;
|
||||
const COMPOSE_DEST_OVER = 4u;
|
||||
const COMPOSE_SRC_IN = 5u;
|
||||
const COMPOSE_DEST_IN = 6u;
|
||||
const COMPOSE_SRC_OUT = 7u;
|
||||
const COMPOSE_DEST_OUT = 8u;
|
||||
const COMPOSE_SRC_ATOP = 9u;
|
||||
const COMPOSE_DEST_ATOP = 10u;
|
||||
const COMPOSE_XOR = 11u;
|
||||
const COMPOSE_PLUS = 12u;
|
||||
const COMPOSE_PLUS_LIGHTER = 13u;
|
||||
|
||||
// Apply general compositing operation.
|
||||
// Inputs are separated colors and alpha, output is premultiplied.
|
||||
|
|
|
@ -29,10 +29,10 @@ struct Config {
|
|||
|
||||
// Geometry of tiles and bins
|
||||
|
||||
let TILE_WIDTH = 16u;
|
||||
let TILE_HEIGHT = 16u;
|
||||
const TILE_WIDTH = 16u;
|
||||
const TILE_HEIGHT = 16u;
|
||||
// Number of tiles per bin
|
||||
let N_TILE_X = 16u;
|
||||
let N_TILE_Y = 16u;
|
||||
//let N_TILE = N_TILE_X * N_TILE_Y;
|
||||
let N_TILE = 256u;
|
||||
const N_TILE_X = 16u;
|
||||
const N_TILE_Y = 16u;
|
||||
//const N_TILE = N_TILE_X * N_TILE_Y;
|
||||
const N_TILE = 256u;
|
||||
|
|
|
@ -10,4 +10,4 @@ struct Cubic {
|
|||
flags: u32,
|
||||
}
|
||||
|
||||
let CUBIC_IS_STROKE = 1u;
|
||||
const CUBIC_IS_STROKE = 1u;
|
||||
|
|
|
@ -15,13 +15,13 @@ struct DrawMonoid {
|
|||
|
||||
// Each draw object has a 32-bit draw tag, which is a bit-packed
|
||||
// version of the draw monoid.
|
||||
let DRAWTAG_NOP = 0u;
|
||||
let DRAWTAG_FILL_COLOR = 0x44u;
|
||||
let DRAWTAG_FILL_LIN_GRADIENT = 0x114u;
|
||||
let DRAWTAG_FILL_RAD_GRADIENT = 0x2dcu;
|
||||
let DRAWTAG_FILL_IMAGE = 0x48u;
|
||||
let DRAWTAG_BEGIN_CLIP = 0x9u;
|
||||
let DRAWTAG_END_CLIP = 0x21u;
|
||||
const DRAWTAG_NOP = 0u;
|
||||
const DRAWTAG_FILL_COLOR = 0x44u;
|
||||
const DRAWTAG_FILL_LIN_GRADIENT = 0x114u;
|
||||
const DRAWTAG_FILL_RAD_GRADIENT = 0x2dcu;
|
||||
const DRAWTAG_FILL_IMAGE = 0x48u;
|
||||
const DRAWTAG_BEGIN_CLIP = 0x9u;
|
||||
const DRAWTAG_END_CLIP = 0x21u;
|
||||
|
||||
fn draw_monoid_identity() -> DrawMonoid {
|
||||
return DrawMonoid();
|
||||
|
|
|
@ -11,15 +11,15 @@ struct TagMonoid {
|
|||
#endif
|
||||
}
|
||||
|
||||
let PATH_TAG_SEG_TYPE = 3u;
|
||||
let PATH_TAG_LINETO = 1u;
|
||||
let PATH_TAG_QUADTO = 2u;
|
||||
let PATH_TAG_CUBICTO = 3u;
|
||||
let PATH_TAG_F32 = 8u;
|
||||
let PATH_TAG_TRANSFORM = 0x20u;
|
||||
const PATH_TAG_SEG_TYPE = 3u;
|
||||
const PATH_TAG_LINETO = 1u;
|
||||
const PATH_TAG_QUADTO = 2u;
|
||||
const PATH_TAG_CUBICTO = 3u;
|
||||
const PATH_TAG_F32 = 8u;
|
||||
const PATH_TAG_TRANSFORM = 0x20u;
|
||||
#ifdef full
|
||||
let PATH_TAG_PATH = 0x10u;
|
||||
let PATH_TAG_LINEWIDTH = 0x40u;
|
||||
const PATH_TAG_PATH = 0x10u;
|
||||
const PATH_TAG_LINEWIDTH = 0x40u;
|
||||
#endif
|
||||
|
||||
fn tag_monoid_identity() -> TagMonoid {
|
||||
|
|
|
@ -2,23 +2,23 @@
|
|||
|
||||
// Layout of per-tile command list
|
||||
// Initial allocation, in u32's.
|
||||
let PTCL_INITIAL_ALLOC = 64u;
|
||||
let PTCL_INCREMENT = 256u;
|
||||
const PTCL_INITIAL_ALLOC = 64u;
|
||||
const PTCL_INCREMENT = 256u;
|
||||
|
||||
// Amount of space taken by jump
|
||||
let PTCL_HEADROOM = 2u;
|
||||
const PTCL_HEADROOM = 2u;
|
||||
|
||||
// Tags for PTCL commands
|
||||
let CMD_END = 0u;
|
||||
let CMD_FILL = 1u;
|
||||
let CMD_STROKE = 2u;
|
||||
let CMD_SOLID = 3u;
|
||||
let CMD_COLOR = 5u;
|
||||
let CMD_LIN_GRAD = 6u;
|
||||
let CMD_RAD_GRAD = 7u;
|
||||
let CMD_BEGIN_CLIP = 9u;
|
||||
let CMD_END_CLIP = 10u;
|
||||
let CMD_JUMP = 11u;
|
||||
const CMD_END = 0u;
|
||||
const CMD_FILL = 1u;
|
||||
const CMD_STROKE = 2u;
|
||||
const CMD_SOLID = 3u;
|
||||
const CMD_COLOR = 5u;
|
||||
const CMD_LIN_GRAD = 6u;
|
||||
const CMD_RAD_GRAD = 7u;
|
||||
const CMD_BEGIN_CLIP = 9u;
|
||||
const CMD_END_CLIP = 10u;
|
||||
const CMD_JUMP = 11u;
|
||||
|
||||
// The individual PTCL structs are written here, but read/write is by
|
||||
// hand in the relevant shaders
|
||||
|
|
|
@ -25,7 +25,7 @@ var<storage, read_write> paths: array<Path>;
|
|||
@group(0) @binding(5)
|
||||
var<storage, read_write> tiles: array<Tile>;
|
||||
|
||||
let WG_SIZE = 256u;
|
||||
const WG_SIZE = 256u;
|
||||
|
||||
var<workgroup> sh_tile_count: array<u32, WG_SIZE>;
|
||||
var<workgroup> sh_tile_offset: u32;
|
||||
|
|
10
run-wasm/Cargo.toml
Normal file
10
run-wasm/Cargo.toml
Normal file
|
@ -0,0 +1,10 @@
|
|||
[package]
|
||||
name = "run-wasm"
|
||||
version.workspace = true
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
cargo-run-wasm = "0.2.0"
|
3
run-wasm/src/main.rs
Normal file
3
run-wasm/src/main.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
cargo_run_wasm::run_wasm_with_css("body { margin: 0px; }");
|
||||
}
|
Loading…
Reference in a new issue