driver: optimize the step_multiple
step count calculation
this was using a stupid amount of compute. we still have about 7% time unaccounted for. down from 12-15%.
This commit is contained in:
@@ -535,6 +535,14 @@ impl<S> MultiRendererElement<S> {
|
||||
Some(end) => frame < end,
|
||||
}
|
||||
}
|
||||
fn next_frame_for_work(&self, after: u64) -> Option<u64> {
|
||||
let max_frame = after + self.step_frequency;
|
||||
let max_frame = max_frame - max_frame % self.step_frequency;
|
||||
match self.step_limit {
|
||||
None => Some(max_frame),
|
||||
Some(end) => Some(max_frame).filter(|&f| f < end)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MultiRenderer<S> {
|
||||
@@ -567,6 +575,9 @@ impl<S> MultiRenderer<S> {
|
||||
pub fn any_work_for_frame(&self, frame: u64) -> bool {
|
||||
self.renderers.read().unwrap().iter().any(|m| m.work_this_frame(frame))
|
||||
}
|
||||
pub fn next_frame_for_work(&self, after: u64) -> Option<u64> {
|
||||
self.renderers.read().unwrap().iter().flat_map(|m| m.next_frame_for_work(after)).min()
|
||||
}
|
||||
}
|
||||
|
||||
impl<S: AbstractSim> Renderer<S> for MultiRenderer<S> {
|
||||
|
Reference in New Issue
Block a user