daily update on 20240213 by nitload youmu. 逐步弃用GLFW,正在使用wgl重写glfw底层,相关实现转移到C#实现,SSC彻底变成线性代数计算器。

This commit is contained in:
Nitload
2024-02-13 23:42:22 +08:00
parent 8391569482
commit a2241a5a58
307 changed files with 16701 additions and 10296 deletions
+21 -11
View File
@@ -20,8 +20,15 @@ namespace StgSharp.Graphics
private static GLparamQueue paramQueue;
private FrameTimeoutException refreshSignal = new();
private GLcontext* api;
private IntPtr SwapBufferPtr = (IntPtr)(delegate*<IntPtr, void>)&InternalIO.glfwSwapBuffers;
GLcontext* IglFunc.Context
{
get => api;
}
internal GLonUpdate(GLcontext* context)
{
if (paramQueue == null)
@@ -29,6 +36,7 @@ namespace StgSharp.Graphics
paramQueue = new GLparamQueue();
}
glActionQueue = new ConcurrentQueue<IntPtr>();
api = context;
}
internal static GLparamQueue ParamQueue
@@ -78,7 +86,7 @@ namespace StgSharp.Graphics
{
M128 m = default;
m.UInt32[0] = (uint)bufferType;
m.IntPtr1 = handle.Handle;
m.UInt64[1] = (ulong)handle.Handle;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(BindBufferPtr);
}
@@ -86,7 +94,8 @@ namespace StgSharp.Graphics
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.BindTexture(uint type, glHandle texture)
{
M128 m = new M128 { IntPtr1 = (IntPtr)texture.valuePtr };
M128 m = default;
m.UInt64[1] = (ulong)texture.valuePtr;
m.UInt32[0] = (uint)type;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(BindTexturePtr);
@@ -150,7 +159,7 @@ namespace StgSharp.Graphics
{
M128 m = default;
glHandleSet h = new glHandleSet(count);
m.IntPtr0 = (IntPtr)h.handle;
m.UInt64[0] = (ulong)h.handle;
m.Int32[2] = count;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(CreateProgramSetPtr);
@@ -194,7 +203,8 @@ namespace StgSharp.Graphics
[MethodImpl(MethodImplOptions.AggressiveInlining)]
unsafe void IglFunc.DeleteBuffer(glHandle handle)
{
M128 m = new M128() { IntPtr0 = handle.Handle };
M128 m = default;
m.UInt64[0] = (ulong)handle.Handle;
m.UInt32[2] = 1;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(DeleBufferPtr);
@@ -204,14 +214,14 @@ namespace StgSharp.Graphics
{
M128 m = default;
m.UInt32[2] = (uint)handle.length;
m.IntPtr0 = (IntPtr)handle.handle;
m.UInt64[0] = (ulong)handle.handle;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(DeleBufferPtr);
}
unsafe void IglFunc.DeleteVertexArrays(glHandleSet arrays)
{
M128 m = new() { IntPtr1 = (IntPtr)arrays.handle };
M128 m = default; m.UInt64[1] = (ulong)arrays.handle;
m.Int32[0] = arrays.length;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(DeleteVertexArrayPtr);
@@ -246,7 +256,7 @@ namespace StgSharp.Graphics
unsafe glHandleSet IglFunc.GenBuffers(int count)
{
glHandleSet h = new glHandleSet(count);
M128 m = default; m.UInt32[2] = (uint)count; m.IntPtr0 = (IntPtr)h.handle;
M128 m = default; m.UInt32[2] = (uint)count; m.UInt64[0] = (ulong)h.handle;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(GenBufferPtr);
return h;
@@ -255,7 +265,7 @@ namespace StgSharp.Graphics
unsafe glHandleSet IglFunc.GenTextures(int count)
{
glHandleSet h = new glHandleSet(count);
M128 m = default; m.UInt32[2] = (uint)count; m.IntPtr0 = (IntPtr)h.handle;
M128 m = default; m.UInt32[2] = (uint)count; m.UInt64[0] = (ulong)h.handle;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(GenTexturesPtr);
return h;
@@ -264,7 +274,7 @@ namespace StgSharp.Graphics
unsafe glHandleSet IglFunc.GenVertexArrays(int count)
{
glHandleSet h = new glHandleSet(count);
M128 m = default; m.UInt32[2] = (uint)count; m.IntPtr0 = (IntPtr)h.handle;
M128 m = default; m.UInt32[2] = (uint)count; m.UInt64[0] = (ulong)h.handle;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(GenTexturesPtr);
return h;
@@ -275,8 +285,8 @@ namespace StgSharp.Graphics
{
glSHandle h = glSHandle.Alloc(0);
M128 m;
m.IntPtr0 = program.Handle;
m.IntPtr1 = GCHandle.Alloc(Encoding.UTF8.GetBytes(ptr)).AddrOfPinnedObject();
m.UInt64[0] = (ulong)program.Handle;
m.UInt64[1] = (ulong)GCHandle.Alloc(Encoding.UTF8.GetBytes(ptr)).AddrOfPinnedObject();
paramQueue.Enqueue(m);
paramQueue.Enqueue((IntPtr)h.valuePtr);
glActionQueue.Enqueue(GetUniformLocationPtr);