Set a ScreenTime for this present. If a ScreenTime has not yet been set, add it to Displayed and set Presented. Otherwise, if the set ScreenTime has no FrameType, overwrite both ScreenTime and FrameType. Otherwise, if the set ScreenTime is zero, overwrite ScreenTime. Otherwise, if the call has a FrameType, add it to the list.
| 65 | // |
| 66 | // Otherwise, if the call has a FrameType, add it to the list. |
| 67 | static inline void SetScreenTime(std::shared_ptr<PresentEvent> const& p, uint64_t screenTime, FrameType frameType = FrameType::NotSet) |
| 68 | { |
| 69 | DebugAssert(screenTime != 0); |
| 70 | |
| 71 | auto displayedCount = p->Displayed.size(); |
| 72 | if (displayedCount == 0) { |
| 73 | p->Displayed.emplace_back(frameType, screenTime); |
| 74 | p->FinalState = PresentResult::Presented; |
| 75 | } else if (p->Displayed.back().first == FrameType::NotSet) { |
| 76 | p->Displayed.back().first = frameType; |
| 77 | p->Displayed.back().second = screenTime; |
| 78 | } else if (p->Displayed.back().second == 0) { |
| 79 | DebugAssert(frameType == FrameType::NotSet); |
| 80 | for (size_t i = 0; i < displayedCount; ++i) { |
| 81 | if (p->Displayed[i].second == 0) { |
| 82 | p->Displayed.back().second = screenTime; |
| 83 | p->FinalState = PresentResult::Presented; |
| 84 | break; |
| 85 | } |
| 86 | } |
| 87 | } else if (frameType != FrameType::NotSet) { |
| 88 | p->Displayed.emplace_back(frameType, screenTime); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | namespace { |
| 93 | struct WaitOnAddressShim { |
no test coverage detected