2018-07-19 07:33:27 +02:00
|
|
|
|
using OpenTK.Graphics.OpenGL;
|
2018-09-26 00:55:30 +02:00
|
|
|
|
using System;
|
2018-07-19 07:33:27 +02:00
|
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
|
|
{
|
|
|
|
|
static class OGLExtension
|
|
|
|
|
{
|
2018-09-26 00:55:30 +02: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 07:33:27 +02:00
|
|
|
|
|
2019-02-28 02:12:24 +01:00
|
|
|
|
private static Lazy<bool> s_NvidiaDriver = new Lazy<bool>(() => IsNvidiaDriver());
|
|
|
|
|
|
2018-09-26 00:55:30 +02: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 02:12:24 +01:00
|
|
|
|
public static bool NvidiaDrvier => s_NvidiaDriver.Value;
|
2018-07-19 07:33:27 +02: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 02:12:24 +01:00
|
|
|
|
|
|
|
|
|
private static bool IsNvidiaDriver() {
|
|
|
|
|
return GL.GetString(StringName.Vendor).Equals("NVIDIA Corporation");
|
|
|
|
|
}
|
2018-07-19 07:33:27 +02:00
|
|
|
|
}
|
|
|
|
|
}
|