mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-08-04 20:41:13 +00:00
Bugfix: Non-null shared contexts for Egl threw Exception
The shared context parameter can be either the EglContext directly, or the facade, and we cast to see what it is.
This commit is contained in:
parent
1581ac7b8a
commit
7b795a02e1
|
@ -53,6 +53,8 @@ namespace OpenTK.Platform.Egl
|
|||
if (window == null)
|
||||
throw new ArgumentNullException("window");
|
||||
|
||||
EglContext shared = GetSharedEglContext(sharedContext);
|
||||
|
||||
WindowInfo = window;
|
||||
|
||||
// Select an EGLConfig that matches the desired mode. We cannot use the 'mode'
|
||||
|
@ -216,6 +218,21 @@ namespace OpenTK.Platform.Egl
|
|||
}
|
||||
}
|
||||
|
||||
private EglContext GetSharedEglContext(IGraphicsContext sharedContext)
|
||||
{
|
||||
if (sharedContext == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var internalContext = sharedContext as IGraphicsContextInternal;
|
||||
if (internalContext != null)
|
||||
{
|
||||
return (EglContext) internalContext.Implementation;
|
||||
}
|
||||
return (EglContext) sharedContext;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue