Reformatting for JD
This commit is contained in:
parent
3dd7664581
commit
d440384a11
3 changed files with 32 additions and 23 deletions
|
@ -6,23 +6,16 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
{
|
||||
public static class OGLExtension
|
||||
{
|
||||
private static bool _strictOpenGL;
|
||||
|
||||
// Private lazy backing variables
|
||||
private static Lazy<bool> s_EnhancedLayouts = new Lazy<bool>(() => HasExtension("GL_ARB_enhanced_layouts"));
|
||||
private static Lazy<bool> s_TextureMirrorClamp = new Lazy<bool>(() => HasExtension("GL_EXT_texture_mirror_clamp"));
|
||||
private static Lazy<bool> s_ViewportArray = new Lazy<bool>(() => HasExtension("GL_ARB_viewport_array"));
|
||||
|
||||
// Public accessors
|
||||
public static bool EnhancedLayouts => s_EnhancedLayouts.Value;
|
||||
public static bool TextureMirrorClamp => s_TextureMirrorClamp.Value;
|
||||
public static bool ViewportArray => s_ViewportArray.Value;
|
||||
|
||||
// Strict
|
||||
private static Lazy<bool> s_ViewportArrayStrict = new Lazy<bool>(() => HasExtensionStrict("GL_ARB_viewport_array"));
|
||||
|
||||
public static bool ViewportArrayStrict => s_ViewportArrayStrict.Value;
|
||||
|
||||
public static void SetStrictOpenGL(bool enabled) => _strictOpenGL = enabled;
|
||||
|
||||
private static bool HasExtension(string Name)
|
||||
{
|
||||
int NumExtensions = GL.GetInteger(GetPName.NumExtensions);
|
||||
|
@ -40,22 +33,38 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
return false;
|
||||
}
|
||||
|
||||
private static bool HasExtensionStrict(string Name)
|
||||
public static class Strict
|
||||
{
|
||||
bool available = HasExtension(Name);
|
||||
// Strict enabled
|
||||
public static void SetStrictOpenGL(bool enabled) => _strictOpenGL = enabled;
|
||||
|
||||
if (available)
|
||||
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;
|
||||
|
||||
// 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 bool HasExtensionStrict(bool Value, string Name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
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");
|
||||
}
|
||||
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");
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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.ViewportArrayStrict || (Index == 0 && New.ScissorTestCount == 1))
|
||||
if (!OGLExtension.Strict.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.ViewportArrayStrict || ++scissorsApplied == New.ScissorTestCount)
|
||||
if (!OGLExtension.Strict.ViewportArray || ++scissorsApplied == New.ScissorTestCount)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ namespace Ryujinx
|
|||
}
|
||||
}
|
||||
|
||||
OGLExtension.SetStrictOpenGL(Instance.EnableStrictOpengl);
|
||||
OGLExtension.Strict.SetStrictOpenGL(Instance.EnableStrictOpengl);
|
||||
|
||||
device.EnableDeviceVsync = Instance.EnableVsync;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue