mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-12-03 02:05:18 +01:00
3dfcbca711
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.
33 lines
1.4 KiB
C#
33 lines
1.4 KiB
C#
using Avalonia;
|
|
|
|
namespace StarterNG.Infrastructure;
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// 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.
|
|
/// </summary>
|
|
public static class WindowSurfaces
|
|
{
|
|
public static Win32PlatformOptions Win32Options => new()
|
|
{
|
|
CompositionMode = new[]
|
|
{
|
|
Win32CompositionMode.DirectComposition,
|
|
Win32CompositionMode.RedirectionSurface
|
|
}
|
|
};
|
|
|
|
/// <summary>
|
|
/// The options a platform reads are the last given, so the processor, when asked
|
|
/// for, draws with <see cref="SoftwareRender"/>'s own and these are left out.
|
|
/// </summary>
|
|
public static AppBuilder ApplyTo(AppBuilder builder, bool softwareRender) =>
|
|
softwareRender ? SoftwareRender.ApplyTo(builder) : builder.With(Win32Options);
|
|
}
|