Removed strict opengl in favour of required. With this an exception is no longer thrown, just a warning for required extensions

This commit is contained in:
Andy Adshead 2019-03-01 17:59:35 +00:00
parent 1284c6b94a
commit 8bd82267c8
5 changed files with 12 additions and 42 deletions

View file

@ -28,40 +28,31 @@ namespace Ryujinx.Graphics.Gal.OpenGL
}
}
Logger.PrintWarning(LogClass.Gpu, $"OpenGL extension {Name} unavailable. You may experience some rendering issues or performance degredation");
Logger.PrintInfo(LogClass.Gpu, $"OpenGL extension {Name} unavailable. You may experience some performance degredation");
return false;
}
public static class Strict
public static class Required
{
// Strict enabled
public static void SetStrictOpenGL(bool enabled) => _strictOpenGL = enabled;
private static bool _strictOpenGL;
// Public accessors
public static bool EnhancedLayouts => s_EnhancedLayoutsStrict.Value;
public static bool TextureMirrorClamp => s_TextureMirrorClampStrict.Value;
public static bool ViewportArray => s_ViewportArrayStrict.Value;
public static bool EnhancedLayouts => s_EnhancedLayoutsRequired.Value;
public static bool TextureMirrorClamp => s_TextureMirrorClampRequired.Value;
public static bool ViewportArray => s_ViewportArrayRequired.Value;
// Private lazy backing variables
private static Lazy<bool> s_EnhancedLayoutsStrict = new Lazy<bool>(() => HasExtensionStrict(OGLExtension.EnhancedLayouts, "GL_ARB_enhanced_layouts"));
private static Lazy<bool> s_TextureMirrorClampStrict = new Lazy<bool>(() => HasExtensionStrict(OGLExtension.TextureMirrorClamp, "GL_EXT_texture_mirror_clamp"));
private static Lazy<bool> s_ViewportArrayStrict = new Lazy<bool>(() => HasExtensionStrict(OGLExtension.ViewportArray, "GL_ARB_viewport_array"));
private static Lazy<bool> s_EnhancedLayoutsRequired = new Lazy<bool>(() => HasExtensionRequired(OGLExtension.EnhancedLayouts, "GL_ARB_enhanced_layouts"));
private static Lazy<bool> s_TextureMirrorClampRequired = new Lazy<bool>(() => HasExtensionRequired(OGLExtension.TextureMirrorClamp, "GL_EXT_texture_mirror_clamp"));
private static Lazy<bool> s_ViewportArrayRequired = new Lazy<bool>(() => HasExtensionRequired(OGLExtension.ViewportArray, "GL_ARB_viewport_array"));
private static bool HasExtensionStrict(bool Value, string Name)
private static bool HasExtensionRequired(bool Value, string Name)
{
if (Value)
{
return true;
}
if (_strictOpenGL)
{
throw new Exception($"Required OpenGL extension {Name} unavailable. You can ignore this message by disabling 'enable_strict_opengl' " +
$"in the config however you may experience some rendering issues or performance degredation");
}
Logger.PrintWarning(LogClass.Gpu, $"Required OpenGL extension {Name} unavailable. You may experience some rendering issues");
return false;
}

View file

@ -283,7 +283,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
{
// If viewport arrays are unavailable apply first scissor test to all or
// there is only 1 scissor test and it's the first, the scissor test applies to all viewports
if (!OGLExtension.Strict.ViewportArray || (Index == 0 && New.ScissorTestCount == 1))
if (!OGLExtension.Required.ViewportArray || (Index == 0 && New.ScissorTestCount == 1))
{
GL.Enable(EnableCap.ScissorTest);
applyToAll = true;
@ -312,7 +312,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
}
// If all scissor tests have been applied, or viewport arrays are unavailable we can skip remaining itterations
if (!OGLExtension.Strict.ViewportArray || ++scissorsApplied == New.ScissorTestCount)
if (!OGLExtension.Required.ViewportArray || ++scissorsApplied == New.ScissorTestCount)
{
break;
}

View file

@ -41,9 +41,6 @@
// Enable integrity checks on Switch content files
"enable_fs_integrity_checks": true,
// Enable strict OpenGL. Required OpenGL extensions/features will throw exceptions rather than potentially problematic fallbacks
"enable_strict_opengl": false,
// The primary controller's type
// Supported Values: Handheld, ProController, NpadPair, NpadLeft, NpadRight
"controller_type": "Handheld",

View file

@ -62,11 +62,6 @@ namespace Ryujinx
/// </summary>
public bool EnableFileLog { get; private set; }
/// <summary>
/// Enables or disables stict OpenGL
/// </summary>
public bool EnableStrictOpengl { get; private set; }
/// <summary>
/// Change System Language
/// </summary>
@ -188,8 +183,6 @@ namespace Ryujinx
}
}
OGLExtension.Strict.SetStrictOpenGL(Instance.EnableStrictOpengl);
device.EnableDeviceVsync = Instance.EnableVsync;
device.System.State.DockedMode = Instance.DockedMode;

View file

@ -399,17 +399,6 @@
false
]
},
"enable_strict_opengl": {
"$id": "#/properties/enable_strict_opengl",
"type": "boolean",
"title": "Enable Strict OpenGL",
"description": "Required OpenGL extensions/features will throw exceptions rather than potentially problematic fallbacks",
"default": false,
"examples": [
true,
false
]
},
"controller_type": {
"$id": "#/properties/controller_type",
"type": "string",