daily update on 20240312 by nitload youmu

This commit is contained in:
YoumuLiu
2024-03-12 16:17:01 +08:00
parent 6a0cccae79
commit a770bbe685
62 changed files with 1080 additions and 2346 deletions
@@ -9,6 +9,7 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.Graphics
@@ -21,6 +22,7 @@ namespace StgSharp.Graphics
private IntPtr BindTexturePtr = (IntPtr)(delegate*<void>)&InternalBindTexture;
private IntPtr BindVertexArrayPtr = (IntPtr)(delegate*<void>)&InternalBindVertexArray;
private IntPtr BufferDataPtr = (IntPtr)(delegate*<void>)&InternalSetBufferData;
private IntPtr CanUpdatePtr = (IntPtr)(delegate*<void>)&InternalFrameCanUpdate;
private IntPtr ClearColorPtr = (IntPtr)(delegate*<void>)&InternalClearColor;
private IntPtr ClearGraphicErrorPtr = (IntPtr)(delegate*<void>)&InternalClearGraphicError;
private IntPtr ClearPtr = (IntPtr)(delegate*<void>)&InternalClear;
@@ -108,7 +110,6 @@ namespace StgSharp.Graphics
paramQueue.context->glCompileShader(*(uint*)handle);
}
//TODO
private static void InternalCreateProgram()
{
IntPtr programHandle = default;
@@ -144,6 +145,10 @@ namespace StgSharp.Graphics
M128 m = default;
paramQueue.TryDequeue(out m);
paramQueue.context->glDeleteBuffers(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
for (int i = 0; i < m.Read<uint>(2); i++)
{
*((uint*)m.Read<ulong>(0) + i) = 0;
}
}
private static void InternalDeleteVertexArrays()
@@ -162,6 +167,13 @@ namespace StgSharp.Graphics
paramQueue.context->glDrawElements(mode, count, type, (void*)ptr);
}
private static void InternalFrameCanUpdate()
{
IntPtr ptr;
paramQueue.TryDequeue(out ptr);
Interlocked.Add(ref *(int*)ptr, -1);
}
private static void InternalGenBuffers()
{
M128 m = default;
@@ -215,13 +227,11 @@ namespace StgSharp.Graphics
private static unsafe void InternalShaderSource()
{
IntPtr handle = default;
byte[] stream = Array.Empty<byte>();
glArrayHandle stream = default;
paramQueue.TryDequeue(out handle);
paramQueue.TryDequeue(out stream);
fixed (byte* sPtr = stream)
{
paramQueue.context->glShaderSource(*(uint*)handle, 1, &sPtr, (void*)0);
}
IntPtr buffer = stream.AddressOfArray();
paramQueue.context->glShaderSource(*(uint*)handle, 1, (byte**)&buffer, (void*)0);
}
private static void InternalTextureImage2d()