daily update on 20240207 by nitload youmu

This commit is contained in:
Nitload
2024-02-07 13:47:12 +08:00
parent 8548757bbf
commit 6fe6b3b3cf
37 changed files with 231 additions and 196 deletions
+37 -48
View File
@@ -67,40 +67,39 @@ namespace StgSharp.Graphics
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.BindBuffer(BufferType bufferType, uint index)
void IglFunc.BindBuffer(BufferType bufferType, glHandle handle)
{
paramQueue.Enqueue((uint)bufferType, index);
glActionQueue.Enqueue(BindBufferPtr
);
M128 m = default;
m.UInt32[0] = (uint)bufferType;
m.IntPtr1 = handle.Handle;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(BindBufferPtr);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.BindTexture(uint type, uint texture)
{
glActionQueue.Enqueue(
() => api->glBindTexture((uint)type, texture)
);
paramQueue.Enqueue(type, texture);
glActionQueue.Enqueue(BindTexturePtr);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.BindVertexArray(uint index)
void IglFunc.BindVertexArray(glHandle index)
{
glActionQueue.Enqueue(
() => api->glBindVertexArray((uint)index)
);
paramQueue.Enqueue(index);
glActionQueue.Enqueue(BindVertexArrayPtr);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.Clear(MaskBufferBit mask)
{
glActionQueue.Enqueue(
() => api->glClear((uint)mask)
);
glActionQueue.Enqueue(ClearPtr);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
void IglFunc.ClearColor(float R, float G, float B, float A)
{
paramQueue.Enqueue(R, G, B, A);
glActionQueue.Enqueue(ClearColorPtr);
}
@@ -138,21 +137,22 @@ namespace StgSharp.Graphics
[MethodImpl(MethodImplOptions.AggressiveInlining)]
glHandle IglFunc.CreateProgram()
{
glHandle h = new glHandle(1);
glActionQueue.Enqueue(
() =>
{
int ret = (int)api->glCreateProgram();
Interlocked.Add(ref id, ret + 1);
}
);
glHandle h = glHandle.Alloc(1);
paramQueue.Enqueue(h);
glActionQueue.Enqueue(CreateProgramPtr);
return h;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
glHandleSet IglFunc.CreateProgram(int count)
{
throw new NotImplementedException();
M128 m = default;
glHandleSet h = new glHandleSet(count);
m.IntPtr0 = (IntPtr)h.handle;
m.Int32[2] = count;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(CreateProgramSetPtr);
return h;
}
IntPtr IglFunc.CreateWindowHandle(int width, int height, string tittle, IntPtr monitor, Form share)
@@ -184,42 +184,31 @@ namespace StgSharp.Graphics
[MethodImpl(MethodImplOptions.AggressiveInlining)]
glHandle IglFunc.CreatGraphicProgram()
{
glHandle h = new glHandle(1);
glActionQueue.Enqueue(
() =>
{
Interlocked.Add(ref id, (int)(api->glCreateProgram() + 1));
}
);
glHandle h = glHandle.Alloc(1);
paramQueue.Enqueue(h);
glActionQueue.Enqueue(CreateProgramPtr);
return h;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
unsafe void IglFunc.DeleteBuffer(uint handle)
unsafe void IglFunc.DeleteBuffer(glHandle handle)
{
glActionQueue.Enqueue(
() =>
{
uint target = handle;
api->glDeleteBuffers(1, &target);
}
);
M128 m = new M128() { IntPtr0 = handle.Handle };
m.UInt32[2] = 1;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(DeleBufferPtr);
}
unsafe void IglFunc.DeleteBuffers(glHandleSet handle)
{
glActionQueue.Enqueue(
() =>
{
uint[] h = handle;
fixed (uint* p = h)
{
api->glDeleteBuffers(count, p);
}
}
);
M128 m = default;
m.UInt32[2] = (uint)handle.length;
m.IntPtr0 = (IntPtr)handle.handle;
paramQueue.Enqueue(m);
glActionQueue.Enqueue(DeleBufferPtr);
}
//TODO: 从这里开始
unsafe void IglFunc.DeleteVertexArrays(glHandleSet arrays)
{
glActionQueue.Enqueue(