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 -32
View File
@@ -4,6 +4,7 @@ using StgSharp.Math;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
@@ -15,8 +16,6 @@ namespace StgSharp.Logic
{
internal unsafe class GLparamQueue
{
private string _dequeueLog = "\n";
internal GLcontext* context;
private ConcurrentQueue<M128> paramQueue;
private ConcurrentQueue<glArrayHandle> streamQueue;
@@ -27,11 +26,6 @@ namespace StgSharp.Logic
streamQueue = new ConcurrentQueue<glArrayHandle>();
}
internal void ShowDequeueLog()
{
Console.WriteLine(_dequeueLog);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Enqueue(Vec4d v)
{
@@ -41,8 +35,8 @@ namespace StgSharp.Logic
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Enqueue(M128 m)
{
Console.WriteLine(m.ToString(10));
paramQueue.Enqueue(m);
Console.WriteLine(paramQueue.Count + streamQueue.Count);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -178,26 +172,22 @@ namespace StgSharp.Logic
{
byte[] code = Encoding.UTF8.GetBytes(str);
streamQueue.Enqueue(glArrayHandle.Alloc<byte>(code));
Console.WriteLine(paramQueue.Count + streamQueue.Count);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Enqueue<T>(T[] array) where T : struct
{
streamQueue.Enqueue(glArrayHandle.Alloc<T>(array));
Console.WriteLine(paramQueue.Count + streamQueue.Count);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TryDequeue(out glArrayHandle arrayHandle)
{
glArrayHandle handle = default;
if (streamQueue.TryDequeue(out handle))
if (!streamQueue.TryDequeue(out arrayHandle))
{
arrayHandle = handle;
}
else
{
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
InternalIO.InternalWriteLog("No param in buffer when calling gl function:", LogType.Error);
throw new Exception();
}
}
@@ -206,7 +196,6 @@ namespace StgSharp.Logic
public bool TryDequeue(out M128 m)
{
bool ret = paramQueue.TryDequeue(out m);
_dequeueLog += $"{m.ToString(10)}\n";
return ret;
}
@@ -231,7 +220,7 @@ namespace StgSharp.Logic
glArrayHandle output = default;
if (streamQueue.TryDequeue(out output))
{
array = output.copy as T[];
array = output.a as T[];
}
else
{
@@ -438,23 +427,11 @@ namespace StgSharp.Logic
}
}
/*
internal void SetContext(GLcontext* p)
{
context = p;
}
internal void TryDequeue(out Array array)
{
glArrayHandle output = default;
if (streamQueue.TryDequeue(out output))
{
array = output.copy;
}
else
{
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
throw new Exception();
}
}
/**/
}
}