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

Method HandleDXGIEvent

PresentData/PresentMonTraceConsumer.cpp:330–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330void PMTraceConsumer::HandleDXGIEvent(EVENT_RECORD* pEventRecord)
331{
332 auto const& hdr = pEventRecord->EventHeader;
333 switch (hdr.EventDescriptor.Id) {
334 case Microsoft_Windows_DXGI::Present_Start::Id:
335 case Microsoft_Windows_DXGI::PresentMultiplaneOverlay_Start::Id:
336 if (IsProcessTrackedForFiltering(hdr.ProcessId)) {
337 EventDataDesc desc[] = {
338 { L"pIDXGISwapChain" },
339 { L"Flags" },
340 { L"SyncInterval" },
341 };
342 mMetadata.GetEventData(pEventRecord, desc, _countof(desc));
343 auto pSwapChain = desc[0].GetData<uint64_t>();
344 auto Flags = desc[1].GetData<uint32_t>();
345 auto SyncInterval = desc[2].GetData<int32_t>();
346
347 RuntimePresentStart(Runtime::DXGI, hdr, pSwapChain, Flags, SyncInterval);
348 }
349 break;
350 case Microsoft_Windows_DXGI::Present_Stop::Id:
351 case Microsoft_Windows_DXGI::PresentMultiplaneOverlay_Stop::Id:
352 if (IsProcessTrackedForFiltering(hdr.ProcessId)) {
353 RuntimePresentStop(Runtime::DXGI, hdr, mMetadata.GetEventData<uint32_t>(pEventRecord, L"Result"));
354 }
355 break;
356 case Microsoft_Windows_DXGI::SwapChain_Start::Id:
357 case Microsoft_Windows_DXGI::ResizeBuffers_Start::Id:
358 if (mTrackHybridPresent) {
359 if (IsProcessTrackedForFiltering(hdr.ProcessId)) {
360 EventDataDesc desc[] = {
361 { L"pIDXGISwapChain" },
362 { L"HybridPresentMode" },
363 };
364 // Check to see if the event has both the pIDXGISwapChain and HybridPresentMode
365 // fields. If not do not process.
366 uint32_t descCount = _countof(desc);
367 mMetadata.GetEventData(pEventRecord, desc, &descCount);
368 if (descCount == _countof(desc)) {
369 auto pSwapChain = desc[0].GetData<uint64_t>();
370 auto hybridPresentMode = desc[1].GetData<uint32_t>();
371 auto key = std::make_pair(hdr.ProcessId, pSwapChain);
372 mHybridPresentModeBySwapChainPid[key] = hybridPresentMode;
373 }
374 }
375 }
376 break;
377 default:
378 assert(!mFilteredEvents); // Assert that filtering is working if expected
379 break;
380 }
381}
382
383void PMTraceConsumer::HandleDxgkBlt(EVENT_HEADER const& hdr, uint64_t hwnd, bool redirectedPresent)
384{

Callers 1

EventRecordCallbackFunction · 0.80

Calls 1

GetEventDataMethod · 0.45

Tested by

no test coverage detected