From 3dfcbca711401757cf3160d54f7551bf656d66c5 Mon Sep 17 00:00:00 2001 From: maj00r Date: Sat, 28 Nov 2026 19:38:44 +0100 Subject: [PATCH] fix: the Steam overlay no longer draws its frame counter over the starter Steam puts its overlay into the starter, the game it launches. In a window's own redirection surface ANGLE draws through a swap chain of that window, and the overlay hooks its Present and draws the frame counter and notifications over the starter. Every window now draws into a DirectComposition surface, which is drawn without a Present and still keeps away from the WinUI composition visual that came up black on 25H2. The redirection surface stays only as the fallback. --- StarterNG.Tests/WindowSurfacesTests.cs | 17 +++++++++++++++-- StarterNG/Infrastructure/WindowSurfaces.cs | 17 ++++++++++++----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/StarterNG.Tests/WindowSurfacesTests.cs b/StarterNG.Tests/WindowSurfacesTests.cs index df905d0..8a689c7 100644 --- a/StarterNG.Tests/WindowSurfacesTests.cs +++ b/StarterNG.Tests/WindowSurfacesTests.cs @@ -6,14 +6,27 @@ namespace StarterNG.Tests; public class WindowSurfacesTests { [Fact] - public void Windows_draws_into_the_window_surface_and_never_through_winui_composition() + public void Windows_draws_into_a_directcomposition_surface_and_never_through_winui_composition() { var options = WindowSurfaces.Win32Options; - Assert.Equal(new[] { Win32CompositionMode.RedirectionSurface }, options.CompositionMode); + Assert.Equal(Win32CompositionMode.DirectComposition, options.CompositionMode.First()); Assert.DoesNotContain(Win32CompositionMode.WinUIComposition, options.CompositionMode); } + [Fact] + public void The_window_surface_is_only_the_fallback() + { + // There ANGLE presents through a swap chain, and the Steam overlay draws over it. + Assert.Equal(Win32CompositionMode.RedirectionSurface, WindowSurfaces.Win32Options.CompositionMode.Last()); + } + + [Fact] + public void No_swap_chain_of_its_own_is_asked_for() + { + Assert.DoesNotContain(Win32CompositionMode.LowLatencyDxgiSwapChain, WindowSurfaces.Win32Options.CompositionMode); + } + [Fact] public void The_graphics_card_still_draws() { diff --git a/StarterNG/Infrastructure/WindowSurfaces.cs b/StarterNG/Infrastructure/WindowSurfaces.cs index 7bb668e..83c3c1b 100644 --- a/StarterNG/Infrastructure/WindowSurfaces.cs +++ b/StarterNG/Infrastructure/WindowSurfaces.cs @@ -3,17 +3,24 @@ using Avalonia; namespace StarterNG.Infrastructure; /// -/// On Windows the graphics card draws each window of the starter into a surface of that -/// window, not into Avalonia's default WinUI composition visual. On Windows 11 25H2 that +/// On Windows the graphics card draws each window of the starter into a DirectComposition +/// surface, not into Avalonia's default WinUI composition visual. On Windows 11 25H2 that /// visual was left empty on many starts: the main window, or a dialog opened later, -/// stayed black while the others drew, and came back only now and then. Composition is -/// there for see-through windows and backdrops, and the starter has none. +/// stayed black while the others drew, and came back only now and then. +/// The window's own redirection surface is only the fallback: there ANGLE draws through a +/// swap chain of the window, and the Steam overlay, which Steam puts into the starter as +/// the game it launches, hooks that swap chain's Present and draws its frame counter and +/// notifications over the starter. A composition surface is drawn without a Present. /// public static class WindowSurfaces { public static Win32PlatformOptions Win32Options => new() { - CompositionMode = new[] { Win32CompositionMode.RedirectionSurface } + CompositionMode = new[] + { + Win32CompositionMode.DirectComposition, + Win32CompositionMode.RedirectionSurface + } }; ///