OGLExtension.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. private static bool TextureMirrorClamp;
  9. public static bool HasEnhancedLayouts()
  10. {
  11. EnsureInitialized();
  12. return EnhancedLayouts;
  13. }
  14. public static bool HasTextureMirrorClamp()
  15. {
  16. EnsureInitialized();
  17. return TextureMirrorClamp;
  18. }
  19. private static void EnsureInitialized()
  20. {
  21. if (Initialized)
  22. {
  23. return;
  24. }
  25. EnhancedLayouts = HasExtension("GL_ARB_enhanced_layouts");
  26. TextureMirrorClamp = HasExtension("GL_EXT_texture_mirror_clamp");
  27. }
  28. private static bool HasExtension(string Name)
  29. {
  30. int NumExtensions = GL.GetInteger(GetPName.NumExtensions);
  31. for (int Extension = 0; Extension < NumExtensions; Extension++)
  32. {
  33. if (GL.GetString(StringNameIndexed.Extensions, Extension) == Name)
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. }
  41. }