aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.OpenGL/IOpenGLContext.cs
blob: a11b9cb2903d1991e099633119515daa5ca67731 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using Ryujinx.Graphics.OpenGL.Helper;
using System;

namespace Ryujinx.Graphics.OpenGL
{
    public interface IOpenGLContext : IDisposable
    {
        void MakeCurrent();

        // TODO: Support more APIs per platform.
        static bool HasContext()
        {
            if (OperatingSystem.IsWindows())
            {
                return WGLHelper.GetCurrentContext() != IntPtr.Zero;
            }
            else if (OperatingSystem.IsLinux())
            {
                return GLXHelper.GetCurrentContext() != IntPtr.Zero;
            }
            else
            {
                return false;
            }
        }
    }
}