mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 07:55:39 +00:00
[GLControl] Warn when accessing GL properties on non-current context
This commit is contained in:
parent
c9a86a63ab
commit
b9426006ef
|
@ -139,6 +139,15 @@ namespace OpenTK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Conditional("DEBUG")]
|
||||||
|
void ValidateContext(string message)
|
||||||
|
{
|
||||||
|
if (!Context.IsCurrent)
|
||||||
|
{
|
||||||
|
Debug.Print("[GLControl] Attempted to access {0} on a non-current context. Results undefined.", message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ValidateState()
|
void ValidateState()
|
||||||
{
|
{
|
||||||
if (IsDisposed)
|
if (IsDisposed)
|
||||||
|
@ -400,6 +409,7 @@ namespace OpenTK
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidateState();
|
ValidateState();
|
||||||
|
ValidateContext("VSync");
|
||||||
return Context.SwapInterval != 0;
|
return Context.SwapInterval != 0;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
|
@ -415,6 +425,7 @@ namespace OpenTK
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidateState();
|
ValidateState();
|
||||||
|
ValidateContext("VSync");
|
||||||
Context.SwapInterval = value ? 1 : 0;
|
Context.SwapInterval = value ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -468,6 +479,7 @@ namespace OpenTK
|
||||||
public Bitmap GrabScreenshot()
|
public Bitmap GrabScreenshot()
|
||||||
{
|
{
|
||||||
ValidateState();
|
ValidateState();
|
||||||
|
ValidateContext("GrabScreenshot()");
|
||||||
|
|
||||||
Bitmap bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
|
Bitmap bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
|
||||||
System.Drawing.Imaging.BitmapData data =
|
System.Drawing.Imaging.BitmapData data =
|
||||||
|
|
Loading…
Reference in a new issue