@@ -5,6 +5,8 @@ use wgt::{AstcBlock, AstcChannel};
5
5
6
6
use std:: { sync:: Arc , thread} ;
7
7
8
+ use super :: TimestampQuerySupport ;
9
+
8
10
const MAX_COMMAND_BUFFERS : u64 = 2048 ;
9
11
10
12
unsafe impl Send for super :: Adapter { }
@@ -536,6 +538,26 @@ impl super::PrivateCapabilities {
536
538
MTLReadWriteTextureTier :: TierNone
537
539
} ;
538
540
541
+ let mut timestamp_query_support = TimestampQuerySupport :: empty ( ) ;
542
+ if version. at_least ( ( 11 , 0 ) , ( 14 , 0 ) , os_is_mac)
543
+ && device. supports_counter_sampling ( metal:: MTLCounterSamplingPoint :: AtStageBoundary )
544
+ {
545
+ // If we don't support at stage boundary, don't support anything else.
546
+ timestamp_query_support. insert ( TimestampQuerySupport :: STAGE_BOUNDARIES ) ;
547
+
548
+ if device. supports_counter_sampling ( metal:: MTLCounterSamplingPoint :: AtDrawBoundary ) {
549
+ timestamp_query_support. insert ( TimestampQuerySupport :: ON_RENDER_ENCODER ) ;
550
+ }
551
+ if device. supports_counter_sampling ( metal:: MTLCounterSamplingPoint :: AtDispatchBoundary )
552
+ {
553
+ timestamp_query_support. insert ( TimestampQuerySupport :: ON_COMPUTE_ENCODER ) ;
554
+ }
555
+ if device. supports_counter_sampling ( metal:: MTLCounterSamplingPoint :: AtBlitBoundary ) {
556
+ timestamp_query_support. insert ( TimestampQuerySupport :: ON_BLIT_ENCODER ) ;
557
+ }
558
+ // `TimestampQuerySupport::INSIDE_WGPU_PASSES` emerges from the other flags.
559
+ }
560
+
539
561
Self {
540
562
family_check,
541
563
msl_version : if os_is_xr || version. at_least ( ( 12 , 0 ) , ( 15 , 0 ) , os_is_mac) {
@@ -773,13 +795,7 @@ impl super::PrivateCapabilities {
773
795
} else {
774
796
None
775
797
} ,
776
- support_timestamp_query : version. at_least ( ( 11 , 0 ) , ( 14 , 0 ) , os_is_mac)
777
- && device
778
- . supports_counter_sampling ( metal:: MTLCounterSamplingPoint :: AtStageBoundary ) ,
779
- support_timestamp_query_in_passes : version. at_least ( ( 11 , 0 ) , ( 14 , 0 ) , os_is_mac)
780
- && device. supports_counter_sampling ( metal:: MTLCounterSamplingPoint :: AtDrawBoundary )
781
- && device
782
- . supports_counter_sampling ( metal:: MTLCounterSamplingPoint :: AtDispatchBoundary ) ,
798
+ timestamp_query_support,
783
799
}
784
800
}
785
801
@@ -807,12 +823,16 @@ impl super::PrivateCapabilities {
807
823
| F :: DEPTH32FLOAT_STENCIL8
808
824
| F :: MULTI_DRAW_INDIRECT ;
809
825
810
- features. set ( F :: TIMESTAMP_QUERY , self . support_timestamp_query ) ;
811
- // TODO: Not yet implemented.
812
- // features.set(
813
- // F::TIMESTAMP_QUERY_INSIDE_PASSES,
814
- // self.support_timestamp_query_in_passes,
815
- // );
826
+ features. set (
827
+ F :: TIMESTAMP_QUERY ,
828
+ self . timestamp_query_support
829
+ . contains ( TimestampQuerySupport :: STAGE_BOUNDARIES ) ,
830
+ ) ;
831
+ features. set (
832
+ F :: TIMESTAMP_QUERY_INSIDE_PASSES ,
833
+ self . timestamp_query_support
834
+ . contains ( TimestampQuerySupport :: INSIDE_WGPU_PASSES ) ,
835
+ ) ;
816
836
features. set ( F :: TEXTURE_COMPRESSION_ASTC , self . format_astc ) ;
817
837
features. set ( F :: TEXTURE_COMPRESSION_ASTC_HDR , self . format_astc_hdr ) ;
818
838
features. set ( F :: TEXTURE_COMPRESSION_BC , self . format_bc ) ;
0 commit comments