Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Win] Clear extension list on reload

  • Loading branch information...
commit 770b697583000d17e175f17b85919e1693243cfa 1 parent 88ae446
@thefiddler thefiddler authored
Showing with 26 additions and 19 deletions.
  1. +26 −19 Source/OpenTK/Platform/Windows/WglHelper.cs
View
45 Source/OpenTK/Platform/Windows/WglHelper.cs
@@ -48,25 +48,28 @@ public static bool SupportsExtension(string name)
/// <returns>True if the extension is supported by the given context, false otherwise</returns>
public static bool SupportsExtension(IntPtr dc, string name)
{
- if (extensions.Count == 0)
+ lock (sync)
{
- // We cache this locally, as another thread might create a context which doesn't support this method.
- // The design is far from ideal, but there's no good solution to this issue as long as we are using
- // static WGL/GL classes. Fortunately, this issue is extremely unlikely to arise in practice, as you'd
- // have to create one accelerated and one non-accelerated context in the same application, with the
- // non-accelerated context coming second.
- bool get_arb = SupportsFunction("wglGetExtensionsStringARB");
- bool get_ext = SupportsFunction("wglGetExtensionsStringEXT");
- string str =
- get_arb ? Arb.GetExtensionsString(dc) :
- get_ext ? Ext.GetExtensionsString() :
- String.Empty;
-
- if (!String.IsNullOrEmpty(str))
+ if (extensions.Count == 0)
{
- foreach (string ext in str.Split(' '))
+ // We cache this locally, as another thread might create a context which doesn't support this method.
+ // The design is far from ideal, but there's no good solution to this issue as long as we are using
+ // static WGL/GL classes. Fortunately, this issue is extremely unlikely to arise in practice, as you'd
+ // have to create one accelerated and one non-accelerated context in the same application, with the
+ // non-accelerated context coming second.
+ bool get_arb = SupportsFunction("wglGetExtensionsStringARB");
+ bool get_ext = SupportsFunction("wglGetExtensionsStringEXT");
+ string str =
+ get_arb ? Arb.GetExtensionsString(dc) :
+ get_ext ? Ext.GetExtensionsString() :
+ String.Empty;
+
+ if (!String.IsNullOrEmpty(str))
{
- extensions.Add(ext, true);
+ foreach (string ext in str.Split(' '))
+ {
+ extensions.Add(ext, true);
+ }
}
}
}
@@ -132,11 +135,15 @@ static bool IsValid(IntPtr address)
internal override void LoadEntryPoints()
{
- if (Wgl.GetCurrentContext() != IntPtr.Zero)
+ lock (SyncRoot)
{
- for (int i = 0; i < EntryPointsInstance.Length; i++)
+ if (Wgl.GetCurrentContext() != IntPtr.Zero)
{
- EntryPointsInstance[i] = GetAddress(EntryPointNamesInstance[i]);
+ for (int i = 0; i < EntryPointsInstance.Length; i++)
+ {
+ EntryPointsInstance[i] = GetAddress(EntryPointNamesInstance[i]);
+ }
+ extensions.Clear();
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.