Skip to content

Commit

Permalink
Revert "Update parallel raytracing .gitignore (rustwasm#3606)"
Browse files Browse the repository at this point in the history
This reverts commit 792be2d.
  • Loading branch information
daxpedda committed Sep 28, 2023
1 parent 792be2d commit 18b1d9f
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 142 deletions.
2 changes: 2 additions & 0 deletions examples/raytrace-parallel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
raytrace_parallel.js
raytrace_parallel_bg.wasm
4 changes: 3 additions & 1 deletion examples/raytrace-parallel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ online][compiled]
You can build the example locally with:

```
$ python3 run.py
$ ./run.sh
```

(or running the commands on Windows manually)

and then visiting http://localhost:8080 in a browser should run the example!
57 changes: 0 additions & 57 deletions examples/raytrace-parallel/build.py

This file was deleted.

20 changes: 19 additions & 1 deletion examples/raytrace-parallel/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,22 @@

set -ex

python3 build.py
# A couple of steps are necessary to get this build working which makes it slightly
# nonstandard compared to most other builds.
#
# * First, the Rust standard library needs to be recompiled with atomics
# enabled. to do that we use Cargo's unstable `-Zbuild-std` feature.
#
# * Next we need to compile everything with the `atomics` and `bulk-memory`
# features enabled, ensuring that LLVM will generate atomic instructions,
# shared memory, passive segments, etc.

RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \
cargo build --target wasm32-unknown-unknown --release -Z build-std=std,panic_abort

# Note the usage of `--target no-modules` here which is required for passing
# the memory import to each wasm module.
cargo run -p wasm-bindgen-cli -- \
../../target/wasm32-unknown-unknown/release/raytrace_parallel.wasm \
--out-dir . \
--target no-modules
2 changes: 1 addition & 1 deletion examples/raytrace-parallel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
document.getElementById('render').disabled = true;
document.getElementById('concurrency').disabled = true;
</script>
<script src='pkg/raytrace_parallel.js'></script>
<script src='raytrace_parallel.js'></script>
<script src='index.js'></script>
</body>
</html>
9 changes: 0 additions & 9 deletions examples/raytrace-parallel/run.py

This file was deleted.

2 changes: 1 addition & 1 deletion examples/raytrace-parallel/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -ex

python3 build.py
./build.sh

python3 server.py
2 changes: 1 addition & 1 deletion examples/raytrace-parallel/worker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// synchronously, using the browser, import out shim JS scripts
importScripts('pkg/raytrace_parallel.js');
importScripts('raytrace_parallel.js');

// Wait for the main thread to send us the shared module/memory. Once we've got
// it, initialize it all with the `wasm_bindgen` global we imported via
Expand Down
2 changes: 1 addition & 1 deletion examples/wasm-audio-worklet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ online][compiled]
You can build the example locally with:

```
$ python3 run.py
$ ./run.sh
```

(or running the commands on Windows manually)
Expand Down
58 changes: 0 additions & 58 deletions examples/wasm-audio-worklet/build.py

This file was deleted.

19 changes: 18 additions & 1 deletion examples/wasm-audio-worklet/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,21 @@

set -ex

python3 build.py
# A couple of steps are necessary to get this build working which makes it slightly
# nonstandard compared to most other builds.
#
# * First, the Rust standard library needs to be recompiled with atomics
# enabled. to do that we use Cargo's unstable `-Zbuild-std` feature.
#
# * Next we need to compile everything with the `atomics` and `bulk-memory`
# features enabled, ensuring that LLVM will generate atomic instructions,
# shared memory, passive segments, etc.

RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \
cargo build --target wasm32-unknown-unknown --release -Z build-std=std,panic_abort

cargo run -p wasm-bindgen-cli -- \
../../target/wasm32-unknown-unknown/release/wasm_audio_worklet.wasm \
--out-dir . \
--target web \
--split-linked-modules
2 changes: 1 addition & 1 deletion examples/wasm-audio-worklet/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</head>
<body>
<script type="module">
import init, {web_main} from "./pkg/wasm_audio_worklet.js";
import init, {web_main} from "./wasm_audio_worklet.js";
async function run() {
await init();
web_main();
Expand Down
9 changes: 0 additions & 9 deletions examples/wasm-audio-worklet/run.py

This file was deleted.

2 changes: 1 addition & 1 deletion examples/wasm-audio-worklet/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -ex

python3 build.py
./build.sh

python3 server.py

0 comments on commit 18b1d9f

Please sign in to comment.