Repository navigation
Conversation
Member
|
Thanks for opening this, and welcome. We've seen it and one of our engineers will take a look soon. We appreciate you taking the time to contribute, and we'll follow up here once someone has had a chance to review. Thanks for your patience in the meantime. |
SwapChain.OcclusionThrottleProbe presents the primary swapchain to the visible test window in a loop and logs loop-fps vs actual render-fps per window state. It detects occlusion from window geometry (IsWindowOccluded: sample 5 points on the window, skipping see-through overlays like the Alt+Tab switcher; minimized counts as hidden) and, while occluded, emulates the WINDOW_HIDDEN throttle (20ms sleep + render 1-in-50) to show rendering collapse to ~1 fps and recover when visible. Manual/interactive (needs a real GPU + visible window), run with: --interactive --gtest_filter=SwapChain.OcclusionThrottleProbe then cover / minimize / restore the window and read occlusion_throttle_test.log. Used to establish that DXGI_STATUS_OCCLUDED is unavailable for flip-model swapchains (both Present and Present(0, DXGI_PRESENT_TEST) stay S_OK while covered) and that Win32 window-geometry occlusion is a reliable substitute.
Match the revised Tr2MainWindow detection exactly: 8 quasirandom sample points per 250ms tick from the R2 (plastic ratio) sequence, hidden only after 32 consecutive covered samples, one EnumWindows pass per tick collecting the opaque occluder rects above us in Z-order, DWM-cloaked windows skipped, off-monitor points counted as covered. Log state transitions with time-in-state and the covered-sample counter, and add a samples= column to the periodic fps lines, so engage latency (~1s covered) and next-tick release are visible in the log.
- Open the log with _fsopen(_SH_DENYWR) instead of fopen_s, which denies all sharing; the log can now be read and tailed during a run. - The window class uses DefWindowProc, so the close button destroys the HWND without posting WM_QUIT and the loop previously spun on forever (a destroyed window samples as "visible" and unthrottled, at ~30000 fps). Detect the destroyed window, log it, and post WM_QUIT so DoLoopProcessing ends the RunLoop.
Schogol
force-pushed
the
test/occlusion-throttle-probe
branch
from
October 11, 2026 01:50
48fd742 to
64e3bab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SwapChain.OcclusionThrottleProbe presents the primary swapchain to the visible test window in a loop and logs loop-fps vs actual render-fps per window state. It detects occlusion from window geometry (IsWindowOccluded: sample 5 points on the window, skipping see-through overlays like the Alt+Tab switcher; minimized counts as hidden) and, while occluded, emulates the WINDOW_HIDDEN throttle (20ms sleep + render 1-in-50) to show rendering collapse to ~1 fps and recover when visible.
Manual/interactive (needs a real GPU + visible window), run with:
--interactive --gtest_filter=SwapChain.OcclusionThrottleProbe
then cover / minimize / restore the window and read occlusion_throttle_test.log.
Used to establish that DXGI_STATUS_OCCLUDED is unavailable for flip-model swapchains (both Present and Present(0, DXGI_PRESENT_TEST) stay S_OK while covered) and that Win32 window-geometry occlusion is a reliable substitute.
Disclaimer:
Claude helped with creating the test and fix.