Ava Working?

This commit is contained in:
Isaac Marovitz 2024-05-09 21:22:38 -04:00
parent 5db3568305
commit e584f8d37d
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1
5 changed files with 19 additions and 14 deletions

View file

@ -1,4 +1,4 @@
using OpenTK; // using OpenTK;
using Silk.NET.OpenGL.Legacy; using Silk.NET.OpenGL.Legacy;
using Ryujinx.Common.Configuration; using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;

View file

@ -532,7 +532,8 @@ namespace Ryujinx.Headless.SDL2
preferredGpuId); preferredGpuId);
} }
return new OpenGLRenderer(); var openGlWindow = (OpenGLWindow)window;
return new OpenGLRenderer(window.);
} }
private static Switch InitializeEmulationContext(WindowBase window, IRenderer renderer, Options options) private static Switch InitializeEmulationContext(WindowBase window, IRenderer renderer, Options options)

View file

@ -823,7 +823,7 @@ namespace Ryujinx.Ava
} }
else else
{ {
renderer = new OpenGLRenderer(); renderer = new OpenGLRenderer((RendererHost.EmbeddedWindow as EmbeddedWindowOpenGL).CreateApi());
} }
BackendThreading threadingMode = ConfigurationState.Instance.Graphics.BackendThreading; BackendThreading threadingMode = ConfigurationState.Instance.Graphics.BackendThreading;

View file

@ -1,4 +1,4 @@
using OpenTK.Graphics.OpenGL; using Silk.NET.OpenGL.Legacy;
using Ryujinx.Common.Configuration; using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.GAL;
@ -44,6 +44,13 @@ namespace Ryujinx.Ava.UI.Renderer
throw new PlatformNotSupportedException(); throw new PlatformNotSupportedException();
} }
Context.Initialize(_window);
Context.MakeCurrent(_window);
Context.MakeCurrent(null);
}
public GL CreateApi()
{
var flags = OpenGLContextFlags.Compat; var flags = OpenGLContextFlags.Compat;
if (ConfigurationState.Instance.Logger.GraphicsDebugLevel != GraphicsDebugLevel.None) if (ConfigurationState.Instance.Logger.GraphicsDebugLevel != GraphicsDebugLevel.None)
{ {
@ -54,12 +61,7 @@ namespace Ryujinx.Ava.UI.Renderer
Context = PlatformHelper.CreateOpenGLContext(graphicsMode, 3, 3, flags); Context = PlatformHelper.CreateOpenGLContext(graphicsMode, 3, 3, flags);
Context.Initialize(_window); return GL.GetApi(Context.GetProcAddress);
Context.MakeCurrent(_window);
GL.LoadBindings(new OpenTKBindingsContext(Context.GetProcAddress));
Context.MakeCurrent(null);
} }
public void MakeCurrent(bool unbind = false, bool shouldThrow = true) public void MakeCurrent(bool unbind = false, bool shouldThrow = true)

View file

@ -1,4 +1,4 @@
using OpenTK.Graphics.OpenGL; using Silk.NET.OpenGL.Legacy;
using Ryujinx.Graphics.OpenGL; using Ryujinx.Graphics.OpenGL;
using SPB.Graphics; using SPB.Graphics;
using SPB.Graphics.OpenGL; using SPB.Graphics.OpenGL;
@ -9,11 +9,13 @@ namespace Ryujinx.Ava.UI.Renderer
{ {
class SPBOpenGLContext : IOpenGLContext class SPBOpenGLContext : IOpenGLContext
{ {
private readonly GL _api;
private readonly OpenGLContextBase _context; private readonly OpenGLContextBase _context;
private readonly NativeWindowBase _window; private readonly NativeWindowBase _window;
private SPBOpenGLContext(OpenGLContextBase context, NativeWindowBase window) private SPBOpenGLContext(GL api, OpenGLContextBase context, NativeWindowBase window)
{ {
_api = api;
_context = context; _context = context;
_window = window; _window = window;
} }
@ -39,11 +41,11 @@ namespace Ryujinx.Ava.UI.Renderer
context.Initialize(window); context.Initialize(window);
context.MakeCurrent(window); context.MakeCurrent(window);
GL.LoadBindings(new OpenTKBindingsContext(context.GetProcAddress)); GL api = GL.GetApi(context.GetProcAddress);
context.MakeCurrent(null); context.MakeCurrent(null);
return new SPBOpenGLContext(context, window); return new SPBOpenGLContext(api, context, window);
} }
} }
} }