@@ -524,6 +524,7 @@ pub struct GpuFrameProfile<T> {
524
524
}
525
525
526
526
impl < T > GpuFrameProfile < T > {
527
+ #[ cfg( not( target_os = "android" ) ) ]
527
528
fn new ( ) -> GpuFrameProfile < T > {
528
529
let queries = gl:: gen_queries ( MAX_EVENTS_PER_FRAME as gl:: GLint ) ;
529
530
@@ -535,24 +536,34 @@ impl<T> GpuFrameProfile<T> {
535
536
}
536
537
}
537
538
539
+ #[ cfg( target_os = "android" ) ]
540
+ fn new ( ) -> GpuFrameProfile < T > {
541
+ GpuFrameProfile {
542
+ queries : Vec :: new ( ) ,
543
+ samples : Vec :: new ( ) ,
544
+ next_query : 0 ,
545
+ pending_query : 0 ,
546
+ }
547
+ }
548
+
538
549
fn begin_frame ( & mut self ) {
539
550
self . next_query = 0 ;
540
551
self . pending_query = 0 ;
541
552
self . samples . clear ( ) ;
542
553
}
543
554
544
- #[ cfg( not( any ( target_arch = "arm" , target_arch = "aarch64" ) ) ) ]
555
+ #[ cfg( not( target_os = "android" ) ) ]
545
556
fn end_frame ( & mut self ) {
546
557
if self . pending_query != 0 {
547
558
gl:: end_query ( gl:: TIME_ELAPSED ) ;
548
559
}
549
560
}
550
561
551
- #[ cfg( any ( target_arch = "arm" , target_arch = "aarch64" ) ) ]
562
+ #[ cfg( target_os = "android" ) ]
552
563
fn end_frame ( & mut self ) {
553
564
}
554
565
555
- #[ cfg( not( any ( target_arch = "arm" , target_arch = "aarch64" ) ) ) ]
566
+ #[ cfg( not( target_os = "android" ) ) ]
556
567
fn add_marker ( & mut self , tag : T ) {
557
568
if self . pending_query != 0 {
558
569
gl:: end_query ( gl:: TIME_ELAPSED ) ;
@@ -572,7 +583,7 @@ impl<T> GpuFrameProfile<T> {
572
583
self . next_query += 1 ;
573
584
}
574
585
575
- #[ cfg( any ( target_arch = "arm" , target_arch = "aarch64" ) ) ]
586
+ #[ cfg( target_os = "android" ) ]
576
587
fn add_marker ( & mut self , tag : T ) {
577
588
self . samples . push ( GpuSample {
578
589
tag : tag,
@@ -584,7 +595,7 @@ impl<T> GpuFrameProfile<T> {
584
595
self . next_query <= MAX_EVENTS_PER_FRAME
585
596
}
586
597
587
- #[ cfg( not( any ( target_arch = "arm" , target_arch = "aarch64" ) ) ) ]
598
+ #[ cfg( not( target_os = "android" ) ) ]
588
599
fn build_samples ( & mut self ) -> Vec < GpuSample < T > > {
589
600
for ( index, sample) in self . samples . iter_mut ( ) . enumerate ( ) {
590
601
sample. time_ns = gl:: get_query_object_ui64v ( self . queries [ index] , gl:: QUERY_RESULT )
@@ -593,16 +604,21 @@ impl<T> GpuFrameProfile<T> {
593
604
mem:: replace ( & mut self . samples , Vec :: new ( ) )
594
605
}
595
606
596
- #[ cfg( any ( target_arch = "arm" , target_arch = "aarch64" ) ) ]
607
+ #[ cfg( target_os = "android" ) ]
597
608
fn build_samples ( & mut self ) -> Vec < GpuSample < T > > {
598
609
mem:: replace ( & mut self . samples , Vec :: new ( ) )
599
610
}
600
611
}
601
612
602
613
impl < T > Drop for GpuFrameProfile < T > {
614
+ #[ cfg( not( target_os = "android" ) ) ]
603
615
fn drop ( & mut self ) {
604
616
gl:: delete_queries ( & self . queries ) ;
605
617
}
618
+
619
+ #[ cfg( target_os = "android" ) ]
620
+ fn drop ( & mut self ) {
621
+ }
606
622
}
607
623
608
624
pub struct GpuProfiler < T > {
0 commit comments