JinxRyu/Ryujinx.Graphics/Gal/OpenGL/OGLExtension.cs
ReinUsesLisp 2562ca6c3f Fix multiple rendertargets (#427)
* Simplify render target bindings

* Implement multiple viewports

* Pack glViewportIndexed calls into a single glViewportArray

* Use ARB_viewport_array when available

* Cache framebuffer attachments

* Use get accessors in OGLExtension

* Address feedback
2018-09-26 00:55:30 +02:00

31 lines
No EOL
1.1 KiB
C#

using OpenTK.Graphics.OpenGL;
using System;
namespace Ryujinx.Graphics.Gal.OpenGL
{
static class OGLExtension
{
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 static bool EnhancedLayouts => s_EnhancedLayouts.Value;
public static bool TextureMirrorClamp => s_TextureMirrorClamp.Value;
public static bool ViewportArray => s_ViewportArray.Value;
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;
}
}
}