2018-07-19 05:33:27 +00:00
|
|
|
|
using OpenTK.Graphics.OpenGL;
|
2018-09-25 22:55:30 +00:00
|
|
|
|
using System;
|
2018-07-19 05:33:27 +00:00
|
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
|
|
{
|
|
|
|
|
static class OGLExtension
|
|
|
|
|
{
|
2018-09-25 22:55:30 +00:00
|
|
|
|
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"));
|
2018-07-19 05:33:27 +00:00
|
|
|
|
|
2019-02-28 01:12:24 +00:00
|
|
|
|
private static Lazy<bool> s_NvidiaDriver = new Lazy<bool>(() => IsNvidiaDriver());
|
|
|
|
|
|
2018-09-25 22:55:30 +00:00
|
|
|
|
public static bool EnhancedLayouts => s_EnhancedLayouts.Value;
|
|
|
|
|
public static bool TextureMirrorClamp => s_TextureMirrorClamp.Value;
|
|
|
|
|
public static bool ViewportArray => s_ViewportArray.Value;
|
2019-02-28 01:12:24 +00:00
|
|
|
|
public static bool NvidiaDrvier => s_NvidiaDriver.Value;
|
2018-07-19 05:33:27 +00:00
|
|
|
|
|
|
|
|
|
private static bool HasExtension(string Name)
|
|
|
|
|
{
|
|
|
|
|
int NumExtensions = GL.GetInteger(GetPName.NumExtensions);
|
|
|
|
|
|
|
|
|
|
for (int Extension = 0; Extension < NumExtensions; Extension++)
|
|
|
|
|
{
|
|
|
|
|
if (GL.GetString(StringNameIndexed.Extensions, Extension) == Name)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2019-02-28 01:12:24 +00:00
|
|
|
|
|
|
|
|
|
private static bool IsNvidiaDriver() {
|
|
|
|
|
return GL.GetString(StringName.Vendor).Equals("NVIDIA Corporation");
|
|
|
|
|
}
|
2018-07-19 05:33:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|