Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions wgpu-core-remote-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ targets = [
]

[dependencies]
wgpu-types = { workspace = true, features = ["serde"] }
serde = { workspace = true }
hashbrown = { workspace = true }
serde = { workspace = true }
wgpu-types = { workspace = true, features = ["serde"] }
7 changes: 4 additions & 3 deletions wgpu-core-remote/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ targets = [
serde = ["dep:serde", "wgpu-types/serde", "wgpu-core/serde"]

[dependencies]
raw-window-handle.workspace = true
serde = { workspace = true, optional = true }
static_assertions = { workspace = true }
wgpu-core = { workspace = true, default-features = false }
wgpu-core-remote-types.workspace = true
wgpu-hal = { workspace = true, default-features = false }
wgpu-types.workspace = true
wgpu-core-remote-types.workspace = true
raw-window-handle.workspace = true
serde = { workspace = true, optional = true }
8 changes: 8 additions & 0 deletions wgpu-core-remote/src/global/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::sync::Arc;
use core::cell::RefCell;
use core::fmt;
use core::marker::PhantomData;
use wgpu_core::binding_model::{BindGroup, BindGroupLayout, PipelineLayout};
use wgpu_core::command::{
CommandBuffer, CommandEncoder, ComputePass, RenderBundle, RenderBundleEncoder, RenderPass,
Expand Down Expand Up @@ -40,6 +41,7 @@ pub struct Global {
pub(crate) hub: RefCell<Hub>,
// the instance must be dropped last
pub instance: Arc<Instance>,
_prevent_send_and_sync: PhantomData<*const ()>,
}

impl Global {
Expand All @@ -51,13 +53,15 @@ impl Global {
Self {
instance: Instance::new(name, instance_desc, telemetry),
hub: RefCell::new(Hub::new()),
_prevent_send_and_sync: PhantomData,
}
}

pub fn from_instance(instance: Arc<Instance>) -> Self {
Self {
instance,
hub: RefCell::new(Hub::new()),
_prevent_send_and_sync: PhantomData,
}
}

Expand Down Expand Up @@ -388,3 +392,7 @@ impl fmt::Debug for Global {
f.debug_struct("Global").finish()
}
}

// Force the Rust compiler to compute `Send + Sync` for `Global`, which can avoid `recursion_limit`
// issues in the resolver.
static_assertions::assert_not_impl_any!(Global: Send, Sync);
2 changes: 0 additions & 2 deletions wgpu-core/src/lib.rs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are these changes intended to be here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, because we should no longer need them. I suppose I should break this out into a separate commit, explaining why it's relevant. Will do that shortly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah, actually, maybe these hunks should move to #10177? If that lands first, then I'll keep things here. If not, maybe it'd make sense to roll them into #10177 instead (CC @kpreid).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

After a force-push, these hunks have been broken out to ee6b929 (CC @nazar-pc, who is credited with Co-Authored-By).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah, actually, maybe these hunks should move to #10177?

That would make more sense to me rather than having them here as this PR does nothing wgc/wgpu otherwise.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
//!

#![no_std]
// `-Znext-solver` requires deeper recursion limits (at least for now) to prove Send/Sync
#![recursion_limit = "256"]
// When we have no backends, we end up with a lot of dead or otherwise unreachable code.
#![cfg_attr(
all(
Expand Down
2 changes: 0 additions & 2 deletions wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
#![doc = crate::macros::doc_image!("render_coordinates.webp")]
#![doc = crate::macros::doc_image!("texture_coordinates.webp")]
#![no_std]
// `-Znext-solver` requires deeper recursion limits (at least for now) to prove Send/Sync
#![recursion_limit = "256"]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![doc(html_logo_url = "https://raw.githubusercontent.com/gfx-rs/wgpu/trunk/logo.png")]
#![warn(
Expand Down
Loading