@@ -246,10 +246,17 @@ pub struct Buffer {
246
246
data : Option < Arc < std:: sync:: Mutex < Vec < u8 > > > > ,
247
247
}
248
248
249
- // Safe: Wasm doesn't have threads
250
- #[ cfg( target_arch = "wasm32" ) ]
249
+ #[ cfg( all(
250
+ target_arch = "wasm32" ,
251
+ feature = "fragile-send-sync-non-atomic-wasm" ,
252
+ not( target_feature = "atomics" )
253
+ ) ) ]
251
254
unsafe impl Sync for Buffer { }
252
- #[ cfg( target_arch = "wasm32" ) ]
255
+ #[ cfg( all(
256
+ target_arch = "wasm32" ,
257
+ feature = "fragile-send-sync-non-atomic-wasm" ,
258
+ not( target_feature = "atomics" )
259
+ ) ) ]
253
260
unsafe impl Send for Buffer { }
254
261
255
262
#[ derive( Clone , Debug ) ]
@@ -268,11 +275,18 @@ pub enum TextureInner {
268
275
} ,
269
276
}
270
277
271
- // SAFE: Wasm doesn't have threads
272
- #[ cfg( target_arch = "wasm32" ) ]
273
- unsafe impl Send for TextureInner { }
274
- #[ cfg( target_arch = "wasm32" ) ]
278
+ #[ cfg( all(
279
+ target_arch = "wasm32" ,
280
+ feature = "fragile-send-sync-non-atomic-wasm" ,
281
+ not( target_feature = "atomics" )
282
+ ) ) ]
275
283
unsafe impl Sync for TextureInner { }
284
+ #[ cfg( all(
285
+ target_arch = "wasm32" ,
286
+ feature = "fragile-send-sync-non-atomic-wasm" ,
287
+ not( target_feature = "atomics" )
288
+ ) ) ]
289
+ unsafe impl Send for TextureInner { }
276
290
277
291
impl TextureInner {
278
292
fn as_native ( & self ) -> ( glow:: Texture , BindTarget ) {
@@ -462,10 +476,17 @@ struct UniformDesc {
462
476
utype : u32 ,
463
477
}
464
478
465
- // Safe: Wasm doesn't have threads
466
- #[ cfg( target_arch = "wasm32" ) ]
479
+ #[ cfg( all(
480
+ target_arch = "wasm32" ,
481
+ feature = "fragile-send-sync-non-atomic-wasm" ,
482
+ not( target_feature = "atomics" )
483
+ ) ) ]
467
484
unsafe impl Sync for UniformDesc { }
468
- #[ cfg( target_arch = "wasm32" ) ]
485
+ #[ cfg( all(
486
+ target_arch = "wasm32" ,
487
+ feature = "fragile-send-sync-non-atomic-wasm" ,
488
+ not( target_feature = "atomics" )
489
+ ) ) ]
469
490
unsafe impl Send for UniformDesc { }
470
491
471
492
/// For each texture in the pipeline layout, store the index of the only
@@ -530,21 +551,35 @@ pub struct RenderPipeline {
530
551
alpha_to_coverage_enabled : bool ,
531
552
}
532
553
533
- // SAFE: Wasm doesn't have threads
534
- #[ cfg( target_arch = "wasm32" ) ]
535
- unsafe impl Send for RenderPipeline { }
536
- #[ cfg( target_arch = "wasm32" ) ]
554
+ #[ cfg( all(
555
+ target_arch = "wasm32" ,
556
+ feature = "fragile-send-sync-non-atomic-wasm" ,
557
+ not( target_feature = "atomics" )
558
+ ) ) ]
537
559
unsafe impl Sync for RenderPipeline { }
560
+ #[ cfg( all(
561
+ target_arch = "wasm32" ,
562
+ feature = "fragile-send-sync-non-atomic-wasm" ,
563
+ not( target_feature = "atomics" )
564
+ ) ) ]
565
+ unsafe impl Send for RenderPipeline { }
538
566
539
567
pub struct ComputePipeline {
540
568
inner : Arc < PipelineInner > ,
541
569
}
542
570
543
- // SAFE: Wasm doesn't have threads
544
- #[ cfg( target_arch = "wasm32" ) ]
545
- unsafe impl Send for ComputePipeline { }
546
- #[ cfg( target_arch = "wasm32" ) ]
571
+ #[ cfg( all(
572
+ target_arch = "wasm32" ,
573
+ feature = "fragile-send-sync-non-atomic-wasm" ,
574
+ not( target_feature = "atomics" )
575
+ ) ) ]
547
576
unsafe impl Sync for ComputePipeline { }
577
+ #[ cfg( all(
578
+ target_arch = "wasm32" ,
579
+ feature = "fragile-send-sync-non-atomic-wasm" ,
580
+ not( target_feature = "atomics" )
581
+ ) ) ]
582
+ unsafe impl Send for ComputePipeline { }
548
583
549
584
#[ derive( Debug ) ]
550
585
pub struct QuerySet {
@@ -558,7 +593,21 @@ pub struct Fence {
558
593
pending : Vec < ( crate :: FenceValue , glow:: Fence ) > ,
559
594
}
560
595
596
+ #[ cfg( any(
597
+ not( target_arch = "wasm32" ) ,
598
+ all(
599
+ feature = "fragile-send-sync-non-atomic-wasm" ,
600
+ not( target_feature = "atomics" )
601
+ )
602
+ ) ) ]
561
603
unsafe impl Send for Fence { }
604
+ #[ cfg( any(
605
+ not( target_arch = "wasm32" ) ,
606
+ all(
607
+ feature = "fragile-send-sync-non-atomic-wasm" ,
608
+ not( target_feature = "atomics" )
609
+ )
610
+ ) ) ]
562
611
unsafe impl Sync for Fence { }
563
612
564
613
impl Fence {
0 commit comments