Clean up global GLManager instance
no code actually got run by the GLManager ctor so it should be fine to delay it
This commit is contained in:
parent
cdf562264c
commit
f0843689ed
|
@ -53,11 +53,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private IEmulator GlobalEmulator => GlobalWin.Emulator;
|
||||
|
||||
public DisplayManager(OSDManager osdManager, IGL gl, GLManager glManager, PresentationPanel presentationPanel)
|
||||
public DisplayManager(OSDManager osdManager, IGL gl, PresentationPanel presentationPanel)
|
||||
{
|
||||
_osdManager = osdManager;
|
||||
GL = gl;
|
||||
GLManager = glManager;
|
||||
|
||||
// setup the GL context manager, needed for coping with multiple opengl cores vs opengl display method
|
||||
// but is it tho? --yoshi
|
||||
GLManager = GLManager.Instance;
|
||||
|
||||
this.presentationPanel = presentationPanel;
|
||||
GraphicsControl = this.presentationPanel.GraphicsControl;
|
||||
CR_GraphicsControl = GLManager.GetContextForGraphicsControl(GraphicsControl);
|
||||
|
|
|
@ -17,18 +17,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
}
|
||||
|
||||
public static GLManager Instance { get; private set; }
|
||||
private static readonly Lazy<GLManager> _lazyInstance = new Lazy<GLManager>(() => new GLManager());
|
||||
|
||||
/// <exception cref="InvalidOperationException">instance already created</exception>
|
||||
public static void CreateInstance()
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
throw new InvalidOperationException($"Attempted to create more than one {nameof(GLManager)}");
|
||||
}
|
||||
|
||||
Instance = new GLManager();
|
||||
}
|
||||
public static GLManager Instance => _lazyInstance.Value;
|
||||
|
||||
public void ReleaseGLContext(object o)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
public static Sound Sound;
|
||||
public static readonly OSDManager OSD = new OSDManager();
|
||||
public static DisplayManager DisplayManager;
|
||||
public static GLManager GLManager;
|
||||
|
||||
public static int ExitCode;
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
GraphicsControl = { MainWindow = true }
|
||||
};
|
||||
GlobalWin.DisplayManager = new DisplayManager(OSD, GlobalWin.GL, GlobalWin.GLManager, PresentationPanel);
|
||||
GlobalWin.DisplayManager = new DisplayManager(OSD, GlobalWin.GL, PresentationPanel);
|
||||
Controls.Add(PresentationPanel);
|
||||
Controls.SetChildIndex(PresentationPanel, 0);
|
||||
|
||||
|
|
|
@ -145,10 +145,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
// create IGL context. we do this whether or not the user has selected OpenGL, so that we can run opengl-based emulator cores
|
||||
GlobalWin.IGL_GL = new IGL_TK(2, 0, false);
|
||||
|
||||
// setup the GL context manager, needed for coping with multiple opengl cores vs opengl display method
|
||||
GLManager.CreateInstance();
|
||||
GlobalWin.GLManager = GLManager.Instance;
|
||||
|
||||
//now create the "GL" context for the display method. we can reuse the IGL_TK context if opengl display method is chosen
|
||||
REDO_DISPMETHOD:
|
||||
if (GlobalWin.Config.DispMethod == EDispMethod.GdiPlus)
|
||||
|
|
Loading…
Reference in New Issue