GetStaticAddess checks for RenderableFlags.ES3

This commit is contained in:
Jonas Boesch 2015-03-04 11:50:12 +01:00 committed by Fraser Waters
parent f57e411723
commit d6779d986d
2 changed files with 14 additions and 12 deletions

View file

@ -53,14 +53,14 @@ namespace OpenTK.Platform.Egl
protected override IntPtr GetStaticAddress(IntPtr function, RenderableFlags renderable) protected override IntPtr GetStaticAddress(IntPtr function, RenderableFlags renderable)
{ {
if ((renderable & RenderableFlags.ES) != 0 && ES1 != IntPtr.Zero) if ((renderable & (RenderableFlags.ES2 | RenderableFlags.ES3)) != 0 && ES2 != IntPtr.Zero)
{
return X11.DL.Symbol(ES1, function);
}
else if ((renderable & RenderableFlags.ES2) != 0 && ES2 != IntPtr.Zero)
{ {
return X11.DL.Symbol(ES2, function); return X11.DL.Symbol(ES2, function);
} }
else if ((renderable & RenderableFlags.ES) != 0 && ES1 != IntPtr.Zero)
{
return X11.DL.Symbol(ES1, function);
}
else if ((renderable & RenderableFlags.GL) != 0 && GL != IntPtr.Zero) else if ((renderable & RenderableFlags.GL) != 0 && GL != IntPtr.Zero)
{ {
return X11.DL.Symbol(GL, function); return X11.DL.Symbol(GL, function);

View file

@ -34,8 +34,8 @@ namespace OpenTK.Platform.Egl
{ {
class EglWinContext : EglContext class EglWinContext : EglContext
{ {
readonly IntPtr ES1 = OpenTK.Platform.Windows.Functions.LoadLibrary("libGLESv1_CM"); IntPtr ES1 = OpenTK.Platform.Windows.Functions.LoadLibrary("libGLESv1_CM");
readonly IntPtr ES2 = OpenTK.Platform.Windows.Functions.LoadLibrary("libGLESv2"); IntPtr ES2 = OpenTK.Platform.Windows.Functions.LoadLibrary("libGLESv2");
public EglWinContext(GraphicsMode mode, EglWindowInfo window, IGraphicsContext sharedContext, public EglWinContext(GraphicsMode mode, EglWindowInfo window, IGraphicsContext sharedContext,
int major, int minor, GraphicsContextFlags flags) int major, int minor, GraphicsContextFlags flags)
@ -53,14 +53,14 @@ namespace OpenTK.Platform.Egl
protected override IntPtr GetStaticAddress(IntPtr function, RenderableFlags renderable) protected override IntPtr GetStaticAddress(IntPtr function, RenderableFlags renderable)
{ {
if ((renderable & RenderableFlags.ES) != 0 && ES1 != IntPtr.Zero) if ((renderable & (RenderableFlags.ES2 | RenderableFlags.ES3)) != 0 && ES2 != IntPtr.Zero)
{
return Windows.Functions.GetProcAddress(ES1, function);
}
else if ((renderable & RenderableFlags.ES2) != 0 && ES2 != IntPtr.Zero)
{ {
return Windows.Functions.GetProcAddress(ES2, function); return Windows.Functions.GetProcAddress(ES2, function);
} }
else if ((renderable & RenderableFlags.ES) != 0 && ES1 != IntPtr.Zero)
{
return Windows.Functions.GetProcAddress(ES1, function);
}
return IntPtr.Zero; return IntPtr.Zero;
} }
@ -75,6 +75,8 @@ namespace OpenTK.Platform.Egl
Windows.Functions.FreeLibrary(ES2); Windows.Functions.FreeLibrary(ES2);
} }
ES1 = ES2 = IntPtr.Zero;
base.Dispose(manual); base.Dispose(manual);
} }