8000 Fix negative duration panic on macos by Enter-tainer · Pull Request #475 · linebender/vello · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix negative duration panic on macos #475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions examples/with_winit/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,24 @@ pub fn draw_gpu_profiling(
let text_size = (text_height * 0.9) as f32;
// Text is specified by the baseline, but the y positions all refer to the top of the text
cur_text_y = text_y + text_height;
let label = format!(
"{:.2?} - {:.30}",
Duration::from_secs_f64(this_time),
profile.label
);
let label = {
// Sometimes, the duration turns out to be negative
// We have not yet debugged this, but display the absolute value in that case
// see https://github.com/linebender/vello/pull/475 for more
if this_time < 0.0 {
format!(
"-{:.2?}(!!) - {:.30}",
Duration::from_secs_f64(this_time.abs()),
profile.label
)
} else {
format!(
"{:.2?} - {:.30}",
Duration::from_secs_f64(this_time),
profile.label
)
}
};
scene.fill(
Fill::NonZero,
offset,
Expand Down
0