Skip to content

Commit 87ecc08

Browse files
cwfitzgeraldjimblandy
authored andcommitted
Remove id32 feature
1 parent d9784ac commit 87ecc08

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

wgpu-core/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ replay = ["serde", "wgt/replay", "arrayvec/serde", "naga/deserialize"]
5656
## Enable serializable compute/render passes, and bundle encoders.
5757
serial-pass = ["serde", "wgt/serde", "arrayvec/serde"]
5858

59-
id32 = []
60-
6159
## Enable `ShaderModuleSource::Wgsl`
6260
wgsl = ["naga/wgsl-in"]
6361

wgpu-core/src/id.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,8 @@ use std::{
88
};
99
use wgt::{Backend, WasmNotSendSync};
1010

11-
#[cfg(feature = "id32")]
12-
type IdType = u32;
13-
#[cfg(not(feature = "id32"))]
1411
type IdType = u64;
15-
#[cfg(feature = "id32")]
16-
type NonZeroId = std::num::NonZeroU32;
17-
#[cfg(not(feature = "id32"))]
1812
type NonZeroId = std::num::NonZeroU64;
19-
#[cfg(feature = "id32")]
20-
type ZippedIndex = u16;
21-
#[cfg(not(feature = "id32"))]
2213
type ZippedIndex = Index;
2314

2415
const INDEX_BITS: usize = std::mem::size_of::<ZippedIndex>() * 8;

wgpu/src/backend/direct.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,9 +3064,7 @@ where
30643064
T: 'static + WasmNotSendSync,
30653065
{
30663066
fn from(id: ObjectId) -> Self {
3067-
// If the id32 feature is enabled in wgpu-core, this will make sure that the id fits in a NonZeroU32.
3068-
#[allow(clippy::useless_conversion)]
3069-
let id = id.id().try_into().expect("Id exceeded 32-bits");
3067+
let id = id.id();
30703068
// SAFETY: The id was created via the impl below
30713069
unsafe { Self::from_raw(id) }
30723070
}
@@ -3077,9 +3075,7 @@ where
30773075
T: 'static + WasmNotSendSync,
30783076
{
30793077
fn from(id: wgc::id::Id<T>) -> Self {
3080-
// If the id32 feature is enabled in wgpu-core, the conversion is not useless
3081-
#[allow(clippy::useless_conversion)]
3082-
let id = id.into_raw().into();
3078+
let id = id.into_raw();
30833079
Self::from_global_id(id)
30843080
}
30853081
}

wgpu/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5170,6 +5170,14 @@ impl Surface<'_> {
51705170
#[repr(transparent)]
51715171
pub struct Id<T>(NonZeroU64, PhantomData<*mut T>);
51725172

5173+
impl<T> Id<T> {
5174+
/// For testing use only. We provide no guarentees about the actual value of the ids.
5175+
#[doc(hidden)]
5176+
pub fn inner(&self) -> u64 {
5177+
self.0.get()
5178+
}
5179+
}
5180+
51735181
// SAFETY: `Id` is a bare `NonZeroU64`, the type parameter is a marker purely to avoid confusing Ids
51745182
// returned for different types , so `Id` can safely implement Send and Sync.
51755183
unsafe impl<T> Send for Id<T> {}

0 commit comments

Comments
 (0)