File tree 14 files changed +48
-142
lines changed
14 files changed +48
-142
lines changed Original file line number Diff line number Diff line change
1
+ raytrace_parallel.js
2
+ raytrace_parallel_bg.wasm
Original file line number Diff line number Diff line change @@ -9,7 +9,9 @@ online][compiled]
9
9
You can build the example locally with:
10
10
11
11
```
12
- $ python3 run.py
12
+ $ ./ run.sh
13
13
```
14
14
15
+ (or running the commands on Windows manually)
16
+
15
17
and then visiting http://localhost:8080 in a browser should run the example!
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2
2
3
3
set -ex
4
4
5
- python3 build.py
5
+ # A couple of steps are necessary to get this build working which makes it slightly
6
+ # nonstandard compared to most other builds.
7
+ #
8
+ # * First, the Rust standard library needs to be recompiled with atomics
9
+ # enabled. to do that we use Cargo's unstable `-Zbuild-std` feature.
10
+ #
11
+ # * Next we need to compile everything with the `atomics` and `bulk-memory`
12
+ # features enabled, ensuring that LLVM will generate atomic instructions,
13
+ # shared memory, passive segments, etc.
14
+
15
+ RUSTFLAGS=' -C target-feature=+atomics,+bulk-memory,+mutable-globals' \
16
+ cargo build --target wasm32-unknown-unknown --release -Z build-std=std,panic_abort
17
+
18
+ # Note the usage of `--target no-modules` here which is required for passing
19
+ # the memory import to each wasm module.
20
+ cargo run -p wasm-bindgen-cli -- \
21
+ ../../target/wasm32-unknown-unknown/release/raytrace_parallel.wasm \
22
+ --out-dir . \
23
+ --target no-modules
Original file line number Diff line number Diff line change 219
219
document . getElementById ( 'render' ) . disabled = true ;
220
220
document . getElementById ( 'concurrency' ) . disabled = true ;
221
221
</ script >
222
- < script src ='pkg/ raytrace_parallel.js '> </ script >
222
+ < script src ='raytrace_parallel.js '> </ script >
223
223
< script src ='index.js '> </ script >
224
224
</ body >
225
225
</ html >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2
2
3
3
set -ex
4
4
5
- python3 build.py
5
+ ./ build.sh
6
6
7
7
python3 server.py
Original file line number Diff line number Diff line change 1
1
// synchronously, using the browser, import out shim JS scripts
2
- importScripts ( 'pkg/ raytrace_parallel.js' ) ;
2
+ importScripts ( 'raytrace_parallel.js' ) ;
3
3
4
4
// Wait for the main thread to send us the shared module/memory. Once we've got
5
5
// it, initialize it all with the `wasm_bindgen` global we imported via
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ online][compiled]
9
9
You can build the example locally with:
10
10
11
11
```
12
- $ python3 run.py
12
+ $ ./ run.sh
13
13
```
14
14
15
15
(or running the commands on Windows manually)
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2
2
3
3
set -ex
4
4
5
- python3 build.py
5
+ # A couple of steps are necessary to get this build working which makes it slightly
6
+ # nonstandard compared to most other builds.
7
+ #
8
+ # * First, the Rust standard library needs to be recompiled with atomics
9
+ # enabled. to do that we use Cargo's unstable `-Zbuild-std` feature.
10
+ #
11
+ # * Next we need to compile everything with the `atomics` and `bulk-memory`
12
+ # features enabled, ensuring that LLVM will generate atomic instructions,
13
+ # shared memory, passive segments, etc.
14
+
15
+ RUSTFLAGS=' -C target-feature=+atomics,+bulk-memory,+mutable-globals' \
16
+ cargo build --target wasm32-unknown-unknown --release -Z build-std=std,panic_abort
17
+
18
+ cargo run -p wasm-bindgen-cli -- \
19
+ ../../target/wasm32-unknown-unknown/release/wasm_audio_worklet.wasm \
20
+ --out-dir . \
21
+ --target web \
22
+ --split-linked-modules
Original file line number Diff line number Diff line change 5
5
</ head >
6
6
< body >
7
7
< script type ="module ">
8
- import init , { web_main } from "./pkg/ wasm_audio_worklet.js" ;
8
+ import init , { web_main } from "./wasm_audio_worklet.js" ;
9
9
async function run ( ) {
10
10
await init ( ) ;
11
11
web_main ( ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2
2
3
3
set -ex
4
4
5
- python3 build.py
5
+ ./ build.sh
6
6
7
7
python3 server.py
You can’t perform that action at this time.
0 commit comments