Remove GlobalWin.IGL_GL, only init OpenTK when using that disp. method

also, if it's too old, dispose it before continuing with fallback
This commit is contained in:
YoshiRulz 2020-11-27 00:54:09 +10:00 committed by James Groom
parent 60022ab146
commit 3150cc4493
2 changed files with 6 additions and 11 deletions

View File

@ -16,11 +16,6 @@ namespace BizHawk.Client.EmuHawk
/// </summary> /// </summary>
public static IGL GL; public static IGL GL;
/// <summary>
/// The IGL_TK to be used for specifically opengl operations (accessing textures from opengl-based cores)
/// </summary>
public static IGL_TK IGL_GL;
public static Sound Sound; public static Sound Sound;
public static Config Config { get; set; } public static Config Config { get; set; }

View File

@ -142,10 +142,6 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.Config.DispMethod = EDispMethod.GdiPlus; GlobalWin.Config.DispMethod = EDispMethod.GdiPlus;
} }
// 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);
//now create the "GL" context for the display method. we can reuse the IGL_TK context if opengl display method is chosen
REDO_DISPMETHOD: REDO_DISPMETHOD:
if (GlobalWin.Config.DispMethod == EDispMethod.GdiPlus) if (GlobalWin.Config.DispMethod == EDispMethod.GdiPlus)
{ {
@ -168,15 +164,19 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
GlobalWin.GL = GlobalWin.IGL_GL; var glOpenTK = new IGL_TK(2, 0, false);
// check the opengl version and don't even try to boot this crap up if its too old // check the opengl version and don't even try to boot this crap up if its too old
if (GlobalWin.IGL_GL.Version < 200) if (glOpenTK.Version < 200)
{ {
((IDisposable) glOpenTK).Dispose();
// fallback // fallback
GlobalWin.Config.DispMethod = EDispMethod.GdiPlus; GlobalWin.Config.DispMethod = EDispMethod.GdiPlus;
goto REDO_DISPMETHOD; goto REDO_DISPMETHOD;
} }
GlobalWin.GL = glOpenTK;
} }
// try creating a GUI Renderer. If that doesn't succeed. we fallback // try creating a GUI Renderer. If that doesn't succeed. we fallback