forked from Mirror/Ryujinx
faac08e638
* gtk3: Add base for future Vulkan integration This PR puts in place the fondation for the future Vulkan integration on the GTK3 UI. This also updated SPB to 0.0.3-build14 that fixed a use after free on XErrorHandler on Linux. * Address rip's comments * Merge GLWidget inside GLRenderer * Clean up and deduplicate renderer implementations * Address shahil's comments * Address Ac_K's comments * Address gdkchan's comments
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using OpenTK;
|
|
using OpenTK.Graphics;
|
|
using OpenTK.Graphics.OpenGL;
|
|
using Ryujinx.Graphics.OpenGL;
|
|
using SPB.Graphics;
|
|
using SPB.Graphics.OpenGL;
|
|
using SPB.Platform;
|
|
using SPB.Windowing;
|
|
|
|
namespace Ryujinx.Ui
|
|
{
|
|
class SPBOpenGLContext : IOpenGLContext
|
|
{
|
|
private OpenGLContextBase _context;
|
|
private NativeWindowBase _window;
|
|
|
|
private SPBOpenGLContext(OpenGLContextBase context, NativeWindowBase window)
|
|
{
|
|
_context = context;
|
|
_window = window;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_context.Dispose();
|
|
_window.Dispose();
|
|
}
|
|
|
|
public void MakeCurrent()
|
|
{
|
|
_context.MakeCurrent(_window);
|
|
}
|
|
|
|
public static SPBOpenGLContext CreateBackgroundContext(OpenGLContextBase sharedContext)
|
|
{
|
|
OpenGLContextBase context = PlatformHelper.CreateOpenGLContext(FramebufferFormat.Default, 3, 3, OpenGLContextFlags.Compat, true, sharedContext);
|
|
NativeWindowBase window = PlatformHelper.CreateOpenGLWindow(FramebufferFormat.Default, 0, 0, 100, 100);
|
|
|
|
context.Initialize(window);
|
|
context.MakeCurrent(window);
|
|
|
|
GL.LoadBindings(new OpenToolkitBindingsContext(context));
|
|
|
|
context.MakeCurrent(null);
|
|
|
|
return new SPBOpenGLContext(context, window);
|
|
}
|
|
}
|
|
}
|