Skip to content

riyasy/winui_fps_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

WinUI FPS Test

Overview

This project is a minimal reproduction for a bug where a WinUI 3 + Win2d application's framerate varies based on the operating system and graphics hardware configuration.

Experimental Findings

Tested three different animation loop architectures on the exact same hardware (Intel Integrated Graphics) dual-booting Windows 10 and Windows 11.

1. CompositionTarget.Rendering + Win2D CanvasControl

In this setup, I called CanvasControl.Invalidate() inside the CompositionTarget.Rendering event.

  • Windows 11 (60Hz Monitor):
    • CompositionTarget.Rendering fires at ~60 FPS. However, because Invalidate() simply queues a draw request while the compositor is already busy, the actual CanvasControl.Draw event is delayed, resulting in an output of ~30 FPS.
  • Windows 10 (60Hz Monitor):
    • Windows 10 aggressively throttles CompositionTarget.Rendering down to ~30 FPS (1/2 of 60Hz). Even if I call Invalidate() each time, CanvasControl.Draw fires at ~16 FPS (exactly 1/4th of 60Hz).

2. DispatcherQueueTimer (15ms) + CanvasControl

In this setup, I called CanvasControl.Invalidate() inside a DispatcherQueueTimer ticking every 15ms.

  • Windows 11:
    • Reaches 55 to 60 FPS, but suffers from heavy frame drops and micro-stutters.
  • Windows 10:
    • Reaches only ~30 FPS. Half of the CanvasControl.Invalidate() calls are swallowed.

3. CanvasAnimatedControl

In this setup, I used CanvasAnimatedControl, setting IsFixedTimeStep="False" to allow the control to sync natively with the monitor.

  • Windows 10 & Windows 11:
    • Update and Draw events run on a background thread and fire in perfect synchronization with the monitor's actual refresh rate.
    • Successfully maintains 60 FPS on a 60Hz monitor, and scales up and down to 75 or 50 FPS when the monitor refresh rate is changed with zero frame drops.

Conclusion

The discrepancies reported in various GitHub issues also have an additional layer of OS differences. When using Win2D, it is always better to use CanvasAnimatedControl when doing continuous animations.

References & Related Issues

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors