HydraHook
Direct3D and Core Audio hooking library for Windows
Loading...
Searching...
No Matches
Present-path performance

Use a fixed scene, resolution, and presentation mode when comparing a sample loaded at runtime with its hooks disabled. Record a second loaded run to bound drift. Keep startup, ejection, and shader-loading frames outside the capture windows. Compare p50, p95, p99, and long-frame counts. An overlay draw count cannot measure capture or hook overhead.

Gothic idle baseline

PresentMon 2.6.0 recorded three 35-second windows in the same Gothic 1 Remake process and swap chain on a Windows VM. The game was paused at 1920×1080 in Hardware Independent Flip. The released 6.0.0 Locksmith build drew no overlay during the loaded windows. The middle window followed confirmed hook shutdown. Windows retained the original DLL mapping, so the second loaded window used a byte-identical copy at a distinct path. Each row excludes its first 60 and last 30 reported Presents.

Condition Presents Mean frame interval (ms) p95 (ms) p99 (ms) Frames over 20 ms p95 GPU busy (ms)
Locksmith loaded 1,960 17.05 20.45 23.71 124 15.51
Hooks disabled 2,007 16.65 19.82 23.84 93 15.09
Locksmith loaded again 1,980 16.86 19.98 22.93 99 15.45

Both loaded windows had a higher mean frame interval and p95 GPU busy time. The p99 moved in both directions. This single scene measures the combined cost of the sample and core hooks. It does not isolate readback cost, establish an overhead bound for other scenes, or measure the other samples.

Regional readback in Gothic

The same paused scene, swap chain, capture cadence, and 35-second windows were used for two alternating runs of the released and regional versions. Gothic reported a 500×610 readback on its verified presentation queue in both regional runs. Neither version drew the overlay during the measured windows.

Condition Presents Mean frame interval (ms) p95 (ms) p99 (ms) Frames over 20 ms p95 GPU busy (ms)
Released full frame 1,985 16.86 19.84 23.43 87 15.51
Regional readback 1,980 16.92 21.01 25.20 155 15.14
Released full frame 1,972 16.95 20.69 24.46 145 15.56
Regional readback 1,993 16.77 20.53 24.53 134 15.14

The regional version reduced p95 GPU busy time by 0.37–0.42 ms relative to the preceding released runs. Mean frame intervals and long-frame counts moved in opposite directions across the pairs. The measurements do not establish a frame-pacing improvement.

Sample and core audit

Path Work to reduce Follow-up
Locksmith The released build copies and converts the full frame up to five times per second, including while the hint is hidden The regional readback cuts pixel payload by 85.3%. Adaptive capture reduces idle requests from five per second to one every two seconds. Recognized locks retain the 200 ms interval
OpenCV F12 hides the HUD after the capture path has run. D3D11 also recreates an RTV and can map and convert staging pixels in Present Give users a separate perception pause or capture-rate control. In D3D11, keep reusable views where the swap-chain lifecycle permits and skip busy staging slots without flushing or waiting in the callback
ImGui and FPS The shared D3D12 host checks the verified queue before the visibility check. For visible overlays it waits on one allocator, with an infinite default wait Share the bounded per-frame allocator ring used by OpenCV and Locksmith. Keep verification for each frame that actually submits work
DirectXTK D3D11 recreates an RTV and queries the performance-counter frequency every frame Cache the frequency and evaluate caching the RTV with explicit invalidation before resize or device replacement
HydraHook core Present still pays a Detours trampoline. D3D12 queue observation now skips a repeated GetDesc/GetDevice once the last direct queue is known, DXGI CodeView is cached per worker run, and Present/Present1 probe the detected GameVersion first Measure detours separately with a pass-through host. Device-wide fallback observation remains on for hosts that have no exact swap-chain association
Diagnostics Overlay draw counters increment atomically in Present. Workers call MaybeLog() Keep the same logging policy on both sides of a comparison. File logging is async on the worker (overrun_oldest); crash dumps flush a synchronous logger
D3D12 readback TryReadLatest copies off the session mutex into a recycled CPU buffer. TrySubmit reclaims older completed slots and keeps the newest unread frame. Destroy waits on a fence event Pair with regional capture when the consumer only needs a fixed rectangle
Shared helpers WindowProcHook decrements in-flight without a second map lookup. D3D12OverlayFrames::Wait uses SetEventOnCompletion. RgbReadback hoists format loops and uses a 65,536-entry fp16 LUT Keep Present-thread helpers allocation-free and out of sample mutexes

Regional capture is intended for consumers with fixed sampling coordinates. For a consumer that needs the entire image, lower its sampling cadence or the resolution before readback. Preserve the current back buffer’s queue association, and retire readbacks before a resize or shutdown. D3D12 readback API