OGLExtension.cs 1003 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using OpenTK.Graphics.OpenGL;
  2. namespace Ryujinx.Graphics.Gal.OpenGL
  3. {
  4. static class OGLExtension
  5. {
  6. private static bool Initialized = false;
  7. private static bool EnhancedLayouts;
  8. public static bool HasEnhancedLayouts()
  9. {
  10. EnsureInitialized();
  11. return EnhancedLayouts;
  12. }
  13. private static void EnsureInitialized()
  14. {
  15. if (Initialized)
  16. {
  17. return;
  18. }
  19. EnhancedLayouts = HasExtension("GL_ARB_enhanced_layouts");
  20. }
  21. private static bool HasExtension(string Name)
  22. {
  23. int NumExtensions = GL.GetInteger(GetPName.NumExtensions);
  24. for (int Extension = 0; Extension < NumExtensions; Extension++)
  25. {
  26. if (GL.GetString(StringNameIndexed.Extensions, Extension) == Name)
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. }
  34. }