Added thread-affinity checks to SDL2 renderer.
If a call is made into a graphics resource that has thread-affinity, from a thread other than the one that created the graphics device, an exception will now be thrown to make debugging easier.
This commit is contained in:
@@ -14,7 +14,7 @@ using OpenTK.Graphics.OpenGL;
|
||||
|
||||
namespace OpenRA.Platforms.Default
|
||||
{
|
||||
public sealed class VertexBuffer<T> : IVertexBuffer<T>
|
||||
sealed class VertexBuffer<T> : ThreadAffine, IVertexBuffer<T>
|
||||
where T : struct
|
||||
{
|
||||
static readonly int VertexSize = Marshal.SizeOf(typeof(T));
|
||||
@@ -60,6 +60,7 @@ namespace OpenRA.Platforms.Default
|
||||
|
||||
public void Bind()
|
||||
{
|
||||
VerifyThreadAffinity();
|
||||
GL.BindBuffer(BufferTarget.ArrayBuffer, buffer);
|
||||
ErrorHandler.CheckGlError();
|
||||
GL.VertexPointer(3, VertexPointerType.Float, VertexSize, IntPtr.Zero);
|
||||
|
||||
Reference in New Issue
Block a user