public override void SwapBuffers() { if (_platform.DisplayMode != DisplayMode.Fullscreen) { bool dwmComposition; // DWM Composition is always enabled on Win8+ if (Win32Platform.IsWindows8OrGreater) { dwmComposition = true; } else { HResult result = DwmApi.DwmIsCompositionEnabled(out dwmComposition); if (result != HResult.S_OK) { dwmComposition = false; } } if (dwmComposition) { for (var i = 0; i < SwapInterval; i++) { DwmApi.DwmFlush(); } } } Gdi32.SwapBuffers(_dc); }
/// <inheritdoc /> protected override void SetSwapIntervalPlatform(int interval) { if (_platform.DisplayMode != DisplayMode.Fullscreen) { bool dwmComposition; // DWM Composition is always enabled on Win8+ if (Win32Platform.IsWindows8OrGreater) { dwmComposition = true; } else { HResult result = DwmApi.DwmIsCompositionEnabled(out dwmComposition); if (result != HResult.S_OK) { dwmComposition = false; } } // Hack: Disable WGL swap interval when desktop composition is enabled to avoid interfering with DWM vsync. if (dwmComposition) { interval = 0; } } _swapIntervalExt?.Invoke(interval != 0 && _autoVSyncExtension ? -1 : interval); }