mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-12-03 02:05:18 +01:00
dc1f43d385
Every way of the graphics card's failed on some machine. Avalonia's WinUI composition visual left windows black on Windows 11 25H2, the Steam overlay drew its frame counter over the swap chain of a window's own surface, and with DirectComposition the starter vanished a few seconds after its window came up on a Windows 10 machine with a GTX 1650, without a word in its log, under Steam or started on its own. With --software-render it stayed. The processor now draws every window on Windows, and each frame is copied into its window by GDI: no composition visual, no swap chain for an overlay to hook. On X11 the graphics card still draws, and --software-render still asks the processor there.
50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using Avalonia;
|
|
using StarterNG.Infrastructure;
|
|
|
|
namespace StarterNG.Tests;
|
|
|
|
public class SoftwareRenderTests
|
|
{
|
|
[Theory]
|
|
[InlineData("--software-render")]
|
|
[InlineData("--Software-Render")]
|
|
public void The_switch_asks_for_it_in_any_case(string arg)
|
|
{
|
|
Assert.True(SoftwareRender.AskedIn(new[] { "--other", arg }));
|
|
}
|
|
|
|
[Fact]
|
|
public void Without_the_switch_it_is_not_asked_for()
|
|
{
|
|
Assert.False(SoftwareRender.AskedIn(Array.Empty<string>()));
|
|
Assert.False(SoftwareRender.AskedIn(new[] { "--software" }));
|
|
}
|
|
|
|
[Fact]
|
|
public void Windows_draws_on_the_processor_into_a_plain_window_surface()
|
|
{
|
|
var options = SoftwareRender.Win32Options;
|
|
|
|
// No WinUI composition, DirectComposition or swap chain of the graphics card's.
|
|
Assert.Equal(new[] { Win32RenderingMode.Software }, options.RenderingMode);
|
|
Assert.Equal(new[] { Win32CompositionMode.RedirectionSurface }, options.CompositionMode);
|
|
}
|
|
|
|
[Fact]
|
|
public void X11_draws_on_the_processor_when_asked()
|
|
{
|
|
Assert.Equal(new[] { X11RenderingMode.Software }, SoftwareRender.X11Options.RenderingMode);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(false)]
|
|
[InlineData(true)]
|
|
public void The_options_go_to_the_same_builder_with_or_without_the_switch(bool asked)
|
|
{
|
|
var builder = AppBuilder.Configure<Avalonia.Application>();
|
|
string[] args = asked ? new[] { SoftwareRender.Switch } : Array.Empty<string>();
|
|
|
|
Assert.Same(builder, SoftwareRender.ApplyTo(builder, args));
|
|
}
|
|
}
|