Skip to content

Commit

Permalink
Merge pull request #6193 from smoogipoo/disable-veldrid-gl
Browse files Browse the repository at this point in the history
Remove Veldrid-OpenGL renderer, always use GLRenderer
  • Loading branch information
bdach authored Feb 20, 2024
2 parents e7ffb59 + 29b5f04 commit a8baecb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
7 changes: 7 additions & 0 deletions osu.Framework/Configuration/RendererType.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using System.ComponentModel;
using osu.Framework.Graphics.OpenGL;

namespace osu.Framework.Configuration
{
Expand All @@ -19,9 +21,14 @@ public enum RendererType
[Description("Direct3D 11")]
Direct3D11,

/// <summary>
/// Uses <see cref="GLRenderer"/>.
/// </summary>
[Description("OpenGL")]
OpenGL,

// Can be removed 20240820
[Obsolete]
[Description("OpenGL (Legacy)")]
OpenGLLegacy,
}
Expand Down
21 changes: 11 additions & 10 deletions osu.Framework/Platform/GameHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -857,15 +857,8 @@ public IEnumerable<RendererType> GetPreferredRenderersForCurrentPlatform()
// See https://github.com/ppy/osu/issues/23003
if (RuntimeInfo.OS != RuntimeInfo.Platform.iOS)
{
// Non-veldrid "known-to-work".
yield return RendererType.OpenGLLegacy;
yield return RendererType.OpenGL;
}

// Other available renderers should also be returned (to make this method usable as "all available renderers for current platform"),
// but will never be preferred as OpenGLLegacy will always work.
yield return RendererType.OpenGL;

if (!RuntimeInfo.IsApple) yield return RendererType.Vulkan;
}

protected virtual void ChooseAndSetupRenderer()
Expand Down Expand Up @@ -901,9 +894,12 @@ protected virtual void ChooseAndSetupRenderer()
{
try
{
if (type == RendererType.OpenGLLegacy)
// the legacy renderer. this is basically guaranteed to support all platforms.
if (type == RendererType.OpenGL)
{
// Use the legacy GL renderer. This is basically guaranteed to support all platforms
// and performs better than the Veldrid-GL renderer due to reduction in allocs.
SetupRendererAndWindow("gl", GraphicsSurfaceType.OpenGL);
}
else
SetupRendererAndWindow("veldrid", rendererToGraphicsSurfaceType(type));

Expand Down Expand Up @@ -1262,6 +1258,11 @@ protected virtual void SetupConfig(IDictionary<FrameworkSetting, object> default
}, true);

inputConfig = new InputConfigManager(Storage, AvailableInputHandlers);

#pragma warning disable CS0612 // Type or member is obsolete
if (Config.Get<RendererType>(FrameworkSetting.Renderer) == RendererType.OpenGLLegacy)
Config.SetValue(FrameworkSetting.Renderer, RendererType.OpenGL);
#pragma warning restore CS0612 // Type or member is obsolete
}

/// <summary>
Expand Down

0 comments on commit a8baecb

Please sign in to comment.