@@ -63,21 +63,20 @@ pub enum WgpuError {
63
63
#[ derive( Clone ) ]
64
64
pub struct RenderState {
65
65
/// Wgpu adapter used for rendering.
66
- pub adapter : Arc < wgpu:: Adapter > ,
66
+ pub adapter : wgpu:: Adapter ,
67
67
68
68
/// All the available adapters.
69
69
///
70
70
/// This is not available on web.
71
71
/// On web, we always select WebGPU is available, then fall back to WebGL if not.
72
- // TODO(gfx-rs/wgpu#6665): Remove layer of `Arc` here once we update to wgpu 24
73
72
#[ cfg( not( target_arch = "wasm32" ) ) ]
74
- pub available_adapters : Arc < [ Arc < wgpu:: Adapter > ] > ,
73
+ pub available_adapters : Vec < wgpu:: Adapter > ,
75
74
76
75
/// Wgpu device used for rendering, created from the adapter.
77
- pub device : Arc < wgpu:: Device > ,
76
+ pub device : wgpu:: Device ,
78
77
79
78
/// Wgpu queue used for rendering, created from the adapter.
80
- pub queue : Arc < wgpu:: Queue > ,
79
+ pub queue : wgpu:: Queue ,
81
80
82
81
/// The target texture format used for presenting to the window.
83
82
pub target_format : wgpu:: TextureFormat ,
@@ -90,8 +89,8 @@ async fn request_adapter(
90
89
instance : & wgpu:: Instance ,
91
90
power_preference : wgpu:: PowerPreference ,
92
91
compatible_surface : Option < & wgpu:: Surface < ' _ > > ,
93
- _available_adapters : & [ Arc < wgpu:: Adapter > ] ,
94
- ) -> Result < Arc < wgpu:: Adapter > , WgpuError > {
92
+ _available_adapters : & [ wgpu:: Adapter ] ,
93
+ ) -> Result < wgpu:: Adapter , WgpuError > {
95
94
profiling:: function_scope!( ) ;
96
95
97
96
let adapter = instance
@@ -149,10 +148,7 @@ async fn request_adapter(
149
148
) ;
150
149
}
151
150
152
- // On wasm, depending on feature flags, wgpu objects may or may not implement sync.
153
- // It doesn't make sense to switch to Rc for that special usecase, so simply disable the lint.
154
- #[ allow( clippy:: arc_with_non_send_sync) ]
155
- Ok ( Arc :: new ( adapter) )
151
+ Ok ( adapter)
156
152
}
157
153
158
154
impl RenderState {
@@ -179,12 +175,7 @@ impl RenderState {
179
175
wgpu:: Backends :: all ( )
180
176
} ;
181
177
182
- instance
183
- . enumerate_adapters ( backends)
184
- // TODO(gfx-rs/wgpu#6665): Remove layer of `Arc` here once we update to wgpu 24.
185
- . into_iter ( )
186
- . map ( Arc :: new)
187
- . collect :: < Vec < _ > > ( )
178
+ instance. enumerate_adapters ( backends)
188
179
} ;
189
180
190
181
let ( adapter, device, queue) = match config. wgpu_setup . clone ( ) {
@@ -222,10 +213,7 @@ impl RenderState {
222
213
. await ?
223
214
} ;
224
215
225
- // On wasm, depending on feature flags, wgpu objects may or may not implement sync.
226
- // It doesn't make sense to switch to Rc for that special usecase, so simply disable the lint.
227
- #[ allow( clippy:: arc_with_non_send_sync) ]
228
- ( adapter, Arc :: new ( device) , Arc :: new ( queue) )
216
+ ( adapter, device, queue)
229
217
}
230
218
WgpuSetup :: Existing ( WgpuSetupExisting {
231
219
instance : _,
@@ -258,7 +246,7 @@ impl RenderState {
258
246
Ok ( Self {
259
247
adapter,
260
248
#[ cfg( not( target_arch = "wasm32" ) ) ]
261
- available_adapters : available_adapters . into ( ) ,
249
+ available_adapters,
262
250
device,
263
251
queue,
264
252
target_format,
@@ -268,7 +256,7 @@ impl RenderState {
268
256
}
269
257
270
258
#[ cfg( not( target_arch = "wasm32" ) ) ]
271
- fn describe_adapters ( adapters : & [ Arc < wgpu:: Adapter > ] ) -> String {
259
+ fn describe_adapters ( adapters : & [ wgpu:: Adapter ] ) -> String {
272
260
if adapters. is_empty ( ) {
273
261
"(none)" . to_owned ( )
274
262
} else if adapters. len ( ) == 1 {
0 commit comments