daily update on 20240326 by nitload youmu, removing old MT
This commit is contained in:
@@ -250,7 +250,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
m = new();
|
||||
bool ret = paramQueue.TryDequeue(out m);
|
||||
//Console.WriteLine(m.ToString(16));
|
||||
Console.WriteLine(m.ToString(16));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -494,17 +494,16 @@ namespace StgSharp.Graphics
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class FrameAsyncThread
|
||||
{
|
||||
|
||||
|
||||
protected Barrier _drawCompleteBarrier;
|
||||
|
||||
private Thread _task;
|
||||
private int _terminateToken;
|
||||
|
||||
protected Barrier _frameSpeedSyncBarrier;
|
||||
|
||||
|
||||
protected Barrier _spanCompleteBarrier;
|
||||
protected Action _taskTODO;
|
||||
internal FrameOperationBuffer opBuffer;
|
||||
|
||||
@@ -513,7 +512,7 @@ namespace StgSharp.Graphics
|
||||
_taskTODO = action;
|
||||
opBuffer = new FrameOperationBuffer(gl);
|
||||
_terminateToken = 1;
|
||||
_drawCompleteBarrier = new Barrier(2);
|
||||
_spanCompleteBarrier = new Barrier(2);
|
||||
}
|
||||
|
||||
public Action TaskTODO
|
||||
@@ -524,9 +523,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
|
||||
public Barrier TodoCompleteBarrier
|
||||
{
|
||||
get => _drawCompleteBarrier;
|
||||
}
|
||||
=> _spanCompleteBarrier;
|
||||
|
||||
public virtual void AsyncStart()
|
||||
{
|
||||
@@ -535,9 +532,9 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
while (_terminateToken != 0)
|
||||
{
|
||||
_taskTODO();
|
||||
_drawCompleteBarrier.SignalAndWait();
|
||||
_frameSpeedSyncBarrier.SignalAndWait();
|
||||
_taskTODO();
|
||||
_spanCompleteBarrier.SignalAndWait();
|
||||
}
|
||||
});
|
||||
_task.Start();
|
||||
@@ -595,21 +592,4 @@ namespace StgSharp.Graphics
|
||||
|
||||
}
|
||||
|
||||
internal sealed class AsyncRenderFrameTask : FrameAsyncThread
|
||||
{
|
||||
|
||||
|
||||
public AsyncRenderFrameTask(Form f) : base(null, f.gl)
|
||||
{
|
||||
TaskTODO = FrameOperation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void FrameOperation()
|
||||
{
|
||||
while (opBuffer.CallNext()) { }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user