Skip to content

Commit f01c54e

Browse files
author
bors-servo
committed
Auto merge of #232 - pcwalton:gonk-gpu-profiler, r=glennw
Try to make the GPU profiling code compile on Gonk. r? @glennw
2 parents 13f9ee8 + 0c673ac commit f01c54e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/device.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,13 +697,18 @@ pub struct VBOId(gl::GLuint);
697697
#[derive(PartialEq, Eq, Hash, Debug, Copy, Clone)]
698698
struct IBOId(gl::GLuint);
699699

700+
#[cfg(not(any(target_os = "android", target_os = "gonk")))]
700701
pub struct GpuProfile {
701702
active_query: usize,
702703
gl_queries: Vec<gl::GLuint>,
703704
first_frame: bool,
704705
}
705706

707+
#[cfg(any(target_os = "android", target_os = "gonk"))]
708+
pub struct GpuProfile;
709+
706710
impl GpuProfile {
711+
#[cfg(not(any(target_os = "android", target_os = "gonk")))]
707712
pub fn new() -> GpuProfile {
708713
let queries = gl::gen_queries(4);
709714

@@ -714,11 +719,21 @@ impl GpuProfile {
714719
}
715720
}
716721

722+
#[cfg(any(target_os = "android", target_os = "gonk"))]
723+
pub fn new() -> GpuProfile {
724+
GpuProfile
725+
}
726+
727+
#[cfg(not(any(target_os = "android", target_os = "gonk")))]
717728
pub fn begin(&mut self) {
718729
let qid = self.gl_queries[self.active_query];
719730
gl::begin_query(gl::TIME_ELAPSED, qid);
720731
}
721732

733+
#[cfg(any(target_os = "android", target_os = "gonk"))]
734+
pub fn begin(&mut self) {}
735+
736+
#[cfg(not(any(target_os = "android", target_os = "gonk")))]
722737
pub fn end(&mut self) -> u64 {
723738
gl::end_query(gl::TIME_ELAPSED);
724739

@@ -745,6 +760,9 @@ impl GpuProfile {
745760
0
746761
}
747762
}
763+
764+
#[cfg(any(target_os = "android", target_os = "gonk"))]
765+
pub fn end(&mut self) -> u64 { 0 }
748766
}
749767

750768
impl Drop for GpuProfile {

0 commit comments

Comments
 (0)