From 39a4fa1a34932d9f4e07196565044ed1be536ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ty=C3=A1s=20Mustoha?= Date: Tue, 11 Oct 2016 12:51:29 +0200 Subject: [PATCH] Fix Android and ARM compilation options --- webrender/src/device.rs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/webrender/src/device.rs b/webrender/src/device.rs index d1e674d374..3dbd4e3ee5 100644 --- a/webrender/src/device.rs +++ b/webrender/src/device.rs @@ -524,6 +524,7 @@ pub struct GpuFrameProfile { } impl GpuFrameProfile { + #[cfg(not(target_os = "android"))] fn new() -> GpuFrameProfile { let queries = gl::gen_queries(MAX_EVENTS_PER_FRAME as gl::GLint); @@ -535,24 +536,34 @@ impl GpuFrameProfile { } } + #[cfg(target_os = "android")] + fn new() -> GpuFrameProfile { + GpuFrameProfile { + queries: Vec::new(), + samples: Vec::new(), + next_query: 0, + pending_query: 0, + } + } + fn begin_frame(&mut self) { self.next_query = 0; self.pending_query = 0; self.samples.clear(); } - #[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] + #[cfg(not(target_os = "android"))] fn end_frame(&mut self) { if self.pending_query != 0 { gl::end_query(gl::TIME_ELAPSED); } } - #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + #[cfg(target_os = "android")] fn end_frame(&mut self) { } - #[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] + #[cfg(not(target_os = "android"))] fn add_marker(&mut self, tag: T) { if self.pending_query != 0 { gl::end_query(gl::TIME_ELAPSED); @@ -572,7 +583,7 @@ impl GpuFrameProfile { self.next_query += 1; } - #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + #[cfg(target_os = "android")] fn add_marker(&mut self, tag: T) { self.samples.push(GpuSample { tag: tag, @@ -584,7 +595,7 @@ impl GpuFrameProfile { self.next_query <= MAX_EVENTS_PER_FRAME } - #[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))] + #[cfg(not(target_os = "android"))] fn build_samples(&mut self) -> Vec> { for (index, sample) in self.samples.iter_mut().enumerate() { sample.time_ns = gl::get_query_object_ui64v(self.queries[index], gl::QUERY_RESULT) @@ -593,16 +604,21 @@ impl GpuFrameProfile { mem::replace(&mut self.samples, Vec::new()) } - #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] + #[cfg(target_os = "android")] fn build_samples(&mut self) -> Vec> { mem::replace(&mut self.samples, Vec::new()) } } impl Drop for GpuFrameProfile { + #[cfg(not(target_os = "android"))] fn drop(&mut self) { gl::delete_queries(&self.queries); } + + #[cfg(target_os = "android")] + fn drop(&mut self) { + } } pub struct GpuProfiler {