Hide legacy GL support behind a feature flag.
This commit is contained in:
@@ -26,7 +26,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public interface IPlatform
|
public interface IPlatform
|
||||||
{
|
{
|
||||||
IPlatformWindow CreateWindow(Size size, WindowMode windowMode, float scaleModifier, int batchSize, int videoDisplay, GLProfile profile);
|
IPlatformWindow CreateWindow(Size size, WindowMode windowMode, float scaleModifier, int batchSize, int videoDisplay, GLProfile profile, bool enableLegacyGL);
|
||||||
ISoundEngine CreateSound(string device);
|
ISoundEngine CreateSound(string device);
|
||||||
IFont CreateFont(byte[] data);
|
IFont CreateFont(byte[] data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
Window = platform.CreateWindow(new Size(resolution.Width, resolution.Height),
|
Window = platform.CreateWindow(new Size(resolution.Width, resolution.Height),
|
||||||
graphicSettings.Mode, graphicSettings.UIScale, graphicSettings.BatchSize,
|
graphicSettings.Mode, graphicSettings.UIScale, graphicSettings.BatchSize,
|
||||||
graphicSettings.VideoDisplay, graphicSettings.GLProfile);
|
graphicSettings.VideoDisplay, graphicSettings.GLProfile, !graphicSettings.DisableLegacyGL);
|
||||||
|
|
||||||
Context = Window.Context;
|
Context = Window.Context;
|
||||||
|
|
||||||
|
|||||||
@@ -175,13 +175,16 @@ namespace OpenRA
|
|||||||
[Desc("Disable operating-system provided cursor rendering.")]
|
[Desc("Disable operating-system provided cursor rendering.")]
|
||||||
public bool DisableHardwareCursors = false;
|
public bool DisableHardwareCursors = false;
|
||||||
|
|
||||||
|
[Desc("Disable legacy OpenGL 2.1 support.")]
|
||||||
|
public bool DisableLegacyGL = true;
|
||||||
|
|
||||||
[Desc("Display index to use in a multi-monitor fullscreen setup.")]
|
[Desc("Display index to use in a multi-monitor fullscreen setup.")]
|
||||||
public int VideoDisplay = 0;
|
public int VideoDisplay = 0;
|
||||||
|
|
||||||
[Desc("Preferred OpenGL profile to use.",
|
[Desc("Preferred OpenGL profile to use.",
|
||||||
"Modern: OpenGL Core Profile 3.2 or greater.",
|
"Modern: OpenGL Core Profile 3.2 or greater.",
|
||||||
"Embedded: OpenGL ES 3.0 or greater.",
|
"Embedded: OpenGL ES 3.0 or greater.",
|
||||||
"Legacy: OpenGL 2.1 with framebuffer_object extension.",
|
"Legacy: OpenGL 2.1 with framebuffer_object extension (requires DisableLegacyGL: False)",
|
||||||
"Automatic: Use the first supported profile.")]
|
"Automatic: Use the first supported profile.")]
|
||||||
public GLProfile GLProfile = GLProfile.Automatic;
|
public GLProfile GLProfile = GLProfile.Automatic;
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ namespace OpenRA.Platforms.Default
|
|||||||
{
|
{
|
||||||
public class DefaultPlatform : IPlatform
|
public class DefaultPlatform : IPlatform
|
||||||
{
|
{
|
||||||
public IPlatformWindow CreateWindow(Size size, WindowMode windowMode, float scaleModifier, int batchSize, int videoDisplay, GLProfile profile)
|
public IPlatformWindow CreateWindow(Size size, WindowMode windowMode, float scaleModifier, int batchSize, int videoDisplay, GLProfile profile, bool enableLegacyGL)
|
||||||
{
|
{
|
||||||
return new Sdl2PlatformWindow(size, windowMode, scaleModifier, batchSize, videoDisplay, profile);
|
return new Sdl2PlatformWindow(size, windowMode, scaleModifier, batchSize, videoDisplay, profile, enableLegacyGL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISoundEngine CreateSound(string device)
|
public ISoundEngine CreateSound(string device)
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ namespace OpenRA.Platforms.Default
|
|||||||
static extern bool SetProcessDPIAware();
|
static extern bool SetProcessDPIAware();
|
||||||
|
|
||||||
public Sdl2PlatformWindow(Size requestEffectiveWindowSize, WindowMode windowMode,
|
public Sdl2PlatformWindow(Size requestEffectiveWindowSize, WindowMode windowMode,
|
||||||
float scaleModifier, int batchSize, int videoDisplay, GLProfile requestProfile)
|
float scaleModifier, int batchSize, int videoDisplay, GLProfile requestProfile, bool enableLegacyGL)
|
||||||
{
|
{
|
||||||
// Lock the Window/Surface properties until initialization is complete
|
// Lock the Window/Surface properties until initialization is complete
|
||||||
lock (syncObject)
|
lock (syncObject)
|
||||||
@@ -148,7 +148,10 @@ namespace OpenRA.Platforms.Default
|
|||||||
|
|
||||||
// Decide which OpenGL profile to use.
|
// Decide which OpenGL profile to use.
|
||||||
// Prefer standard GL over GLES provided by the native driver
|
// Prefer standard GL over GLES provided by the native driver
|
||||||
var testProfiles = new List<GLProfile> { GLProfile.ANGLE, GLProfile.Modern, GLProfile.Embedded, GLProfile.Legacy };
|
var testProfiles = new List<GLProfile> { GLProfile.ANGLE, GLProfile.Modern, GLProfile.Embedded };
|
||||||
|
if (enableLegacyGL)
|
||||||
|
testProfiles.Add(GLProfile.Legacy);
|
||||||
|
|
||||||
supportedProfiles = testProfiles
|
supportedProfiles = testProfiles
|
||||||
.Where(CanCreateGLWindow)
|
.Where(CanCreateGLWindow)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|||||||
Reference in New Issue
Block a user