Skip to content

Commit

Permalink
Update wgpu-hal to 0.16.1 to fix mobile Safari (#2296)
Browse files Browse the repository at this point in the history
The release contains gfx-rs/wgpu#3780

Closes #2032

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)

<!-- This line will get updated when the PR build summary job finishes.
-->
PR Build Summary: https://build.rerun.io/pr/2296

<!-- pr-link-docs:start -->
Docs preview: https://rerun.io/preview/9ebf96a/docs
<!-- pr-link-docs:end -->
  • Loading branch information
emilk authored Jun 1, 2023
1 parent 16ed497 commit 91d8b96
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 7 deletions.
7 changes: 5 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/re_build_web_viewer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ all-features = true


[dependencies]
re_error.workspace = true

anyhow.workspace = true
cargo_metadata = "0.15"
wasm-bindgen-cli-support = "0.2.86"
18 changes: 16 additions & 2 deletions crates/re_build_web_viewer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,27 @@ pub fn build(release: bool, webgpu: bool) -> anyhow::Result<()> {
.join(format!("{crate_name}.wasm"));

// wasm-bindgen --target web target_wasm_path --no-typescript --out-name target_name --out-dir build_dir
wasm_bindgen_cli_support::Bindgen::new()
if let Err(err) = wasm_bindgen_cli_support::Bindgen::new()
.no_modules(true)?
.input_path(target_wasm_path.as_str())
.typescript(false)
.out_name(target_name.as_str())
.generate(build_dir.as_str())
.context("Failed to run wasm-bindgen")?;
{
if err
.to_string()
.starts_with("cannot import from modules (`env`")
{
// Very common error: "cannot import from modules (`env`) with `--no-modules`"
anyhow::bail!(
"Failed to run wasm-bindgen: {err}. This is often because some dependency is calling `std::time::Instant::now()` or similar. You can try diagnosing this with:\n\
wasm2wat {target_wasm_path} | rg '\"env\"'\n\
wasm2wat {target_wasm_path} | rg 'call .now\\b' -B 20"
);
} else {
return Err(err.context("Failed to run wasm-bindgen"));
}
}

// --------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion crates/re_build_web_viewer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn main() -> ExitCode {
};

if let Err(err) = re_build_web_viewer::build(release, webgpu) {
eprintln!("Failed to build web viewer: {err}");
eprintln!("Failed to build web viewer: {}", re_error::format(err));
ExitCode::FAILURE
} else {
ExitCode::SUCCESS
Expand Down
2 changes: 1 addition & 1 deletion crates/re_error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/// Format an error, including its chain of sources.
///
/// Always use this when displaying an error.
/// Always use this when displaying an error, especially `anyhow::Error`.
pub fn format(error: impl AsRef<dyn std::error::Error>) -> String {
fn format_impl(error: &dyn std::error::Error) -> String {
let mut string = error.to_string();
Expand Down
1 change: 1 addition & 0 deletions crates/re_renderer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ static_assertions = "1.1"
thiserror.workspace = true
type-map = "0.5"
wgpu.workspace = true
wgpu-hal = "0.16.1" # wgpu-hal 0.16.1 contains a critical fix for mobile devices: https://github.com/gfx-rs/wgpu/pull/3780

# optional
arrow2 = { workspace = true, optional = true }
Expand Down
1 change: 1 addition & 0 deletions crates/re_web_viewer_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ re_analytics = { workspace = true, optional = true }
[build-dependencies]
re_build_build_info.workspace = true
re_build_web_viewer.workspace = true
re_error.workspace = true
6 changes: 5 additions & 1 deletion crates/re_web_viewer_server/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ fn main() {
eprintln!("__ci feature detected: Skipping building of web viewer wasm.");
} else {
let release = std::env::var("PROFILE").unwrap() == "release";
re_build_web_viewer::build(release, is_tracked_env_var_set("RERUN_BUILD_WEBGPU")).unwrap();
if let Err(err) =
re_build_web_viewer::build(release, is_tracked_env_var_set("RERUN_BUILD_WEBGPU"))
{
panic!("Failed to build web viewer: {}", re_error::format(err));
}
}
}

1 comment on commit 91d8b96

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.25.

Benchmark suite Current: 91d8b96 Previous: 16ed497 Ratio
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at/default 400 ns/iter (± 1) 306 ns/iter (± 5) 1.31
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/primary/default 290 ns/iter (± 0) 223 ns/iter (± 0) 1.30
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/secondaries/default 453 ns/iter (± 2) 338 ns/iter (± 0) 1.34
datastore/num_rows=1000/num_instances=1000/packed=false/range/default 3613641 ns/iter (± 168837) 2885222 ns/iter (± 12308) 1.25
datastore/num_rows=1000/num_instances=1000/gc/default 2594837 ns/iter (± 4652) 1723081 ns/iter (± 4225) 1.51
mono_points_arrow/decode_message_bundles 83476385 ns/iter (± 1661003) 64325906 ns/iter (± 4724854) 1.30
mono_points_arrow_batched/generate_message_bundles 26785464 ns/iter (± 2360653) 18838193 ns/iter (± 1244498) 1.42
mono_points_arrow_batched/generate_messages 5568171 ns/iter (± 320505) 3628205 ns/iter (± 66418) 1.53
mono_points_arrow_batched/encode_log_msg 640186 ns/iter (± 1941) 417836 ns/iter (± 2865) 1.53
mono_points_arrow_batched/encode_total 34070845 ns/iter (± 2106493) 23852399 ns/iter (± 966547) 1.43
mono_points_arrow_batched/decode_log_msg 508344 ns/iter (± 1840) 320169 ns/iter (± 1301) 1.59
mono_points_arrow_batched/decode_total 10061220 ns/iter (± 271751) 7915340 ns/iter (± 132121) 1.27
batch_points_arrow/encode_log_msg 92066 ns/iter (± 420) 57636 ns/iter (± 566) 1.60
batch_points_arrow/encode_total 373359 ns/iter (± 1294) 278475 ns/iter (± 470) 1.34
batch_points_arrow/decode_log_msg 69061 ns/iter (± 279) 47814 ns/iter (± 496) 1.44
batch_points_arrow/decode_total 77719 ns/iter (± 222) 51746 ns/iter (± 153) 1.50
arrow_mono_points/insert 2789076160 ns/iter (± 15878747) 1823411288 ns/iter (± 10698615) 1.53
arrow_mono_points/query 1377594 ns/iter (± 17394) 975102 ns/iter (± 1742) 1.41
arrow_batch_points/query 16167 ns/iter (± 75) 12108 ns/iter (± 7) 1.34
arrow_batch_vecs/query 446857 ns/iter (± 947) 316420 ns/iter (± 321) 1.41

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.