Skip to content

Commit df54acc

Browse files
use hashbrown in more crates (etc.) (#6938)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
1 parent fcbadc9 commit df54acc

File tree

28 files changed

+96
-60
lines changed

28 files changed

+96
-60
lines changed

CHANGELOG.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,16 @@ Bottom level categories:
5050

5151
#### General
5252

53+
- Use `hashbrown` to simplify no-std support. By Brody in [#6938](https://github.com/gfx-rs/wgpu/pull/6938) & [#6925](https://github.com/gfx-rs/wgpu/pull/6925).
5354
- If you use Binding Arrays in a bind group, you may not use Dynamic Offset Buffers or Uniform Buffers in that bind group. By @cwfitzgerald in [#6811](https://github.com/gfx-rs/wgpu/pull/6811)
5455

56+
5557
##### Refactored internal trace path parameter
5658

5759
Refactored some functions to handle the internal trace path as a string to avoid possible issues with `no_std` support.
5860

5961
By @brodycj in [#6924](https://github.com/gfx-rs/wgpu/pull/6924).
6062

61-
##### Start using `hashbrown`
62-
63-
Use `hashbrown` in `wgpu-core`, `wgpu-hal` & `wgpu-info` to simplify no-std support. (This may help improve performance as well.)
64-
65-
By @brodycj in [#6925](https://github.com/gfx-rs/wgpu/pull/6925).
66-
6763
#### Vulkan
6864

6965
##### HAL queue callback support

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ default-members = [
4545
[workspace.lints.clippy]
4646
manual_c_str_literals = "allow"
4747
ref_as_ptr = "warn"
48+
# NOTE: disallowed-types is configured in other file: clippy.toml
4849

4950
[workspace.package]
5051
edition = "2021"
@@ -126,9 +127,11 @@ raw-window-handle = "0.6"
126127
rayon = "1"
127128
renderdoc-sys = "1.1.0"
128129
ron = "0.8"
129-
# rustc-hash 2.0 is a completely different hasher with different performance characteristics
130+
# NOTE: rustc-hash v2 is a completely different hasher with different performance characteristics
131+
# see discussion here (including with some other alternatives): https://github.com/gfx-rs/wgpu/issues/6999
132+
# (using default-features = false to support no-std build, avoiding any extra features that may require std::collections)
133+
rustc-hash = { version = "1", default-features = false }
130134
serde_json = "1.0.137"
131-
rustc-hash = "1"
132135
serde = { version = "1", default-features = false }
133136
smallvec = "1"
134137
static_assertions = "1.1.0"

clippy.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# NOTE: Other global Clippy config is in top-level Cargo.toml.
2+
3+
disallowed-types = [
4+
{ path = "std::collections::HashMap", reason = "use hashbrown::HashMap instead" },
5+
{ path = "std::collections::HashSet", reason = "use hashbrown::HashSet instead" },
6+
{ path = "rustc_hash::FxHashMap", reason = "use hashbrown::HashMap instead" },
7+
{ path = "rustc_hash::FxHashSet", reason = "use hashbrown::HashSet instead" },
8+
]

deno_webgpu/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ wgpu-core = { workspace = true, features = [
2828
wgpu-types = { workspace = true, features = ["serde"] }
2929

3030
deno_core.workspace = true
31+
hashbrown = { workspace = true, features = ["serde"] }
3132
raw-window-handle = { workspace = true }
3233
serde = { workspace = true, features = ["derive"] }
3334
thiserror.workspace = true

deno_webgpu/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use deno_core::op2;
66
use deno_core::OpState;
77
use deno_core::Resource;
88
use deno_core::ResourceId;
9+
use hashbrown::HashSet;
910
use serde::Deserialize;
1011
use serde::Serialize;
1112
use std::borrow::Cow;
1213
use std::cell::RefCell;
13-
use std::collections::HashSet;
1414
use std::rc::Rc;
1515

1616
use error::WebGpuResult;

deno_webgpu/pipeline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use deno_core::op2;
55
use deno_core::OpState;
66
use deno_core::Resource;
77
use deno_core::ResourceId;
8+
use hashbrown::HashMap;
89
use serde::Deserialize;
910
use serde::Serialize;
1011
use std::borrow::Cow;
11-
use std::collections::HashMap;
1212
use std::rc::Rc;
1313

1414
use super::error::WebGpuError;

examples/features/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,6 @@ web-sys = { workspace = true, features = [
7474

7575
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
7676
wasm-bindgen-test.workspace = true
77+
78+
[lints.clippy]
79+
disallowed_types = "allow"

lock-analyzer/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ anyhow.workspace = true
1717
[dependencies.serde]
1818
workspace = true
1919
features = ["default", "serde_derive"]
20+
21+
[lints.clippy]
22+
disallowed_types = "allow"

naga/Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,13 @@ msl-out = []
4141
## If you want to enable MSL output it regardless of the target platform, use `naga/msl-out`.
4242
msl-out-if-target-apple = []
4343

44-
serialize = ["dep:serde", "bitflags/serde", "indexmap/serde"]
45-
deserialize = ["dep:serde", "bitflags/serde", "indexmap/serde"]
44+
serialize = ["dep:serde", "bitflags/serde", "hashbrown/serde", "indexmap/serde"]
45+
deserialize = [
46+
"dep:serde",
47+
"bitflags/serde",
48+
"hashbrown/serde",
49+
"indexmap/serde",
50+
]
4651
arbitrary = ["dep:arbitrary", "bitflags/arbitrary", "indexmap/arbitrary"]
4752
spv-in = ["dep:petgraph", "dep:spirv"]
4853
spv-out = ["dep:spirv"]
@@ -72,6 +77,7 @@ termcolor = { version = "1.4.1" }
7277
# termcolor minimum version was wrong and was fixed in
7378
# https://github.com/brendanzab/codespan/commit/e99c867339a877731437e7ee6a903a3d03b5439e
7479
codespan-reporting = { version = "0.11.0" }
80+
hashbrown.workspace = true
7581
rustc-hash.workspace = true
7682
indexmap.workspace = true
7783
log = "0.4"

0 commit comments

Comments
 (0)