c-o
This commit is contained in:
@@ -1,452 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="ArrayList.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Graphics;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Logic
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Size = 8)]
|
||||
internal struct LogSeperator
|
||||
{
|
||||
|
||||
[FieldOffset(0)] public ulong all;
|
||||
[FieldOffset(0)] public long all_s;
|
||||
[FieldOffset(4)] public uint high;
|
||||
[FieldOffset(4)] public int high_s;
|
||||
|
||||
[FieldOffset(0)] public uint low;
|
||||
|
||||
[FieldOffset(0)] public int low_s;
|
||||
|
||||
public LogSeperator(uint high, uint low)
|
||||
{
|
||||
this.high = high;
|
||||
this.low = low;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A linear data structure with dynamic length.
|
||||
/// It contains a <see cref="List{T}"/> of <see cref="Array"/>,
|
||||
/// each <see cref="Array"/> is twice longer than the former one.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class DynamicArrayList<T>
|
||||
{
|
||||
|
||||
private List<T[]> arrayIndexList;
|
||||
private LogSeperator indexpair;
|
||||
private int lastMain = 0;
|
||||
|
||||
// main index to the last used element
|
||||
private int lastSub = 0;
|
||||
|
||||
private int length;
|
||||
private int subLength = 1;
|
||||
|
||||
// sub index to the last used element
|
||||
private Queue<int> unusedMainIndex;
|
||||
|
||||
private Queue<int> unusedSubIndex;
|
||||
|
||||
public DynamicArrayList()
|
||||
{
|
||||
arrayIndexList = [new T[1]];
|
||||
length = 0;
|
||||
unusedMainIndex = new Queue<int>();
|
||||
unusedSubIndex = new Queue<int>();
|
||||
unusedMainIndex.Enqueue(0);
|
||||
unusedSubIndex.Enqueue(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init a <see cref="DynamicArrayList{T}"/> with a certain amount of elements prepared.
|
||||
/// </summary>
|
||||
/// <param name="count">Amount of elements to be prepared.</param>
|
||||
public DynamicArrayList(int count)
|
||||
{
|
||||
arrayIndexList = new List<T[]>();
|
||||
length = count;
|
||||
unusedMainIndex = new();
|
||||
unusedSubIndex = new();
|
||||
|
||||
SeprateIndex(count);
|
||||
int subcount = 1;
|
||||
for (int i = 0; i < indexpair.high_s; i++)
|
||||
{
|
||||
arrayIndexList.Add(new T[count]);
|
||||
for (int j = 0; j < subcount; j++)
|
||||
{
|
||||
unusedMainIndex.Enqueue(i);
|
||||
unusedSubIndex.Enqueue(j);
|
||||
}
|
||||
count >>= 1;
|
||||
}
|
||||
if (indexpair.low_s != 0)
|
||||
{
|
||||
arrayIndexList.Add(new T[1 >> indexpair.high_s]);
|
||||
for (int j = 0; j < indexpair.high_s; j++)
|
||||
{
|
||||
unusedMainIndex.Enqueue(indexpair.high_s);
|
||||
unusedSubIndex.Enqueue(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new instance of <see cref="DynamicArrayList{T}"/>,
|
||||
/// and fill the begining ones of elemtns as given instance.
|
||||
/// </summary>
|
||||
/// <param name="count">Amount of beginning elements to be filled</param>
|
||||
/// <param name="instace"></param>
|
||||
public DynamicArrayList(int count, T instace)
|
||||
{
|
||||
arrayIndexList = new List<T[]>();
|
||||
length = count;
|
||||
unusedMainIndex = new();
|
||||
unusedSubIndex = new();
|
||||
|
||||
SeprateIndex(count);
|
||||
int subcount = 1;
|
||||
for (int i = 0; i < indexpair.high_s; i++)
|
||||
{
|
||||
arrayIndexList.Add(new T[count]);
|
||||
for (int j = 0; j < subcount; j++)
|
||||
{
|
||||
unusedMainIndex.Enqueue(i);
|
||||
unusedSubIndex.Enqueue(j);
|
||||
}
|
||||
count >>= 1;
|
||||
}
|
||||
if (indexpair.low_s != 0)
|
||||
{
|
||||
arrayIndexList.Add(new T[1 >> indexpair.high_s]);
|
||||
for (int j = 0; j < indexpair.high_s; j++)
|
||||
{
|
||||
unusedMainIndex.Enqueue(indexpair.high_s);
|
||||
unusedSubIndex.Enqueue(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal T this[long index]
|
||||
{
|
||||
get
|
||||
{
|
||||
indexpair.all_s = index;
|
||||
if (
|
||||
(indexpair.low_s > lastSub) ||
|
||||
(indexpair.high_s > lastMain) ||
|
||||
(indexpair.low_s < 0) ||
|
||||
(indexpair.high_s < 0))
|
||||
{
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
return arrayIndexList[indexpair.high_s][indexpair.low_s];
|
||||
}
|
||||
set
|
||||
{
|
||||
indexpair.all_s = index;
|
||||
if (
|
||||
(indexpair.low_s > lastSub) ||
|
||||
(indexpair.high_s > lastMain) ||
|
||||
(indexpair.low_s < 0) ||
|
||||
(indexpair.high_s < 0))
|
||||
{
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
arrayIndexList[indexpair.high_s][indexpair.low_s] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public T this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((index + 1 > length) || (index < 0))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
SeprateIndex(index);
|
||||
return arrayIndexList[indexpair.high_s][indexpair.low_s];
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((index + 1 > length) || (index < 0))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
SeprateIndex(index);
|
||||
arrayIndexList[indexpair.high_s][indexpair.low_s] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public T this[uint index]
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((index + 1 > length) || (index < 0))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
SeprateIndex(index);
|
||||
return arrayIndexList[indexpair.high_s][indexpair.low_s];
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((index + 1 > length) || (index < 0))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
SeprateIndex(index);
|
||||
arrayIndexList[indexpair.high_s][indexpair.low_s] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Count => length;
|
||||
|
||||
/// <summary>
|
||||
/// Length of this <see cref="DynamicArrayList{T}"/>
|
||||
/// </summary>
|
||||
public int Length => length;
|
||||
|
||||
public int Add(T item)
|
||||
{
|
||||
// this list is tite, all item is side by side
|
||||
if (unusedMainIndex.Count == 0)
|
||||
{
|
||||
// no extra space, a new sub array is needed
|
||||
if (lastSub + 1 == 1 << lastMain)
|
||||
{
|
||||
subLength <<= 1;
|
||||
arrayIndexList.Add(new T[subLength]);
|
||||
lastMain++;
|
||||
lastSub = 0;
|
||||
arrayIndexList[lastMain][0] = item;
|
||||
|
||||
length++;
|
||||
subLength = 1;
|
||||
return length - 1;
|
||||
}
|
||||
|
||||
length++;
|
||||
lastSub++;
|
||||
arrayIndexList[lastMain][lastSub] = item;
|
||||
subLength = 1;
|
||||
return length - 1;
|
||||
}
|
||||
|
||||
length++;
|
||||
int main = unusedMainIndex.Dequeue();
|
||||
int sub = unusedSubIndex.Dequeue();
|
||||
arrayIndexList[main][sub] = item;
|
||||
|
||||
subLength = 1;
|
||||
return sub + (1 << main);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
arrayIndexList.Clear();
|
||||
arrayIndexList.Add(new T[1]);
|
||||
unusedMainIndex.Clear();
|
||||
unusedSubIndex.Clear();
|
||||
length = 0;
|
||||
unusedMainIndex.Enqueue(0);
|
||||
unusedSubIndex.Enqueue(0);
|
||||
}
|
||||
|
||||
public bool Contains(T item)
|
||||
{
|
||||
foreach (T[] list in arrayIndexList)
|
||||
{
|
||||
foreach (T i in list)
|
||||
{
|
||||
if (i.Equals(item))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void CopyTo(DynamicArrayList<T> target)
|
||||
{
|
||||
target.arrayIndexList.Clear();
|
||||
int length = 1;
|
||||
foreach (T[] tList in target.arrayIndexList)
|
||||
{
|
||||
T[] newIndex = new T[length];
|
||||
Buffer.BlockCopy(tList, 0, newIndex, 0, length);
|
||||
target.arrayIndexList.Add(newIndex);
|
||||
length <<= 1;
|
||||
}
|
||||
|
||||
target.lastMain = lastMain;
|
||||
target.lastSub = lastSub;
|
||||
target.length = length;
|
||||
target.unusedMainIndex = new Queue<int>(unusedMainIndex.ToArray());
|
||||
target.unusedSubIndex = new Queue<int>(unusedSubIndex.ToArray());
|
||||
}
|
||||
|
||||
public int IndexOf(T item)
|
||||
{
|
||||
int index = 1;
|
||||
foreach (T[] list in arrayIndexList)
|
||||
{
|
||||
int subindex = 0;
|
||||
foreach (T i in list)
|
||||
{
|
||||
if (i.Equals(item))
|
||||
{
|
||||
return (index + subindex) - 1;
|
||||
}
|
||||
subindex++;
|
||||
}
|
||||
index <<= 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
[Obsolete("This method is not same, you may read data form an empty index.", false)]
|
||||
public bool Remove(T item)
|
||||
{
|
||||
int index = 0;
|
||||
foreach (T[] list in arrayIndexList)
|
||||
{
|
||||
int subindex = 0;
|
||||
foreach (T i in list)
|
||||
{
|
||||
if (i.Equals(item))
|
||||
{
|
||||
list[subindex] = default;
|
||||
if ((subindex == lastSub) && (index == lastMain))
|
||||
{
|
||||
if (lastSub == 0)
|
||||
{
|
||||
lastMain = (lastMain == 0) ? 0 : (lastMain - 1);
|
||||
lastSub = arrayIndexList[lastMain].Length - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastSub--;
|
||||
}
|
||||
length--;
|
||||
return true;
|
||||
}
|
||||
unusedMainIndex.Enqueue(index);
|
||||
unusedSubIndex.Enqueue(subindex);
|
||||
return true;
|
||||
}
|
||||
subindex++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
[Obsolete("This method is not same, you may read data form an empty index.", false)]
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
if ((index > length) || (index < 0))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
}
|
||||
SeprateIndex(index);
|
||||
|
||||
//the last element was removed.
|
||||
if (index + 1 == length)
|
||||
{
|
||||
//the last array can be disposed
|
||||
if (lastSub == 0)
|
||||
{
|
||||
arrayIndexList.RemoveAt(lastMain);
|
||||
lastMain--;
|
||||
lastSub = (length / 2) - 1;
|
||||
}
|
||||
length--;
|
||||
return;
|
||||
}
|
||||
|
||||
unusedMainIndex.Enqueue(indexpair.high_s);
|
||||
unusedSubIndex.Enqueue(indexpair.low_s);
|
||||
}
|
||||
|
||||
public void ShowStructure()
|
||||
{
|
||||
foreach (T[] l in arrayIndexList)
|
||||
{
|
||||
foreach (T item in l)
|
||||
{
|
||||
Console.Write($"{item}\t");
|
||||
}
|
||||
Console.Write("\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
private void SeprateIndex(uint ulongIndex)
|
||||
{
|
||||
indexpair.high = ulongIndex;
|
||||
int mainindex = 0;
|
||||
while (indexpair.high > 1)
|
||||
{
|
||||
indexpair.all >>= 1;
|
||||
mainindex++;
|
||||
}
|
||||
indexpair.high_s = mainindex;
|
||||
indexpair.low >>= 32 - mainindex;
|
||||
}
|
||||
|
||||
private void SeprateIndex(int longIndex)
|
||||
{
|
||||
indexpair.high_s = longIndex;
|
||||
int mainindex = 0;
|
||||
while (indexpair.high > 1)
|
||||
{
|
||||
indexpair.all >>= 1;
|
||||
mainindex++;
|
||||
}
|
||||
indexpair.high_s = mainindex;
|
||||
indexpair.low >>= 32 - mainindex;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="BluePaint.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Logic;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharpDebug.Logic
|
||||
{
|
||||
public class BluePaint
|
||||
{
|
||||
|
||||
private bool running;
|
||||
private List<BluePaintNode> allNode;
|
||||
|
||||
private BluePaintNode beginNode;
|
||||
|
||||
public bool IsRunning
|
||||
{
|
||||
get => running; set => running = value;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
foreach (var pipeline in beginNode.OutputInterface)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="BluePaintNode.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharpDebug.Logic;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Logic
|
||||
{
|
||||
public delegate void BluePaintNodeAction(
|
||||
in Dictionary<string, BluePaintPipeline> inpput,
|
||||
in Dictionary<string, BluePaintPipeline> output);
|
||||
|
||||
public abstract class BluePaintNode
|
||||
{
|
||||
private BluePaintNodeAction mainOperation;
|
||||
|
||||
private BluePaint local;
|
||||
|
||||
private Dictionary<string, BluePaintPipeline> inputInterfaces;
|
||||
private Dictionary<string, BluePaintPipeline> outputInterface;
|
||||
|
||||
private bool running;
|
||||
|
||||
private string name;
|
||||
|
||||
internal Dictionary<string, BluePaintPipeline> InputInterfaces => inputInterfaces;
|
||||
internal Dictionary<string, BluePaintPipeline> OutputInterface => outputInterface;
|
||||
|
||||
internal BluePaintNode(string name, bool isTaskSurvival)
|
||||
{
|
||||
this.name = name;
|
||||
SurvivalTask = isTaskSurvival;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected BluePaintNode(string name, BluePaintNodeAction operation)
|
||||
{
|
||||
this.name = name;
|
||||
mainOperation = operation;
|
||||
}
|
||||
|
||||
internal bool SurvivalTask
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
foreach (var item in inputInterfaces)
|
||||
{
|
||||
item.Value.WaitForStart();
|
||||
}
|
||||
mainOperation(in inputInterfaces, in outputInterface);
|
||||
}//--------------------------------- end of class -----------------------------
|
||||
}
|
||||
|
||||
public class BluePaintPipeline
|
||||
{
|
||||
|
||||
private SemaphoreSlim formerCompleteSemaphore;
|
||||
|
||||
private BluePaintPipelineArgs args;
|
||||
|
||||
public BluePaintPipeline()
|
||||
{
|
||||
formerCompleteSemaphore = new SemaphoreSlim(initialCount: 0,maxCount:1);
|
||||
}
|
||||
|
||||
public void CompleteAndWriteData(BluePaintPipelineArgs args)
|
||||
{
|
||||
formerCompleteSemaphore.Release();
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public void WaitForStart()
|
||||
{
|
||||
formerCompleteSemaphore.Release();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public abstract class BluePaintPipelineArgs
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="Blueprint.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp;
|
||||
using StgSharp.Logic;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharpDebug.Logic
|
||||
{
|
||||
public class Blueprint
|
||||
{
|
||||
|
||||
private BlueprintNode beginNode;
|
||||
private Dictionary<string, BlueprintNode> allNode;
|
||||
private Func<bool> terminate;
|
||||
|
||||
private int currentNodeIndex = 0;
|
||||
private List<Task> allThread;
|
||||
private List<BlueprintNode> nativeNodeList;
|
||||
private List<BlueprintNode> nodeList;
|
||||
|
||||
public Blueprint()
|
||||
{
|
||||
allThread = new List<Task>();
|
||||
nodeList = new List<BlueprintNode>();
|
||||
nativeNodeList = new List<BlueprintNode>();
|
||||
terminate = () => false;
|
||||
}
|
||||
|
||||
public bool IsRunning => allThread.Any(t => t.Status == TaskStatus.Running);
|
||||
|
||||
public void Init(int threadCount)
|
||||
{
|
||||
foreach (var item in allNode)
|
||||
{
|
||||
if (item.Value.IsNative)
|
||||
{
|
||||
nativeNodeList.Add(item.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeList.Add(item.Value);
|
||||
}
|
||||
}
|
||||
nativeNodeList.Sort();
|
||||
nodeList.Sort();
|
||||
if (threadCount > nodeList.Count)
|
||||
{
|
||||
InternalIO.InternalWriteLog(
|
||||
"Thread setting error: amount of threads of this blueprint is larger than amount of nodes.", LogType.Warning);
|
||||
threadCount = nodeList.Count;
|
||||
}
|
||||
for (int i = 0; i < threadCount; i++)
|
||||
{
|
||||
allThread.Add(new Task(
|
||||
|
||||
() =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
RequestNextNode().Run();
|
||||
}
|
||||
}
|
||||
catch (NodeClearException) { }
|
||||
if (terminate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run all nodes in current blueprint once.
|
||||
/// </summary>
|
||||
public void Run()
|
||||
{
|
||||
foreach (var t in allThread)
|
||||
{
|
||||
t.Start();
|
||||
}
|
||||
foreach (var node in nativeNodeList)
|
||||
{
|
||||
node.Run();
|
||||
}
|
||||
Task.WaitAll(allThread.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run all nodes repeatedly until it is instructed to terminate.
|
||||
/// </summary>
|
||||
/// <param name="terminateInstructor">Instructor to terminate all tasks. Returns <see langword="true"/> if tasks should terminate</param>
|
||||
public void RunRepeatedly(Func<bool> terminateInstructor)
|
||||
{
|
||||
terminate = terminateInstructor;
|
||||
foreach (var t in allThread)
|
||||
{
|
||||
t.Start();
|
||||
}
|
||||
foreach (var node in nativeNodeList)
|
||||
{
|
||||
node.Run();
|
||||
}
|
||||
foreach (var node in nativeNodeList)
|
||||
{
|
||||
node.Run();
|
||||
}
|
||||
}
|
||||
|
||||
private BlueprintNode RequestNextNode()
|
||||
{
|
||||
if (currentNodeIndex < nodeList.Count)
|
||||
{
|
||||
BlueprintNode ret = nodeList[currentNodeIndex];
|
||||
Interlocked.Increment(ref currentNodeIndex);
|
||||
return ret;
|
||||
}
|
||||
throw new NodeClearException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal class NodeClearException : Exception
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="BlueprintNode.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharpDebug.Logic;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Logic
|
||||
{
|
||||
public delegate void BlueprintNodeAction(
|
||||
in Dictionary<string, BlueprintPipeline> inpput,
|
||||
in Dictionary<string, BlueprintPipeline> output);
|
||||
|
||||
public abstract class BlueprintNode:IComparable<BlueprintNode>
|
||||
{
|
||||
|
||||
private Blueprint local;
|
||||
private BlueprintNodeAction mainOperation;
|
||||
|
||||
private bool levelAvailabel, nativeRequested;
|
||||
|
||||
private Dictionary<string, BlueprintPipeline> inputInterfaces;
|
||||
private Dictionary<string, BlueprintPipeline> outputInterface;
|
||||
private int level;
|
||||
private string name;
|
||||
|
||||
protected BlueprintNode(string name, BlueprintNodeAction operation)
|
||||
{
|
||||
this.levelAvailabel = false;
|
||||
this.name = name;
|
||||
mainOperation = operation;
|
||||
inputInterfaces = new Dictionary<string, BlueprintPipeline>();
|
||||
outputInterface = new Dictionary<string, BlueprintPipeline>();
|
||||
}
|
||||
|
||||
internal BlueprintNode(string name, bool isNative)
|
||||
{
|
||||
this.levelAvailabel = false;
|
||||
this.name = name;
|
||||
nativeRequested = isNative;
|
||||
inputInterfaces = new Dictionary<string, BlueprintPipeline>();
|
||||
outputInterface = new Dictionary<string, BlueprintPipeline>();
|
||||
}
|
||||
|
||||
public bool IsNative => nativeRequested;
|
||||
|
||||
public int Level
|
||||
{
|
||||
get
|
||||
{
|
||||
if (levelAvailabel)
|
||||
{
|
||||
return level;
|
||||
}
|
||||
level = 0;
|
||||
foreach (var item in inputInterfaces)
|
||||
{
|
||||
if (level <= item.Value.Level)
|
||||
{
|
||||
level = item.Value.Level;
|
||||
}
|
||||
}
|
||||
level += 1;
|
||||
return level;
|
||||
}
|
||||
}
|
||||
|
||||
internal Dictionary<string, BlueprintPipeline> InputInterfaces => inputInterfaces;
|
||||
internal Dictionary<string, BlueprintPipeline> OutputInterface => outputInterface;
|
||||
|
||||
|
||||
public void AddAfter(
|
||||
BlueprintNode former,
|
||||
string formerOutputPortName,
|
||||
string thisInputPortName)
|
||||
{
|
||||
this.levelAvailabel = false;
|
||||
BlueprintPipeline pipeline = new BlueprintPipeline(former,this);
|
||||
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var item in inputInterfaces)
|
||||
{
|
||||
item.Value.WaitForStart();
|
||||
}
|
||||
mainOperation(in inputInterfaces, in outputInterface);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
int IComparable<BlueprintNode>.CompareTo(BlueprintNode other)
|
||||
{
|
||||
return this.Level.CompareTo(other.Level);
|
||||
}
|
||||
}//--------------------------------- end of class -----------------------------
|
||||
|
||||
public class BlueprintNodeRunException : Exception
|
||||
{
|
||||
private Exception realException;
|
||||
|
||||
public BlueprintNodeRunException(string message, Exception ex) : base(message, ex)
|
||||
{
|
||||
}
|
||||
|
||||
public BlueprintNodeRunException(Exception ex):base("",ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class BlueprintPipeline
|
||||
{
|
||||
|
||||
private BlueprintNode former;
|
||||
private BlueprintNode after;
|
||||
private BlueprintPipelineArgs args;
|
||||
private SemaphoreSlim formerCompleteSemaphore;
|
||||
|
||||
public BlueprintPipeline(BlueprintNode former, BlueprintNode after)
|
||||
{
|
||||
this.former = former;
|
||||
this.after = after;
|
||||
formerCompleteSemaphore = new SemaphoreSlim(initialCount: 0, maxCount: 1);
|
||||
}
|
||||
|
||||
public BlueprintNode Former => former;
|
||||
|
||||
public BlueprintNode After => after;
|
||||
|
||||
public int Level => former.Level;
|
||||
|
||||
public void CompleteAndWriteData(BlueprintPipelineArgs args)
|
||||
{
|
||||
formerCompleteSemaphore.Release();
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public void WaitForStart()
|
||||
{
|
||||
formerCompleteSemaphore.Release();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public abstract class BlueprintPipelineArgs
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="Control.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Entities;
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Math;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public partial class Control
|
||||
{
|
||||
|
||||
internal Line bottomBoader;
|
||||
internal Line leftBoader;
|
||||
internal Line rightBoader;
|
||||
internal Line topBoader;
|
||||
|
||||
public Line BottomBoarder => bottomBoader;
|
||||
|
||||
public Line LeftBoarder => leftBoader;
|
||||
public Line RightBoarder => rightBoader;
|
||||
public Line TopBoarder => topBoader;
|
||||
|
||||
|
||||
private void initContainers()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="LogicValue.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Logic
|
||||
{
|
||||
/// <summary>
|
||||
/// A pair of <see cref="bool"/> value
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 2)]
|
||||
public struct Bool2
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The first <see cref="bool"/> value.
|
||||
/// </summary>
|
||||
[FieldOffset(0)] public bool bool0;
|
||||
|
||||
/// <summary>
|
||||
/// The second <see cref="bool"/> value.
|
||||
/// </summary>
|
||||
[FieldOffset(1)] public bool bool1;
|
||||
|
||||
[FieldOffset(0)] public byte byte0;
|
||||
|
||||
[FieldOffset(1)] public bool byte1;
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="ushort"/> value.
|
||||
/// The lower byte is <see cref="bool0"/>,
|
||||
/// and higher byte is <see cref="bool1"/>.
|
||||
/// </summary>
|
||||
[FieldOffset(0)] public ushort Value;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,469 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="glParamQueue.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Data;
|
||||
using StgSharp.Graphics;
|
||||
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;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Logic
|
||||
{
|
||||
internal unsafe class GLparamQueue
|
||||
{
|
||||
|
||||
private ConcurrentQueue<M128> paramQueue;
|
||||
private ConcurrentQueue<glArrayHandle> streamQueue;
|
||||
internal GLcontext* context;
|
||||
|
||||
public GLparamQueue()
|
||||
{
|
||||
paramQueue = new ConcurrentQueue<M128>();
|
||||
streamQueue = new ConcurrentQueue<glArrayHandle>();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(vec4d v)
|
||||
{
|
||||
paramQueue.Enqueue(v);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(M128 m)
|
||||
{
|
||||
paramQueue.Enqueue(m);
|
||||
Console.WriteLine(paramQueue.Count + streamQueue.Count);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(uint u0)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<uint>(0, u0);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(IntPtr p)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<ulong>(0, (ulong)p);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(glHandle handle)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<ulong>(0, (ulong)handle.valuePtr);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(int i0)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<int>(0, i0);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(string str)
|
||||
{
|
||||
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 Enqueue(uint u0, uint u1)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<uint>(0, u0);
|
||||
m.Write<uint>(1, u1);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(ulong u0, ulong u1)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<ulong>(0, u0);
|
||||
m.Write<ulong>(1, u1);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(IntPtr p0, IntPtr p1)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<ulong>(0, (ulong)p0);
|
||||
m.Write<ulong>(1, (ulong)p1);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(glHandle handle, glHandle handle1)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<ulong>(0, (ulong)handle.valuePtr);
|
||||
m.Write<ulong>(1, (ulong)handle1.valuePtr);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(int i0, int i1)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<int>(0, i0);
|
||||
m.Write<int>(1, i1);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(uint u0, uint u1, uint u2)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<uint>(0, u0);
|
||||
m.Write<uint>(1, u1);
|
||||
m.Write<uint>(2, u2);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(float f0, float f1, float f2)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<float>(0, f0);
|
||||
m.Write<float>(1, f1);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(int i0, int i1, int i2)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<int>(0, i0);
|
||||
m.Write<int>(1, i1);
|
||||
m.Write<int>(2, i2);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(float f0, float f1, float f2, float f3)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<float>(0, f0);
|
||||
m.Write<float>(1, f1);
|
||||
m.Write<float>(2, f2);
|
||||
m.Write<float>(3, f3);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Enqueue(int i0, int i1, int i2, int i3)
|
||||
{
|
||||
M128 m = default;
|
||||
m.Write<int>(0, i0);
|
||||
m.Write<int>(1, i1);
|
||||
m.Write<int>(2, i2);
|
||||
m.Write<int>(3, i3);
|
||||
this.Enqueue(m);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out glArrayHandle arrayHandle)
|
||||
{
|
||||
if (!streamQueue.TryDequeue(out arrayHandle))
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function:", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool TryDequeue(out M128 m)
|
||||
{
|
||||
bool ret = paramQueue.TryDequeue(out m);
|
||||
return ret;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out vec4d v)
|
||||
{
|
||||
M128 m;
|
||||
if (this.TryDequeue(out m))
|
||||
{
|
||||
v = *(vec4d*)&m;
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue<T>(out T[] array)
|
||||
{
|
||||
glArrayHandle output = default;
|
||||
if (streamQueue.TryDequeue(out output))
|
||||
{
|
||||
array = output.a as T[];
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out int i0)
|
||||
{
|
||||
M128 ret;
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
i0 = ret.Read<int>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out IntPtr p)
|
||||
{
|
||||
M128 ret;
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
p = (IntPtr)ret.Read<ulong>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out uint u0)
|
||||
{
|
||||
M128 ret;
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
u0 = ret.Read<uint>(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out int i0, out int i1)
|
||||
{
|
||||
M128 ret;
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
i0 = ret.Read<int>(0);
|
||||
i1 = ret.Read<int>(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out IntPtr p0, out IntPtr p1)
|
||||
{
|
||||
M128 ret;
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
p0 = (IntPtr)ret.Read<ulong>(0);
|
||||
p1 = (IntPtr)ret.Read<ulong>(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out uint u0, out uint u1)
|
||||
{
|
||||
M128 ret;
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
u0 = ret.Read<uint>(0);
|
||||
u1 = ret.Read<uint>(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out int i0, out int i1, out int i2)
|
||||
{
|
||||
M128 ret;
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
i0 = ret.Read<int>(0);
|
||||
i1 = ret.Read<int>(1);
|
||||
i2 = ret.Read<int>(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out float f0, out float f1, out float f2)
|
||||
{
|
||||
M128 ret;
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
f0 = ret.Read<uint>(0);
|
||||
f1 = ret.Read<uint>(1);
|
||||
f2 = ret.Read<uint>(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out uint u0, out uint u1, out uint u2)
|
||||
{
|
||||
M128 ret;
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
u0 = ret.Read<uint>(0);
|
||||
u1 = ret.Read<uint>(1);
|
||||
u2 = ret.Read<uint>(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out int i0, out int i1, out int i2, out int i3)
|
||||
{
|
||||
M128 ret;
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
i0 = ret.Read<int>(0);
|
||||
i1 = ret.Read<int>(1);
|
||||
i2 = ret.Read<int>(2);
|
||||
i3 = ret.Read<int>(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out float f0, out float f1, out float f2, out float f3)
|
||||
{
|
||||
M128 ret;
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
f0 = ret.Read<uint>(0);
|
||||
f1 = ret.Read<uint>(1);
|
||||
f2 = ret.Read<uint>(2);
|
||||
f3 = ret.Read<uint>(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void TryDequeue(out uint u0, out uint u1, out uint u2, out uint u3)
|
||||
{
|
||||
M128 ret;
|
||||
if (this.TryDequeue(out ret))
|
||||
{
|
||||
u0 = ret.Read<uint>(0);
|
||||
u1 = ret.Read<uint>(1);
|
||||
u2 = ret.Read<uint>(2);
|
||||
u3 = ret.Read<uint>(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("No param in buffer when calling gl function.", LogType.Error);
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
internal void SetContext(GLcontext* p)
|
||||
{
|
||||
context = p;
|
||||
}
|
||||
/**/
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user