mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-24 15:45:34 +00:00
Replace Wgl.GetCurrentDC with cached dc
with
This commit is contained in:
parent
b81aaf9a12
commit
ecd7db99c1
|
@ -29,6 +29,7 @@ namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
static readonly object LoadLock = new object();
|
static readonly object LoadLock = new object();
|
||||||
|
|
||||||
|
IntPtr device_context;
|
||||||
bool vsync_supported;
|
bool vsync_supported;
|
||||||
|
|
||||||
readonly WinGraphicsMode ModeSelector;
|
readonly WinGraphicsMode ModeSelector;
|
||||||
|
@ -210,7 +211,7 @@ namespace OpenTK.Platform.Windows
|
||||||
// side-effects (i.e. the old contexts can still be handled
|
// side-effects (i.e. the old contexts can still be handled
|
||||||
// using the new entry points.)
|
// using the new entry points.)
|
||||||
// Sigh...
|
// Sigh...
|
||||||
Wgl.MakeCurrent(window.DeviceContext, Handle.Handle);
|
MakeCurrent(window);
|
||||||
Wgl.LoadAll();
|
Wgl.LoadAll();
|
||||||
|
|
||||||
if (sharedContext != null)
|
if (sharedContext != null)
|
||||||
|
@ -284,11 +285,15 @@ namespace OpenTK.Platform.Windows
|
||||||
success = Wgl.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
|
success = Wgl.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
device_context = wnd.DeviceContext;
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
{
|
||||||
throw new GraphicsContextException(String.Format(
|
throw new GraphicsContextException(String.Format(
|
||||||
"Failed to make context {0} current. Error: {1}", this, Marshal.GetLastWin32Error()));
|
"Failed to make context {0} current. Error: {1}", this, Marshal.GetLastWin32Error()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -435,11 +440,10 @@ namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Wgl.GetCurrentDC();
|
return device_context;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue