metal: delay rendering until shortly before page flip
This commit is contained in:
parent
33d5c61c37
commit
c2d31cb639
9 changed files with 113 additions and 22 deletions
11
src/time.rs
11
src/time.rs
|
|
@ -62,7 +62,12 @@ impl Time {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn nsec(self) -> u64 {
|
||||
let sec = self.0.tv_sec as u64 * 1_000_000_000;
|
||||
let nsec = self.0.tv_nsec as u64;
|
||||
sec + nsec
|
||||
}
|
||||
|
||||
pub fn usec(self) -> u64 {
|
||||
let sec = self.0.tv_sec as u64 * 1_000_000;
|
||||
let nsec = self.0.tv_nsec as u64 / 1_000;
|
||||
|
|
@ -119,6 +124,10 @@ impl Add<Duration> for Time {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn now_nsec() -> u64 {
|
||||
Time::now_unchecked().nsec()
|
||||
}
|
||||
|
||||
pub fn now_usec() -> u64 {
|
||||
Time::now_unchecked().usec()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue