337 lines
9.8 KiB
C#
337 lines
9.8 KiB
C#
using StgSharp.Graphics;
|
|
using StgSharp.Math;
|
|
using System;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection.Metadata;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace StgSharp.Logic
|
|
{
|
|
|
|
internal unsafe class GLparamQueue
|
|
{
|
|
internal GLcontext* context;
|
|
private ConcurrentQueue<M128> paramQueue;
|
|
public GLparamQueue()
|
|
{
|
|
paramQueue = new ConcurrentQueue<M128>();
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Enqueue(Vec4d v)
|
|
{
|
|
paramQueue.Enqueue(v);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Enqueue(M128 m)
|
|
{
|
|
paramQueue.Enqueue(m);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Enqueue(uint u0)
|
|
{
|
|
M128 m = default;
|
|
m.UInt32[0] = u0;
|
|
paramQueue.Enqueue(m);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Enqueue(uint u0, uint u1)
|
|
{
|
|
M128 m = default;
|
|
m.UInt32[0] = u0;
|
|
m.UInt32[1] = u1;
|
|
paramQueue.Enqueue(m);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Enqueue(float f0, float f1, float f2, float f3)
|
|
{
|
|
M128 m = default;
|
|
m.Single[0] = f0;
|
|
m.Single[1] = f1;
|
|
m.Single[2] = f2;
|
|
m.Single[3] = f3;
|
|
paramQueue.Enqueue(m);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Enqueue(IntPtr p0, IntPtr p1)
|
|
{
|
|
M128 m = default;
|
|
m.IntPtr0 = p0;
|
|
m.IntPtr1 = p1;
|
|
paramQueue.Enqueue(m);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Enqueue(IntPtr p)
|
|
{
|
|
M128 m = default;
|
|
m.IntPtr0 = p;
|
|
paramQueue.Enqueue(m);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Enqueue(glHandle handle)
|
|
{
|
|
M128 m = default;
|
|
m.IntPtr0 = (IntPtr)handle.valuePtr;
|
|
paramQueue.Enqueue(m);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Enqueue(glHandle handle, glHandle handle1)
|
|
{
|
|
M128 m = default;
|
|
m.IntPtr0 = (IntPtr)handle.valuePtr;
|
|
m.IntPtr1 = (IntPtr)handle1.valuePtr;
|
|
paramQueue.Enqueue(m);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Enqueue(int i0)
|
|
{
|
|
M128 m = default;
|
|
m.Int32[0] = i0;
|
|
paramQueue.Enqueue(m);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Enqueue(int i0, int i1)
|
|
{
|
|
M128 m = default;
|
|
m.Int32[0] = i0;
|
|
m.Int32[1] = i1;
|
|
paramQueue.Enqueue(m);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Enqueue(int i0, int i1, int i2)
|
|
{
|
|
M128 m = default;
|
|
m.Int32[0] = i0;
|
|
m.Int32[1] = i1;
|
|
m.Int32[2] = i2;
|
|
paramQueue.Enqueue(m);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Enqueue(int i0, int i1, int i2, int i3)
|
|
{
|
|
M128 m = default;
|
|
m.Int32[0] = i0;
|
|
m.Int32[1] = i1;
|
|
m.Int32[2] = i2;
|
|
m.Int32[3] = i3;
|
|
paramQueue.Enqueue(m);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void TryDequeue(out M128 m)
|
|
{
|
|
paramQueue.TryDequeue(out m);
|
|
}
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void TryDequeue(out glHandle handle)
|
|
{
|
|
M128 ret;
|
|
if (paramQueue.TryDequeue(out ret))
|
|
{
|
|
handle.valuePtr = (uint*)ret.IntPtr0;
|
|
}
|
|
else
|
|
{
|
|
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
|
throw new Exception();
|
|
}
|
|
}
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void TryDequeue(out glHandle handle, out glHandle handle1)
|
|
{
|
|
M128 ret;
|
|
if (paramQueue.TryDequeue(out ret))
|
|
{
|
|
handle.valuePtr = (uint*)ret.IntPtr0;
|
|
handle1.valuePtr = (uint*)ret.IntPtr1;
|
|
}
|
|
else
|
|
{
|
|
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
|
throw new Exception();
|
|
}
|
|
}
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void TryDequeue(out int i0)
|
|
{
|
|
M128 ret;
|
|
if (paramQueue.TryDequeue(out ret))
|
|
{
|
|
i0 = ret.Int32[0];
|
|
}
|
|
else
|
|
{
|
|
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
|
throw new Exception();
|
|
}
|
|
}
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void TryDequeue(out int i0, out int i1)
|
|
{
|
|
M128 ret;
|
|
if (paramQueue.TryDequeue(out ret))
|
|
{
|
|
i0 = ret.Int32[0];
|
|
i1 = ret.Int32[1];
|
|
}
|
|
else
|
|
{
|
|
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
|
throw new Exception();
|
|
}
|
|
}
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void TryDequeue(out int i0, out int i1, out int i2)
|
|
{
|
|
M128 ret;
|
|
if (paramQueue.TryDequeue(out ret))
|
|
{
|
|
i0 = ret.Int32[0];
|
|
i1 = ret.Int32[1];
|
|
i2 = ret.Int32[2];
|
|
}
|
|
else
|
|
{
|
|
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
|
throw new Exception();
|
|
}
|
|
}
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void TryDequeue(out int i0, out int i1, out int i2, out int i3)
|
|
{
|
|
M128 ret;
|
|
if (paramQueue.TryDequeue(out ret))
|
|
{
|
|
i0 = ret.Int32[0];
|
|
i1 = ret.Int32[1];
|
|
i2 = ret.Int32[2];
|
|
i3 = ret.Int32[3];
|
|
}
|
|
else
|
|
{
|
|
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
|
throw new Exception();
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void TryDequeue(out glHandle handle)
|
|
{
|
|
M128 ret;
|
|
if (paramQueue.TryDequeue(out ret))
|
|
{
|
|
handle = ret.UInt32[0];
|
|
}
|
|
else
|
|
{
|
|
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
|
throw new Exception();
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void TryDequeue(out IntPtr p)
|
|
{
|
|
M128 ret;
|
|
if (paramQueue.TryDequeue(out ret))
|
|
{
|
|
p = ret.IntPtr0;
|
|
}
|
|
else
|
|
{
|
|
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
|
throw new Exception();
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void TryDequeue(out IntPtr p0, out IntPtr p1)
|
|
{
|
|
|
|
M128 ret;
|
|
if (paramQueue.TryDequeue(out ret))
|
|
{
|
|
p0 = ret.IntPtr0;
|
|
p1 = ret.IntPtr1;
|
|
}
|
|
else
|
|
{
|
|
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
|
throw new Exception();
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void TryDequeue(out float f0, out float f1, out float f2, out float f3)
|
|
{
|
|
M128 ret;
|
|
if (paramQueue.TryDequeue(out ret))
|
|
{
|
|
f0 = ret.UInt32[0];
|
|
f1 = ret.UInt32[1];
|
|
f2 = ret.UInt32[2];
|
|
f3 = ret.UInt32[3];
|
|
}
|
|
else
|
|
{
|
|
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
|
throw new Exception();
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void TryDequeue(out uint u0)
|
|
{
|
|
M128 ret;
|
|
if (paramQueue.TryDequeue(out ret))
|
|
{
|
|
u0 = ret.UInt32[0];
|
|
}
|
|
else
|
|
{
|
|
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
|
throw new Exception();
|
|
}
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void TryDequeue(out uint u0, out uint u1)
|
|
{
|
|
M128 ret;
|
|
if (paramQueue.TryDequeue(out ret))
|
|
{
|
|
u0 = ret.UInt32[0];
|
|
u1 = ret.UInt32[1];
|
|
}
|
|
else
|
|
{
|
|
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
|
throw new Exception();
|
|
}
|
|
}
|
|
|
|
internal void SetContext(GLcontext* p)
|
|
{
|
|
context = p;
|
|
}
|
|
}
|
|
|
|
}
|