daily update on 20240305 by nitload youmu

This commit is contained in:
YoumuLiu
2024-03-05 10:17:02 +08:00
parent 1f2fca4c8f
commit 6a0cccae79
156 changed files with 23040 additions and 1385 deletions
+28 -1
View File
@@ -9,8 +9,35 @@ using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
namespace System
namespace StgSharp.Graphics
{
//TODO 发现一个大问题,paramQueue大多数时候取出的是数组,不是数组句柄,也就是说其内存将被长期固定且不能回收,这是内存泄漏
public unsafe class glArrayHandle
{
internal readonly Array copy;
internal GCHandle handle;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public IntPtr AddressOfArray()
{
return handle.AddrOfPinnedObject();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static glArrayHandle Alloc<T>(T[] array) where T : struct
{
Array copy = new T[array.Length];
array.CopyTo(copy, 0);
return new glArrayHandle(copy);
}
internal glArrayHandle(Array array)
{
copy = array;
handle = GCHandle.Alloc(array, GCHandleType.Pinned);
}
}
/// <summary>
/// A handle to an OpenGL object,
/// must be indexed from a <see cref="glHandleSet"/>.