MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / RunOverlayLoop_

Method RunOverlayLoop_

IntelPresentMon/Core/source/kernel/Kernel.cpp:259–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257 }
258
259 void Kernel::RunOverlayLoop_()
260 {
261 // this loop runs while the overlay window is active
262 while (pOverlayContainer) {
263 // checking thread sync signals
264 {
265 std::lock_guard lk{ mtx };
266 if (dying || clearRequested) {
267 pPushedSpec.reset();
268 clearRequested = false;
269 inhibitTargetLostSignal = true;
270 if (!headless) {
271 pOverlayContainer->InitiateClose();
272 }
273 else {
274 pOverlayContainer.reset();
275 return;
276 }
277 }
278 else if (pPushedSpec) {
279 auto& curSpec = pOverlayContainer->GetSpec();
280 if (pPushedSpec->pid != curSpec.pid) {
281 pOverlayContainer->InitiateClose();
282 }
283 else if (pPushedSpec->independentKernelWindow != curSpec.independentKernelWindow ||
284 pPushedSpec->upscale != curSpec.upscale ||
285 (pPushedSpec->upscale && pPushedSpec->upscaleFactor != curSpec.upscaleFactor)) {
286 ConfigurePresentMon_(*pPushedSpec);
287 inhibitTargetLostSignal = true;
288 pOverlayContainer->RebootOverlay(std::move(pPushedSpec));
289 }
290 else {
291 ConfigurePresentMon_(*pPushedSpec);
292 pOverlayContainer->RebuildDocument(std::move(pPushedSpec));
293 }
294 }
295 else if (pushedCaptureActive) {
296 pOverlayContainer->SetCaptureState(*pushedCaptureActive);
297 pushedCaptureActive.reset();
298 }
299 }
300 pOverlayContainer->CheckAndProcessFullscreenTransition();
301 // process windows messages
302 {
303 MSG msg;
304 while (PeekMessageW(&msg, nullptr, 0, 0, PM_REMOVE)) {
305 if (msg.message == WM_QUIT) {
306 if (!dying && !inhibitTargetLostSignal) {
307 pHandler->OnTargetLost(pOverlayContainer->GetProcess().pid);
308 }
309 inhibitTargetLostSignal = false;
310 pOverlayContainer.reset();
311 break;
312 }
313 TranslateMessage(&msg);
314 DispatchMessageW(&msg);
315 }
316 }

Callers

nothing calls this directly

Calls 7

RebootOverlayMethod · 0.80
InitiateCloseMethod · 0.45
RebuildDocumentMethod · 0.45
SetCaptureStateMethod · 0.45
OnTargetLostMethod · 0.45
RunTickMethod · 0.45

Tested by

no test coverage detected