mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 03:45:31 +00:00
Use glXGetProcAddressARB
According to the Linux OpenGL ABI, glXGetProcAddressARB must be statically exported by libGL. This does *not* hold true for glXGetProcAddress. We must used the ARB version instead. Furthermore, glx entry points, unlike wgl, do not depend on any specific OpenGL context. This means we can load them in the constructor of the Glx class.
This commit is contained in:
parent
0bf8565c0f
commit
62d6791736
|
@ -352,7 +352,7 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
public partial class Arb
|
||||
{
|
||||
#region CreateContextAttribs
|
||||
#region CreateContextAttri
|
||||
|
||||
unsafe public static IntPtr CreateContextAttribs(IntPtr display, IntPtr fbconfig, IntPtr share_context, bool direct, int* attribs)
|
||||
{
|
||||
|
@ -371,6 +371,19 @@ namespace OpenTK.Platform.X11
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetProcAddress
|
||||
|
||||
// The linux OpenGL ABI 3.6 (1999) requires
|
||||
// that glXGetProcAddressARB be available as
|
||||
// a static export. The same is *not* true
|
||||
// for glXGetProcAddress, so we should use
|
||||
// glXGetProcAddressARB instead.
|
||||
// See http://www.opengl.org/registry/ABI/
|
||||
[DllImport(Library, EntryPoint = "glXGetProcAddressARB")]
|
||||
public static extern IntPtr GetProcAddress([MarshalAs(UnmanagedType.LPTStr)] string procName);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
internal static partial class Delegates
|
||||
|
|
|
@ -20,17 +20,28 @@ namespace OpenTK.Platform.X11
|
|||
const string Library = "libGL.so.1";
|
||||
static readonly object sync_root = new object();
|
||||
|
||||
// Disable BeforeFieldInit optimization.
|
||||
static Glx() { }
|
||||
static Glx()
|
||||
{
|
||||
// GLX entry points are not bound to a context.
|
||||
// This means we can load them without creating
|
||||
// a context first! (unlike WGL)
|
||||
// See
|
||||
// for more details.
|
||||
Debug.WriteLine("Loading GLX entry points.");
|
||||
new Glx().LoadEntryPoints();
|
||||
}
|
||||
|
||||
protected override object SyncRoot
|
||||
{
|
||||
get { return sync_root; }
|
||||
}
|
||||
|
||||
protected override IntPtr GetAddress (string funcname)
|
||||
protected override IntPtr GetAddress(string funcname)
|
||||
{
|
||||
return Glx.GetProcAddress(funcname);
|
||||
// We must use glXGetProcAddressARB, *not*
|
||||
// glXGetProcAddress. See comment on function
|
||||
// signature.
|
||||
return Glx.Arb.GetProcAddress(funcname);
|
||||
}
|
||||
|
||||
#if false
|
||||
|
|
Loading…
Reference in a new issue