Skip to content

Commit 66c029f

Browse files
authored
Pass correct surface for existing canvases (#3718)
1 parent 4220a42 commit 66c029f

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

wgpu/src/backend/web.rs

-13
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,6 @@ impl<T> From<Identified<T>> for ObjectId {
6363
}
6464
}
6565

66-
#[allow(unused_variables)]
67-
impl<T> From<(Identified<T>, Sendable<T>)> for ObjectId {
68-
fn from((id, _data): (Identified<T>, Sendable<T>)) -> Self {
69-
Self::new(
70-
// TODO: the ID isn't used, so we hardcode it to 1 for now until we rework this
71-
// API.
72-
core::num::NonZeroU64::new(1).unwrap(),
73-
#[cfg(feature = "expose-ids")]
74-
id.0,
75-
)
76-
}
77-
}
78-
7966
#[derive(Clone, Debug)]
8067
pub(crate) struct Sendable<T>(T);
8168
unsafe impl<T> Send for Sendable<T> {}

wgpu/src/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ pub struct ObjectId {
10041004
}
10051005

10061006
impl ObjectId {
1007-
const UNUSED: Self = ObjectId {
1007+
pub(crate) const UNUSED: Self = ObjectId {
10081008
id: None,
10091009
#[cfg(feature = "expose-ids")]
10101010
global_id: None,

wgpu/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1616,9 +1616,9 @@ impl Instance {
16161616
#[cfg(any(not(target_arch = "wasm32"), feature = "webgl"))]
16171617
data: Box::new(surface),
16181618
#[cfg(all(target_arch = "wasm32", not(feature = "webgl")))]
1619-
id: ObjectId::from(surface),
1619+
id: ObjectId::UNUSED,
16201620
#[cfg(all(target_arch = "wasm32", not(feature = "webgl")))]
1621-
data: Box::new(()),
1621+
data: Box::new(surface.1),
16221622
config: Mutex::new(None),
16231623
})
16241624
}
@@ -1652,9 +1652,9 @@ impl Instance {
16521652
#[cfg(any(not(target_arch = "wasm32"), feature = "webgl"))]
16531653
data: Box::new(surface),
16541654
#[cfg(all(target_arch = "wasm32", not(feature = "webgl")))]
1655-
id: ObjectId::from(surface),
1655+
id: ObjectId::UNUSED,
16561656
#[cfg(all(target_arch = "wasm32", not(feature = "webgl")))]
1657-
data: Box::new(()),
1657+
data: Box::new(surface.1),
16581658
config: Mutex::new(None),
16591659
})
16601660
}

0 commit comments

Comments
 (0)