-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5682 from peppy/renderer-config-fallback
Allow renderer choice to be stored in user configuration (and add automatic fallbacks)
- Loading branch information
Showing
9 changed files
with
309 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Configuration; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Sprites; | ||
using osu.Framework.Graphics.UserInterface; | ||
using osu.Framework.Platform; | ||
|
||
namespace osu.Framework.Tests.Visual.Platform | ||
{ | ||
[Ignore("This test cannot be run in headless mode (a renderer is required).")] | ||
public partial class TestSceneRenderer : FrameworkTestScene | ||
{ | ||
[Resolved] | ||
private GameHost host { get; set; } = null!; | ||
|
||
[Resolved] | ||
private FrameworkConfigManager config { get; set; } = null!; | ||
|
||
[SetUp] | ||
public void SetUp() => Schedule(() => | ||
{ | ||
Add(new SpriteText | ||
{ | ||
Text = $"Renderer: {host.ResolvedRenderer} ({host.Renderer.GetType().Name} / {host.Window.GraphicsSurface.Type})", | ||
Font = FrameworkFont.Regular.With(size: 24), | ||
}); | ||
Add(new BasicDropdown<RendererType> | ||
{ | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre, | ||
Items = host.GetPreferredRenderersForCurrentPlatform().OrderBy(t => t), | ||
Current = config.GetBindable<RendererType>(FrameworkSetting.Renderer), | ||
Width = 200f, | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.ComponentModel; | ||
|
||
namespace osu.Framework.Configuration | ||
{ | ||
public enum RendererType | ||
{ | ||
[Description("Automatic")] | ||
Automatic, | ||
|
||
[Description("Metal")] | ||
Metal, | ||
|
||
[Description("Vulkan")] | ||
Vulkan, | ||
|
||
[Description("Direct3D 11")] | ||
Direct3D11, | ||
|
||
[Description("OpenGL")] | ||
OpenGL, | ||
|
||
[Description("OpenGL (Legacy)")] | ||
OpenGLLegacy, | ||
} | ||
} |
Oops, something went wrong.