Add an "Automatic" GL profile.
This commit is contained in:
@@ -17,6 +17,7 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
public enum GLProfile
|
public enum GLProfile
|
||||||
{
|
{
|
||||||
|
Automatic,
|
||||||
Modern,
|
Modern,
|
||||||
Embedded,
|
Embedded,
|
||||||
Legacy
|
Legacy
|
||||||
|
|||||||
@@ -181,8 +181,9 @@ namespace OpenRA
|
|||||||
[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.",
|
||||||
public GLProfile GLProfile = GLProfile.Modern;
|
"Automatic: Use the first supported profile.")]
|
||||||
|
public GLProfile GLProfile = GLProfile.Automatic;
|
||||||
|
|
||||||
public int BatchSize = 8192;
|
public int BatchSize = 8192;
|
||||||
public int SheetSize = 2048;
|
public int SheetSize = 2048;
|
||||||
|
|||||||
@@ -105,18 +105,21 @@ namespace OpenRA.Mods.Common.LoadScreens
|
|||||||
|
|
||||||
public virtual bool BeforeLoad()
|
public virtual bool BeforeLoad()
|
||||||
{
|
{
|
||||||
|
var graphicSettings = Game.Settings.Graphics;
|
||||||
|
|
||||||
// Reset the UI scaling if the user has configured a UI scale that pushes us below the minimum allowed effective resolution
|
// Reset the UI scaling if the user has configured a UI scale that pushes us below the minimum allowed effective resolution
|
||||||
var minResolution = ModData.Manifest.Get<WorldViewportSizes>().MinEffectiveResolution;
|
var minResolution = ModData.Manifest.Get<WorldViewportSizes>().MinEffectiveResolution;
|
||||||
var resolution = Game.Renderer.Resolution;
|
var resolution = Game.Renderer.Resolution;
|
||||||
if ((resolution.Width < minResolution.Width || resolution.Height < minResolution.Height) && Game.Settings.Graphics.UIScale > 1.0f)
|
if ((resolution.Width < minResolution.Width || resolution.Height < minResolution.Height) && Game.Settings.Graphics.UIScale > 1.0f)
|
||||||
{
|
{
|
||||||
Game.Settings.Graphics.UIScale = 1.0f;
|
graphicSettings.UIScale = 1.0f;
|
||||||
Game.Renderer.SetUIScale(1.0f);
|
Game.Renderer.SetUIScale(1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Saved settings may have been invalidated by a hardware change
|
// Saved settings may have been invalidated by a hardware change
|
||||||
Game.Settings.Graphics.GLProfile = Game.Renderer.GLProfile;
|
graphicSettings.VideoDisplay = Game.Renderer.CurrentDisplay;
|
||||||
Game.Settings.Graphics.VideoDisplay = Game.Renderer.CurrentDisplay;
|
if (graphicSettings.GLProfile != GLProfile.Automatic && graphicSettings.GLProfile != Game.Renderer.GLProfile)
|
||||||
|
graphicSettings.GLProfile = GLProfile.Automatic;
|
||||||
|
|
||||||
// If a ModContent section is defined then we need to make sure that the
|
// If a ModContent section is defined then we need to make sure that the
|
||||||
// required content is installed or switch to the defined content installer.
|
// required content is installed or switch to the defined content installer.
|
||||||
|
|||||||
@@ -267,9 +267,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var glProfileLabel = new CachedTransform<GLProfile, string>(p => p.ToString());
|
var glProfileLabel = new CachedTransform<GLProfile, string>(p => p.ToString());
|
||||||
var glProfileDropdown = panel.Get<DropDownButtonWidget>("GL_PROFILE_DROPDOWN");
|
var glProfileDropdown = panel.Get<DropDownButtonWidget>("GL_PROFILE_DROPDOWN");
|
||||||
|
var disableProfile = Game.Renderer.SupportedGLProfiles.Length < 2 && ds.GLProfile == GLProfile.Automatic;
|
||||||
glProfileDropdown.OnMouseDown = _ => ShowGLProfileDropdown(glProfileDropdown, ds);
|
glProfileDropdown.OnMouseDown = _ => ShowGLProfileDropdown(glProfileDropdown, ds);
|
||||||
glProfileDropdown.GetText = () => glProfileLabel.Update(ds.GLProfile);
|
glProfileDropdown.GetText = () => glProfileLabel.Update(ds.GLProfile);
|
||||||
glProfileDropdown.IsDisabled = () => Game.Renderer.SupportedGLProfiles.Length < 2;
|
glProfileDropdown.IsDisabled = () => disableProfile;
|
||||||
|
|
||||||
var statusBarsDropDown = panel.Get<DropDownButtonWidget>("STATUS_BAR_DROPDOWN");
|
var statusBarsDropDown = panel.Get<DropDownButtonWidget>("STATUS_BAR_DROPDOWN");
|
||||||
statusBarsDropDown.OnMouseDown = _ => ShowStatusBarsDropdown(statusBarsDropDown, gs);
|
statusBarsDropDown.OnMouseDown = _ => ShowStatusBarsDropdown(statusBarsDropDown, gs);
|
||||||
@@ -893,7 +894,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return item;
|
return item;
|
||||||
};
|
};
|
||||||
|
|
||||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, Game.Renderer.SupportedGLProfiles, setupItem);
|
var profiles = new[] { GLProfile.Automatic }.Concat(Game.Renderer.SupportedGLProfiles);
|
||||||
|
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, profiles, setupItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShowTargetLinesDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
static void ShowTargetLinesDropdown(DropDownButtonWidget dropdown, GameSettings s)
|
||||||
|
|||||||
Reference in New Issue
Block a user