Skip to content

Commit

Permalink
egui-wgpu: Ensure that WgpuConfiguration is Send + Sync (#4803)
Browse files Browse the repository at this point in the history
As far as I can tell, there's no reason that this shouldn't be the case
  • Loading branch information
murl-digital authored Jul 8, 2024
1 parent f9476e0 commit aa96b25
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions crates/egui-wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ pub struct WgpuConfiguration {
pub supported_backends: wgpu::Backends,

/// Configuration passed on device request, given an adapter
pub device_descriptor: Arc<dyn Fn(&wgpu::Adapter) -> wgpu::DeviceDescriptor<'static>>,
pub device_descriptor:
Arc<dyn Fn(&wgpu::Adapter) -> wgpu::DeviceDescriptor<'static> + Send + Sync>,

/// Present mode used for the primary surface.
pub present_mode: wgpu::PresentMode,
Expand All @@ -248,7 +249,13 @@ pub struct WgpuConfiguration {
pub power_preference: wgpu::PowerPreference,

/// Callback for surface errors.
pub on_surface_error: Arc<dyn Fn(wgpu::SurfaceError) -> SurfaceErrorAction>,
pub on_surface_error: Arc<dyn Fn(wgpu::SurfaceError) -> SurfaceErrorAction + Send + Sync>,
}

#[test]
fn wgpu_config_impl_send_sync() {
fn assert_send_sync<T: Send + Sync>() {}
assert_send_sync::<WgpuConfiguration>();
}

impl std::fmt::Debug for WgpuConfiguration {
Expand Down

0 comments on commit aa96b25

Please sign in to comment.