Consume and interpret a GPU pick result (if available).
(
&mut self,
instance_id: u64,
valid_point_id: impl Fn(&PointId) -> bool,
)
| 134 | |
| 135 | /// Consume and interpret a GPU pick result (if available). |
| 136 | pub(crate) fn consume_gpu_result( |
| 137 | &mut self, |
| 138 | instance_id: u64, |
| 139 | valid_point_id: impl Fn(&PointId) -> bool, |
| 140 | ) -> Option<GpuResultEvent> { |
| 141 | let res = take_result(instance_id)?; |
| 142 | if res.seq <= self.pick_result_seq { |
| 143 | return None; |
| 144 | } |
| 145 | |
| 146 | let mut out = None; |
| 147 | |
| 148 | if self.pending_gpu_pick_seq == Some(res.seq) { |
| 149 | self.pending_gpu_pick_seq = None; |
| 150 | if let Some(point) = res.hit |
| 151 | && valid_point_id(&point) |
| 152 | { |
| 153 | out = Some(GpuResultEvent::Pick(point)); |
| 154 | } |
| 155 | } else if let Some(point) = res.hit |
| 156 | && valid_point_id(&point) |
| 157 | { |
| 158 | self.last_hover_cache = Some(point); |
| 159 | out = Some(GpuResultEvent::Hover(point)); |
| 160 | } else { |
| 161 | out = Some(GpuResultEvent::HoverMiss); |
| 162 | } |
| 163 | |
| 164 | self.pick_result_seq = res.seq; |
| 165 | out |
| 166 | } |
| 167 | |
| 168 | pub(crate) fn has_outstanding_gpu_request(&self) -> bool { |
| 169 | self.pick_seq > self.pick_result_seq |
no test coverage detected