`egui-wgpu`: Ensure that `WgpuConfiguration` is `Send + Sync` (#4803)

As far as I can tell, there's no reason that this shouldn't be the case
This commit is contained in:
Joe Sorensen 2024-07-08 15:25:29 -06:00 committed by GitHub
parent f9476e0a00
commit aa96b25746
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 2 deletions

View File

@ -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,
@ -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 {