move random gen to Math, working on VL4

This commit is contained in:
Nitload
2026-03-02 23:56:21 +08:00
parent 7e3ed8b0fd
commit ae1a49d6fb
63 changed files with 6463 additions and 6970 deletions
+7 -22
View File
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="HlsfAllocatorBench"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -26,7 +26,7 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using BenchmarkDotNet.Attributes;
using StgSharp.HighPerformance.Memory;
using StgSharp.Mathematics.Memory;
using System.Runtime.InteropServices;
namespace StgSharp.Benchmark
@@ -40,15 +40,7 @@ namespace StgSharp.Benchmark
private const int AllocationCount = 2048;
private static readonly int[] AllocSizes = [
64,
96,
150,
200,
400,
1024,
4096
];
private static readonly int[] AllocSizes = [64, 96, 150, 200, 400, 1024, 4096];
private HybridLayerSegregatedFitAllocator _hlsfAllocator = null!;
private readonly List<HybridLayerSegregatedFitAllocationHandle> _hlsfLocalList = new();
private readonly List<nint> _libcLocalList = new();
@@ -104,9 +96,7 @@ namespace StgSharp.Benchmark
_hlsfAllocator = new HybridLayerSegregatedFitAllocator(GetArenaBytes(), align:(int)Alignment);
}
private static uint AlignSize(
uint size
)
private static uint AlignSize(uint size)
{
uint mask = Alignment - 1;
return (size + mask) & ~mask;
@@ -119,9 +109,7 @@ namespace StgSharp.Benchmark
int mb = defaultMb;
string? env = Environment.GetEnvironmentVariable("HLSF_BENCH_ARENA_MB");
if (!string.IsNullOrWhiteSpace(env) &&
int.TryParse(env, out int parsed) &&
parsed >= minMb) {
if (!string.IsNullOrWhiteSpace(env) && int.TryParse(env, out int parsed) && parsed >= minMb) {
mb = parsed;
}
@@ -130,10 +118,7 @@ namespace StgSharp.Benchmark
private uint GetNextRandomSize() => (uint)AllocSizes[_random.Next(AllocSizes.Length)];
private void RunHlsf(
HybridLayerSegregatedFitAllocator allocator,
FreePolicy policy
)
private void RunHlsf(HybridLayerSegregatedFitAllocator allocator, FreePolicy policy)
{
_hlsfLocalList.Clear();
-91
View File
@@ -1,91 +0,0 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ValueBox"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. 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.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Data
{
public interface IValueBox
{
ref object ValueReference { get; }
static virtual IValueBox<T> AsGeneric<T>(IValueBox box) where T: unmanaged
{
if (box is not IValueBox<T> genericBox) {
return null;
}
return genericBox;
}
static virtual bool IsGeneric<T>(IValueBox box) where T: unmanaged
{
return box is IValueBox<T>;
}
}
public interface IValueBox<T> where T: unmanaged
{
T Value { get; set; }
}
/// <summary>
/// A class attempt to reduce cost of boxing, though still a bit slower than direct access to
/// _origin value type instance.
/// </summary>
/// <typeparam name="T">
/// Type of instance to be boxed.
/// </typeparam>
public class ValueBox<T> : IValueBox, IValueBox<T> where T: unmanaged
{
private T _value;
public ValueBox(T value)
{
_value = value;
}
public ref object ValueReference => ref Unsafe.As<T, object>(ref _value);
public T Value
{
get => _value;
set => _value = value;
}
}
}
-68
View File
@@ -1,68 +0,0 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Lable"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. 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.Runtime.CompilerServices;
namespace StgSharp.HighPerformance
{
public class DataLabel
{
public DataLabel(string labelName)
{
Name = labelName;
}
public string Name
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
init;
}
public override unsafe int GetHashCode()
{
ReadOnlySpan<char> nameSpan = Name.AsSpan();
fixed (char* cptr = nameSpan) {
return NativeIntrinsic.Context.city_hash_simplify(cptr, Name.Length);
}
}
}
public static class DataLabelBuilder
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static DataLabel AsLabel(this string name)
{
return new DataLabel(name);
}
}
}
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="BufferStack"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -29,10 +29,10 @@ using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
[CollectionBuilder(typeof(BufferStackBuilder), nameof(BufferStackBuilder.Create))]
public unsafe class BufferStack<T> : IDisposable where T : unmanaged
public unsafe class BufferStack<T> : IDisposable where T: unmanaged
{
private byte* _buffer;
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ConcurrentBufferStack"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -33,7 +33,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
public static class BufferStackBuilder
{
@@ -279,9 +279,8 @@ namespace StgSharp.HighPerformance.Memory
T* dataStart = (T*)(_buffer + sizeof(Header));
fixed (T* sourcePtr = span) {
Buffer.MemoryCopy(sourcePtr, dataStart,
(nuint)header->Capacity * (nuint)sizeof(T),
(nuint)span.Length * (nuint)sizeof(T));
Buffer.MemoryCopy(sourcePtr, dataStart, (nuint)header->Capacity * (nuint)sizeof(T),
(nuint)span.Length * (nuint)sizeof(T));
}
header->Top = span.Length;
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="HLSFAllocationHandle"
// Project: StgSharp
@@ -32,9 +32,9 @@ using System.Drawing;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Allocator = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocator;
using Allocator = StgSharp.Mathematics.Memory.HybridLayerSegregatedFitAllocator;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
public readonly unsafe struct HybridLayerSegregatedFitAllocationHandle
{
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="HLSFAllocator.Alloc"
// Project: StgSharp
@@ -27,9 +27,9 @@
// -----------------------------------------------------------------------
using System;
using System.Numerics;
using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle;
using hlsfHandle = StgSharp.Mathematics.Memory.HybridLayerSegregatedFitAllocationHandle;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
public unsafe partial class HybridLayerSegregatedFitAllocator
{
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="HLSFAllocator.BucketNode"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -30,7 +30,7 @@ using System.Reflection.Metadata;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
public unsafe partial class HybridLayerSegregatedFitAllocator
{
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="HLSFAllocator.Debug"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -31,13 +31,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
public sealed class HLSFPositionChainBreakException : Exception
{
public HLSFPositionChainBreakException()
: base("Position chain of an HLSF allocator is broken") { }
public HLSFPositionChainBreakException() : base("Position chain of an HLSF allocator is broken") { }
}
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="HLSFAllocator.Free"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -35,9 +35,9 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle;
using hlsfHandle = StgSharp.Mathematics.Memory.HybridLayerSegregatedFitAllocationHandle;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
public enum FreePolicy
{
@@ -90,10 +90,7 @@ namespace StgSharp.HighPerformance.Memory
/// Handle to the allocated memory block
/// <param name="collectPolicy">
/// </param>
public void Free(
hlsfHandle handle,
FreePolicy collectPolicy = FreePolicy.NoCollect
)
public void Free(hlsfHandle handle, FreePolicy collectPolicy = FreePolicy.NoCollect)
{
Entry* e = handle.EntryHandle;
if (e == null) {
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="HLSFAllocator.Level"
// Project: StgSharp
@@ -33,14 +33,14 @@ using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
public unsafe partial class HybridLayerSegregatedFitAllocator
{
private const int MaxLevel = 9;
private int[] _levelSizeArray = [ 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 ];
private int[] _levelSizeArray = [64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216];
public int AlignOfLevel(int bucketLevel)
{
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="HLSFAllocator.SegmentEntry"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -29,7 +29,7 @@ using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
public unsafe partial class HybridLayerSegregatedFitAllocator
{
@@ -38,10 +38,7 @@ namespace StgSharp.HighPerformance.Memory
/// Check if two Entries are adjacent in memory
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool AssertAdjacentTo(
Entry* current,
Entry* other
)
private static bool AssertAdjacentTo(Entry* current, Entry* other)
{
// Only a predicate; never throw here. Callers rely on false to skip merging.
return other->Position + (nuint)other->Size == current->Position ||
@@ -51,11 +48,7 @@ namespace StgSharp.HighPerformance.Memory
/// <summary>
/// check out if a bucket is within the same higher-level boundary as currentOffset
/// </summary>
private bool AssertBoundary(
Entry* previous,
Entry* current,
int level
)
private bool AssertBoundary(Entry* previous, Entry* current, int level)
{
level = int.Min(level, MaxLevel);
int nextLevelSize = _levelSizeArray[level] * 4;
@@ -68,21 +61,14 @@ namespace StgSharp.HighPerformance.Memory
/// Determine segment index based on size and originLevel
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int DetermineSegmentIndex(
int[] levelSizeArray,
long size,
int level
)
private static int DetermineSegmentIndex(int[] levelSizeArray, long size, int level)
{
level = int.Min(level, MaxLevel);
return (int)((size - 1) / levelSizeArray[level]);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void InsertEntryAfter(
Entry* entry,
Entry* position
)
private static void InsertEntryAfter(Entry* entry, Entry* position)
{
Entry* next = position->NextNear;
entry->NextNear = next;
@@ -92,10 +78,7 @@ namespace StgSharp.HighPerformance.Memory
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void InsertEntryBefore(
Entry* entry,
Entry* position
)
private static void InsertEntryBefore(Entry* entry, Entry* position)
{
Entry* prev = position->PreviousNear;
entry->NextNear = position;
@@ -109,9 +92,7 @@ namespace StgSharp.HighPerformance.Memory
/// Current Entry will serve as the final merged block. The Merge will be in lazy
/// strategy.
/// </summary>
private void MergeAndRemoveFromBuckets(
Entry* entry
)
private void MergeAndRemoveFromBuckets(Entry* entry)
{
if (entry == null) {
return;
@@ -171,9 +152,7 @@ namespace StgSharp.HighPerformance.Memory
/// Remove node from position linked list, this method does not recycle a BucketNode from
/// size bucket
/// </summary>
private void RemoveFromPositionChain(
Entry* entry
)
private void RemoveFromPositionChain(Entry* entry)
{
Entry* prev = entry->PreviousNear;
Entry* next = entry->NextNear;
@@ -190,11 +169,7 @@ namespace StgSharp.HighPerformance.Memory
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void SetEntryLevel(
Entry* entry,
nuint position,
long size
)
private static void SetEntryLevel(Entry* entry, nuint position, long size)
{
entry ->Position = position;
entry->Size = size;
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="HLSFAllocator"
// Project: StgSharp
@@ -31,7 +31,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
public unsafe partial class HybridLayerSegregatedFitAllocator : IDisposable
{
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="SlabAllocationHandle"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -28,7 +28,7 @@
using System;
using System.Runtime.CompilerServices;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
public unsafe struct SlabAllocationHandle<T> : IDisposable where T: unmanaged
{
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="SlabAllocator.Chunked"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -33,9 +33,9 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
internal sealed unsafe class ChunkedSlabAllocator<T> : SlabAllocator<T> where T : unmanaged
internal sealed unsafe class ChunkedSlabAllocator<T> : SlabAllocator<T> where T: unmanaged
{
private bool _disposed;
@@ -96,6 +96,7 @@ namespace StgSharp.HighPerformance.Memory
return;
}
_disposed = true;
// NativeMemory.Free((void*)_currentBuffer);
while (_buffers.TryPop(out nuint buffer))
{
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="SlabAllocator.ChunkedConcurrent"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -36,9 +36,9 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
internal sealed unsafe class ConcurrentChunkedSlabAllocator<T> : SlabAllocator<T> where T : unmanaged
internal sealed unsafe class ConcurrentChunkedSlabAllocator<T> : SlabAllocator<T> where T: unmanaged
{
private bool _disposed;
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="SlabAllocator.SequencialConcurrent"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -32,15 +32,15 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
public sealed unsafe class ConcurrentSequentialSlabAllocator<T> : SlabAllocator<T> where T: unmanaged
{
private bool _disposed;
private T* _buffer;
private bool _disposed;
private readonly BufferExpansionLock _lock = new();
private readonly ConcurrentBufferStack<nuint> _stack;
private readonly int _elementSize;
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="SlabAllocator"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -27,9 +27,9 @@
// -----------------------------------------------------------------------
using System;
namespace StgSharp.HighPerformance.Memory
namespace StgSharp.Mathematics.Memory
{
public abstract class SlabAllocator<T> : IDisposable where T : unmanaged
public abstract class SlabAllocator<T> : IDisposable where T: unmanaged
{
public abstract nuint Allocate();
@@ -56,32 +56,29 @@ namespace StgSharp.HighPerformance.Memory
/// Thrown when requesting unsupported configurations.
/// </exception>
/// <remarks>
/// <para><strong> Important Threading Considerations: </strong></para> <para> While SLAB
/// <para><strong> Important Threading Considerations: </strong></para> <para>While SLAB
/// /// allocators themselves may be designed for single-threaded use, allocated objects
/// are /// frequently shared across multiple threads in real-world applications. Due to
/// the /// special implementation of expandable concurrent sequential SLAB allocators,
/// they rely /// on internal expansion locks to ensure that memory buffer expansions
/// (which involve /// copying the entire buffer to a new location) do not occur while
/// other threads are /// reading from allocated regions.</para> <para><strong>
/// Sequential Layout Limitations: /// </strong><br /> Sequential layout SLAB allocators
/// other threads are /// reading from allocated regions. </para> <para><strong>
/// Sequential Layout Limitations: ///</strong><br /> Sequential layout SLAB allocators
/// cannot provide a single-threaded /// version because:<list
/// type="bullet"><item><description> They use contiguous memory /// layout that
/// requires buffer expansion when capacity is exceeded ///
/// </description></item><item><description> Buffer expansion involves copying all ///
/// existing data to a new memory location </description></item><item><description>///
/// type="bullet"><item><description>They use contiguous memory /// layout that requires
/// buffer expansion when capacity is exceeded
/// ///</description></item><item><description>Buffer expansion involves copying all ///
/// existing data to a new memory location</description></item><item><description> ///
/// Without proper synchronization, concurrent access to allocated objects during ///
/// expansion would cause memory corruption </description></item><item><description> The
/// expansion would cause memory corruption</description></item><item><description>The
/// /// expansion lock mechanism is essential even if allocation itself is single- ///
/// threaded</description></item></list></para> <para><strong> Chunked Layout: ///
/// </strong><br /> Chunked layout allocators can optionally provide single-threaded ///
/// versions since they don't require buffer expansion and copying. Each chunk is ///
/// allocated independently, avoiding the memory relocation issues present in sequential
/// /// layouts.</para>
/// threaded </description></item></list></para> <para><strong>Chunked Layout:
/// ///</strong><br /> Chunked layout allocators can optionally provide single-threaded
/// /// versions since they don't require buffer expansion and copying. Each chunk is
/// /// allocated independently, avoiding the memory relocation issues present in
/// sequential /// layouts. </para>
/// </remarks>
public static SlabAllocator<T> Create(
nuint count,
SlabBufferLayout layout,
bool concurrentSupport = true)
public static SlabAllocator<T> Create(nuint count, SlabBufferLayout layout, bool concurrentSupport = true)
{
if (concurrentSupport) {
return layout switch
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="IRegisterType"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -32,7 +32,7 @@ using System.Numerics;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.HighPerformance
namespace StgSharp.Mathematics
{
/// <summary>
/// Abstraction for a wide SIMD register or equivalent packed numeric storage. Provides raw
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="M128"
// Project: StgSharp
@@ -36,7 +36,7 @@ using System.Runtime.Intrinsics.X86;
using System.Text;
namespace StgSharp.HighPerformance
namespace StgSharp.Mathematics
{
[StructLayout(LayoutKind.Explicit, Pack = 16)]
public unsafe struct M128 : IRegisterPresentation
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="M256"
// Project: StgSharp
@@ -35,7 +35,7 @@ using System.Runtime.Intrinsics;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.HighPerformance
namespace StgSharp.Mathematics
{
[StructLayout(LayoutKind.Explicit, Pack = 16)]
public unsafe struct M256 : IRegisterPresentation
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="M512"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -35,7 +35,7 @@ using System.Runtime.Intrinsics;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.HighPerformance
namespace StgSharp.Mathematics
{
[StructLayout(LayoutKind.Explicit, Size = 64, Pack = 64)]
public unsafe struct M512 : IRegisterPresentation
@@ -44,17 +44,17 @@ namespace StgSharp.HighPerformance
[FieldOffset(0)] private fixed byte _buffer[64];
[FieldOffset(0)] private Vector512<float> Vec;
public ref T AsRef<T>() where T : unmanaged, INumber<T>
public ref T AsRef<T>() where T: unmanaged, INumber<T>
{
return ref Unsafe.As<byte, T>(ref _buffer[0]);
}
public void BroadCastFrom<T>(T value) where T : unmanaged, INumber<T>
public void BroadCastFrom<T>(T value) where T: unmanaged, INumber<T>
{
Vec = Vector512.Create(value).AsSingle();
}
public ref T Member<T>(int index) where T : unmanaged, INumber<T>
public ref T Member<T>(int index) where T: unmanaged, INumber<T>
{
return ref Unsafe.As<byte, T>(ref _buffer[0]);
}
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="M64"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -30,7 +30,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
namespace StgSharp.HighPerformance
namespace StgSharp.Mathematics
{
[StructLayout(LayoutKind.Explicit, Pack = 8)]
public unsafe struct M64 : IRegisterPresentation
@@ -47,12 +47,12 @@ namespace StgSharp.HighPerformance
Unsafe.SkipInit(out value);
}
public ref T AsRef<T>() where T : unmanaged,INumber<T>
public ref T AsRef<T>() where T: unmanaged,INumber<T>
{
return ref Unsafe.As<byte, T>(ref buffer[0]);
}
public void BroadCastFrom<T>(T value) where T : unmanaged, INumber<T>
public void BroadCastFrom<T>(T value) where T: unmanaged, INumber<T>
{
vec = Vector64.Create(value).AsSingle();
}
@@ -68,7 +68,7 @@ namespace StgSharp.HighPerformance
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ref T Member<T>(int index) where T : unmanaged, INumber<T>
public ref T Member<T>(int index) where T: unmanaged, INumber<T>
{
return ref Unsafe.As<byte, T>(ref buffer[index * sizeof(T)]);
}
@@ -1,54 +0,0 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="UnsafeCompute"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. 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.Runtime.CompilerServices;
namespace StgSharp.HighPerformance
{
public static class UnsafeCompute
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe int CityHashSimplify(char* span, int length)
{
return NativeIntrinsic.Context.city_hash_simplify(span, length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe int CityHashSimplify(char* span, int begin, int length)
{
return NativeIntrinsic.Context.city_hash_simplify(span + begin, length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe int IndexOfCharPair(char* source, int pairValue, int length)
{
return NativeIntrinsic.Context.index_pair(source, pairValue, length);
}
}
}
+4
View File
@@ -23,4 +23,8 @@
<None Remove="Graphics\**" />
</ItemGroup>
<ItemGroup>
<Folder Include="HighPerformance\RegisterAbstraction\" />
</ItemGroup>
</Project>
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="TimeSpanProvider.Awaiting"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,7 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance.Memory;
using StgSharp.Mathematics.Memory;
using System;
using System.Collections.Concurrent;
@@ -154,9 +154,7 @@ namespace StgSharp.Timing
/// OperationCanceledException when token is cancelled. If the provider is disposed during
/// wait an OperationCanceledException is thrown to indicate end.
/// </summary>
public Task WaitNextSpanAsync(
CancellationToken ct
)
public Task WaitNextSpanAsync(CancellationToken ct)
{
// Block the current thread until the event is signaled or cancellation requested.
_event.Wait(ct);
@@ -195,9 +193,7 @@ namespace StgSharp.Timing
/// True if the span provider is working. False if time is over (the sequence ended).
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal bool OnSpanTick(
long currentTick
)
internal bool OnSpanTick(long currentTick)
{
if (_sequence.EndsAt(currentTick))
{
+20 -55
View File
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="TextureGL"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -26,7 +26,7 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Graphics;
using StgSharp.HighPerformance;
using StgSharp.Mathematics;
using System;
using System.Diagnostics.CodeAnalysis;
@@ -44,19 +44,14 @@ namespace StgSharp.Graphics.OpenGL
private OpenGLFunction _gl;
internal GlHandle[] _textureHandle;
internal TextureGL(
int count,
glRender binding
)
internal TextureGL(int count, glRender binding)
{
// sourceList = new Image[count];
this._gl = binding.GL;
_textureHandle = _gl.GenTextures(count);
}
public GlHandle this[
int index
]
public GlHandle this[int index]
{
get => _textureHandle[index];
}
@@ -75,16 +70,12 @@ namespace StgSharp.Graphics.OpenGL
internal OpenGLFunction GL => _gl;
public void ActivateAs(
TextureUnit unit
)
public void ActivateAs(TextureUnit unit)
{
_gl.ActiveTextureUnit((uint)unit);
}
public void Bind2D(
int index
)
public void Bind2D(int index)
{
currentEditingTextureIndex = index;
_gl.BindTexture(glConst.TEXTURE_2D, _textureHandle[index]);
@@ -99,25 +90,18 @@ namespace StgSharp.Graphics.OpenGL
/// <param _label="i">
///
/// </param>
public unsafe void LoadTexture(
int index,
Image i
)
public unsafe void LoadTexture(int index, Image i)
{
byte[] handle = i.PixelBuffer;
_gl.TextureImage2d(Texture2DTarget.Texture2D, 0, i.Channel, i.Width, i.Height,
i.Channel, i.PixelLayout, pixels:handle);
_gl.TextureImage2d(Texture2DTarget.Texture2D, 0, i.Channel, i.Width, i.Height, i.Channel, i.PixelLayout,
pixels:handle);
_gl.GenerateMipmap(Texture2DTarget.Texture2D);
}
#region texture setting
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Set2dFilterProperty(
int index,
TextureFilter onMinify,
TextureFilter onMagnify
)
public void Set2dFilterProperty(int index, TextureFilter onMinify, TextureFilter onMagnify)
{
#if DEBUG
if (index != currentEditingTextureIndex)
@@ -132,11 +116,7 @@ namespace StgSharp.Graphics.OpenGL
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Set2dWrapProperty(
int index,
TextureWrap onHorizontial,
TextureWrap onVertical
)
public void Set2dWrapProperty(int index, TextureWrap onHorizontial, TextureWrap onVertical)
{
#if DEBUG
if (index != currentEditingTextureIndex)
@@ -151,10 +131,7 @@ namespace StgSharp.Graphics.OpenGL
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Set2dProperty(
int index,
TextureProperty property
)
public void Set2dProperty(int index, TextureProperty property)
{
Set2dFilterProperty(index, property.FilterOnMinify, property.FilterOnMagnify);
Set2dWrapProperty(index, property.WrapOnHorizontial, property.WrapOnVertical);
@@ -178,8 +155,7 @@ namespace StgSharp.Graphics.OpenGL
TextureFilter onMagnify,
TextureFilter onMinify,
TextureWrap onHorizontial,
TextureWrap onVertical
)
TextureWrap onVertical)
{
FilterOnMagnify = onMagnify;
FilterOnMinify = onMinify;
@@ -211,17 +187,14 @@ namespace StgSharp.Graphics.OpenGL
set => vert = value;
}
public override bool Equals(
[NotNullWhen(true)] object obj
)
public override bool Equals([NotNullWhen(true)] object obj)
{
return base.Equals(obj);
}
public override int GetHashCode()
{
return HashCode.Combine(FilterOnMagnify, FilterOnMagnify, WrapOnHorizontial,
WrapOnVertical);
return HashCode.Combine(FilterOnMagnify, FilterOnMagnify, WrapOnHorizontial, WrapOnVertical);
}
public override string ToString()
@@ -229,18 +202,12 @@ namespace StgSharp.Graphics.OpenGL
return $"FilterOnMagnify:{FilterOnMagnify}, " + $"FilterOnMagnify:{FilterOnMagnify}, " + $"WrapOnHorizontial:{WrapOnHorizontial}, " + $"WrapOnVertical:{WrapOnVertical}";
}
public static bool operator !=(
TextureProperty left,
TextureProperty right
)
public static bool operator !=(TextureProperty left, TextureProperty right)
{
return left.mask != right.mask;
}
public static bool operator ==(
TextureProperty left,
TextureProperty right
)
public static bool operator ==(TextureProperty left, TextureProperty right)
{
return left.mask == right.mask;
}
@@ -249,12 +216,10 @@ namespace StgSharp.Graphics.OpenGL
(
TextureFilter onMagnify, TextureFilter onMinify,
TextureWrap onHorizontial, TextureWrap onVertical
) propertyValueTuple
)
) propertyValueTuple)
{
return new TextureProperty(propertyValueTuple.onMagnify, propertyValueTuple.onMinify,
propertyValueTuple.onHorizontial,
propertyValueTuple.onVertical);
propertyValueTuple.onHorizontial, propertyValueTuple.onVertical);
}
}
+23 -45
View File
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="glApiManager.Load"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,7 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.Mathematics;
using System;
using System.Runtime.CompilerServices;
@@ -36,8 +36,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore10(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core10)
{
@@ -104,8 +103,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore11(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core11)
{
@@ -147,8 +145,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore12(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core12)
{
@@ -175,8 +172,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore13(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core13)
{
@@ -212,8 +208,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore14(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core14)
{
@@ -249,8 +244,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore15(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core15)
{
@@ -295,8 +289,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore20(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core20)
{
@@ -474,8 +467,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore21(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core21)
{
@@ -506,8 +498,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore30(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core30)
{
@@ -676,8 +667,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore31(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core31)
{
@@ -725,8 +715,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore32(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core32)
{
@@ -776,8 +765,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore33(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core33)
{
@@ -848,8 +836,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore40(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core40)
{
@@ -951,8 +938,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore41(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core41)
{
@@ -1144,8 +1130,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore42(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core42)
{
@@ -1187,8 +1172,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore43(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core43)
{
@@ -1294,8 +1278,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore44(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core44)
{
@@ -1332,8 +1315,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore45(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core45)
{
@@ -1568,8 +1550,7 @@ namespace StgSharp.Graphics.OpenGL
internal static unsafe bool LoadGLcore46(
glContextShadow* contextPtr,
delegate*<ReadOnlySpan<byte>, IntPtr> load
)
delegate*<ReadOnlySpan<byte>, IntPtr> load)
{
if (!core46)
{
@@ -1595,10 +1576,7 @@ namespace StgSharp.Graphics.OpenGL
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static unsafe IntPtr LoadGLFunction(
delegate*<ReadOnlySpan<byte>, IntPtr> load,
ReadOnlySpan<byte> name
)
private static unsafe IntPtr LoadGLFunction(delegate*<ReadOnlySpan<byte>, IntPtr> load, ReadOnlySpan<byte> name)
{
IntPtr ptr = load(name);
if (ptr == IntPtr.Zero) {
+7 -16
View File
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="glApiManager"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,7 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.Mathematics;
using StgSharp.Mathematics;
using StgSharp.MVVM;
using StgSharp.MVVM;
@@ -54,16 +54,13 @@ namespace StgSharp.Graphics.OpenGL
private static string glExtensionList;
/// <summary>
/// Load all supported OpenGL APIs and bind them to given <see cref="ViewPort" />.
/// </summary>
/// <param _label="contextHandle">
/// The handle to current OpenGL viewPortDisplay
/// </param>
public static unsafe void LoadOpenGLApiTo(
IntPtr contextHandle
)
public static unsafe void LoadOpenGLApiTo(IntPtr contextHandle)
{
OpenglContext* context = (OpenglContext*)contextHandle;
if (context->glGetString != null) {
@@ -84,8 +81,7 @@ namespace StgSharp.Graphics.OpenGL
if (context->glGetString(glVersion) == null) {
DefaultLog.InternalWriteLog("Failed to call glGetString", LogType.Error);
}
coreVersion = Marshal.PtrToStringAnsi((nint)context->glGetString(glVersion)) ??
string.Empty;
coreVersion = Marshal.PtrToStringAnsi((nint)context->glGetString(glVersion)) ?? string.Empty;
foreach (string branch in glBranch)
{
@@ -3248,10 +3244,7 @@ namespace StgSharp.Graphics.OpenGL
#endregion checkGLextensions
}
internal static void CheckCoreVersion(
int majorVersion,
int minorVersion
)
internal static void CheckCoreVersion(int majorVersion, int minorVersion)
{
if (majorVersion < 3) {
throw new InvalidOperationException(
@@ -3417,9 +3410,7 @@ namespace StgSharp.Graphics.OpenGL
}
}
internal static unsafe string GetExtensions(
this OpenglContext context
)
internal static unsafe string GetExtensions(this OpenglContext context)
{
if (context.glGetString == null) {
return string.Empty;
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="TriangulatedSurface"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,7 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.Mathematics;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphics;
+26 -38
View File
@@ -1,32 +1,33 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ColumnSet2"
// file="ColumnSet2.cs"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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:
// 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 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.
// 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 System;
using System.Numerics;
using System.Runtime.CompilerServices;
@@ -51,10 +52,7 @@ namespace StgSharp.Mathematics.Internal
[FieldOffset(0)] internal Vector4 colum0;
[FieldOffset(4 * sizeof(float))] internal Vector4 colum1;
internal ColumnSet2(
Vector4 c0,
Vector4 c1
)
internal ColumnSet2(Vector4 c0, Vector4 c1)
{
Unsafe.SkipInit(out this);
colum0 = c0;
@@ -62,35 +60,25 @@ namespace StgSharp.Mathematics.Internal
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(
object? obj
)
public override bool Equals(object? obj)
{
return (obj is ColumnSet2 mat) && Equals(mat);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(
ColumnSet2 other
)
public bool Equals(ColumnSet2 other)
{
return colum0.Equals(other.colum0) && colum1.Equals(other.colum1);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(
ColumnSet2 left,
ColumnSet2 right
)
public static bool operator !=(ColumnSet2 left, ColumnSet2 right)
{
return !(left == right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(
ColumnSet2 left,
ColumnSet2 right
)
public static bool operator ==(ColumnSet2 left, ColumnSet2 right)
{
return left.Equals(right);
}
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="MatrixKernel"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -30,7 +30,7 @@ using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.HighPerformance
namespace StgSharp.Mathematics
{
public unsafe struct MatrixKernel
{
@@ -41,7 +41,7 @@ namespace StgSharp.HighPerformance
[StructLayout(LayoutKind.Sequential)]
[InlineArray(16)]
public unsafe struct MatrixKernel<T> where T : unmanaged, INumber<T>
public unsafe struct MatrixKernel<T> where T: unmanaged, INumber<T>
{
public static readonly int Size = 16 * sizeof(T);
@@ -53,19 +53,14 @@ namespace StgSharp.HighPerformance
Unsafe.SkipInit(out this);
}
public MatrixKernel(
bool clear
)
public MatrixKernel(bool clear)
{
if (!clear) {
Unsafe.SkipInit(out this);
}
}
public ref T this[
int x,
int y
]
public ref T this[int x, int y]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => ref Unsafe.Add(ref c0r0, (x * 4) + y);
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="MatrixPanel"
// Project: StgSharp
@@ -31,7 +31,7 @@ using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.HighPerformance
namespace StgSharp.Mathematics
{
public unsafe struct MatrixPanel
{
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ScalarPacket"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -33,7 +33,7 @@ using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.HighPerformance
namespace StgSharp.Mathematics
{
public unsafe struct ScalarPacket
{
@@ -0,0 +1,57 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="UnsafeCompute.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.Runtime.CompilerServices;
namespace StgSharp.Mathematics.Internal
{
public static class UnsafeCompute
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe int CityHashSimplify(char* span, int length)
{
return NativeIntrinsic.Context.city_hash_simplify(span, length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe int CityHashSimplify(char* span, int begin, int length)
{
return NativeIntrinsic.Context.city_hash_simplify(span + begin, length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe int IndexOfCharPair(char* source, int pairValue, int length)
{
return NativeIntrinsic.Context.index_pair(source, pairValue, length);
}
}
}
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="intrinsicContextProvider"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="Matrix44"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,8 +25,8 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.Mathematics.Internal;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Intrinsic;
using StgSharp.Mathematics.Numeric;
using System;
using System.Collections;
@@ -46,20 +46,13 @@ namespace StgSharp.Mathematics.Graphics
[FieldOffset(0)] internal ColumnSet4 mat;
[FieldOffset(0)] internal MatrixKernel<float> kernel;
internal Matrix44(
ColumnSet4 mat
)
internal Matrix44(ColumnSet4 mat)
{
Unsafe.SkipInit(out this);
this.mat = mat;
}
internal Matrix44(
Vector4 vec0,
Vector4 vec1,
Vector4 vec2,
Vector4 vec3
)
internal Matrix44(Vector4 vec0, Vector4 vec1, Vector4 vec2, Vector4 vec3)
{
Unsafe.SkipInit(out this);
mat.colum0 = vec0;
@@ -89,8 +82,7 @@ namespace StgSharp.Mathematics.Graphics
float a30,
float a31,
float a32,
float a33
)
float a33)
{
Unsafe.SkipInit(out this);
mat.colum0 = new Vector4(a00, a10, a20, a30);
@@ -99,10 +91,7 @@ namespace StgSharp.Mathematics.Graphics
mat.colum3 = new Vector4(a03, a13, a23, a33);
}
public unsafe float this[
int rowNum,
int columNum
]
public unsafe float this[int rowNum, int columNum]
{
get
{
@@ -157,30 +146,24 @@ namespace StgSharp.Mathematics.Graphics
return MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<ColumnSet4, float>(ref mat), 16);
}
public override bool Equals(
object? obj
)
public override bool Equals(object? obj)
{
return obj is Matrix44 x && Equals(x);
}
public bool Equals(
Matrix44 other
)
public bool Equals(Matrix44 other)
{
return mat.Equals(other.mat);
}
public override int GetHashCode()
{
return HashCode.Combine(mat.colum0.GetHashCode(), mat.colum1.GetHashCode(),
mat.colum2.GetHashCode(), mat.colum3.GetHashCode());
return HashCode.Combine(mat.colum0.GetHashCode(), mat.colum1.GetHashCode(), mat.colum2.GetHashCode(),
mat.colum3.GetHashCode());
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal unsafe void InternalTranspose(
ref Matrix44 transpose
)
internal unsafe void InternalTranspose(ref Matrix44 transpose)
{
const int f32 = 0;
fixed (MatrixKernel<float>* source = &this.kernel, target = &transpose.kernel) {
@@ -189,10 +172,7 @@ namespace StgSharp.Mathematics.Graphics
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe Matrix44 operator -(
Matrix44 left,
Matrix44 right
)
public static unsafe Matrix44 operator -(Matrix44 left, Matrix44 right)
{
Matrix44 ret = new();
const int f32 = 0;
@@ -200,29 +180,20 @@ namespace StgSharp.Mathematics.Graphics
return ret;
}
public static bool operator !=(
Matrix44 left,
Matrix44 right
)
public static bool operator !=(Matrix44 left, Matrix44 right)
{
return !(left == right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe Matrix44 operator *(
Matrix44 mat,
float value
)
public static unsafe Matrix44 operator *(Matrix44 mat, float value)
{
return new Matrix44(mat.mat.colum0 * value, mat.mat.colum1 * value,
mat.mat.colum2 * value, mat.mat.colum3 * value);
return new Matrix44(mat.mat.colum0 * value, mat.mat.colum1 * value, mat.mat.colum2 * value,
mat.mat.colum3 * value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix44 operator *(
Matrix44 left,
Matrix44 right
)
public static Matrix44 operator *(Matrix44 left, Matrix44 right)
{
Matrix44 ret = new();
int f32 = (int)MatrixElementType.F32;
@@ -231,10 +202,7 @@ namespace StgSharp.Mathematics.Graphics
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe Matrix44 operator +(
Matrix44 left,
Matrix44 right
)
public static unsafe Matrix44 operator +(Matrix44 left, Matrix44 right)
{
Matrix44 ret = new();
const int f32 = 0;
@@ -242,10 +210,7 @@ namespace StgSharp.Mathematics.Graphics
return ret;
}
public static bool operator ==(
Matrix44 left,
Matrix44 right
)
public static bool operator ==(Matrix44 left, Matrix44 right)
{
return left.Equals(right);
}
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="Vec2"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,7 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Numeric;
using System.Net.Http.Headers;
using System.Numerics;
+23 -75
View File
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="Vec3"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,7 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Numeric;
using System;
using System.Collections;
@@ -50,18 +50,14 @@ namespace StgSharp.Mathematics.Graphics
[FieldOffset(4)] public float Y;
[FieldOffset(8)] public float Z;
internal Vec3(
M128 vector
)
internal Vec3(M128 vector)
{
Unsafe.SkipInit(out this);
reg = vector;
reg.Member<uint>(3) = 0;
}
internal Vec3(
Vector3 vector
)
internal Vec3(Vector3 vector)
{
v = vector;
}
@@ -71,21 +67,14 @@ namespace StgSharp.Mathematics.Graphics
Unsafe.SkipInit(out this);
}
public Vec3(
Vec2 xy,
float z
)
public Vec3(Vec2 xy, float z)
{
Unsafe.SkipInit(out this);
reg = xy.reg;
Z = z;
}
public Vec3(
float x,
float y,
float z
)
public Vec3(float x, float y, float z)
{
Unsafe.SkipInit(out this);
v = new Vector3(x, y, z);
@@ -118,39 +107,28 @@ namespace StgSharp.Mathematics.Graphics
public static Vec3 UnitZ => new(0, 0, 1);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec3 Cross(
Vec3 left,
Vec3 right
)
public static Vec3 Cross(Vec3 left, Vec3 right)
{
return Linear.Cross(left, right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly float Dot(
Vec3 right
)
public readonly float Dot(Vec3 right)
{
return Vector3.Dot(v, right.v);
}
public readonly bool Equals(
Vec3 other
)
public readonly bool Equals(Vec3 other)
{
return reg == other.reg;
}
public override readonly bool Equals(
object obj
)
public override readonly bool Equals(object obj)
{
return obj is not null && obj is Vec3 vec && this == vec;
}
public static Vec3 FromSpan(
ReadOnlySpan<float> span
)
public static Vec3 FromSpan(ReadOnlySpan<float> span)
{
Vec3 v = new();
span.CopyTo(MemoryMarshal.CreateSpan(ref v.X, 3));
@@ -180,10 +158,7 @@ namespace StgSharp.Mathematics.Graphics
return ret;
}
public static bool IsParallel(
Vec3 left,
Vec3 right
)
public static bool IsParallel(Vec3 left, Vec3 right)
{
return Cross(left, right) == Zero;
}
@@ -193,88 +168,61 @@ namespace StgSharp.Mathematics.Graphics
return $"[{X},{Y},{Z}]";
}
public readonly string ToString(
string sample
)
public readonly string ToString(string sample)
{
return $"[{X.ToString(sample)},{Y.ToString(sample)},{Z.ToString(sample)}]";
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec3 operator -(
Vec3 vec
)
public static Vec3 operator -(Vec3 vec)
{
return new Vec3(-vec.v);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec3 operator -(
Vec3 left,
Vec3 right
)
public static Vec3 operator -(Vec3 left, Vec3 right)
{
return new Vec3(left.v - right.v);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(
Vec3 left,
Vec3 right
)
public static bool operator !=(Vec3 left, Vec3 right)
{
return left.v != right.v;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec3 operator *(
Vec3 vec,
float value
)
public static Vec3 operator *(Vec3 vec, float value)
{
return new Vec3(vec.v * value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float operator *(
Vec3 left,
Vec3 right
)
public static float operator *(Vec3 left, Vec3 right)
{
return Vector3.Dot(left.v, right.v);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec3 operator /(
Vec3 vec,
float value
)
public static Vec3 operator /(Vec3 vec, float value)
{
return new Vec3(vec.v / value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec3 operator +(
Vec3 left,
Vec3 right
)
public static Vec3 operator +(Vec3 left, Vec3 right)
{
return new Vec3(left.v + right.v);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(
Vec3 left,
Vec3 right
)
public static bool operator ==(Vec3 left, Vec3 right)
{
return left.v == right.v;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe implicit operator Vec3(
(float, float, float) tuple
)
public static unsafe implicit operator Vec3((float, float, float) tuple)
{
return Unsafe.As<(float,float,float), Vec3>(ref tuple);
}
+20 -61
View File
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="Vec4"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,8 +25,8 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.Mathematics.Internal;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Intrinsic;
using StgSharp.Mathematics.Numeric;
using System;
using System.Data.Common;
@@ -52,9 +52,7 @@ namespace StgSharp.Mathematics.Graphics
[FieldOffset(4)] public float Y;
[FieldOffset(8)] public float Z;
internal Vec4(
Vector4 v
)
internal Vec4(Vector4 v)
{
Unsafe.SkipInit(out X);
Unsafe.SkipInit(out Y);
@@ -65,9 +63,7 @@ namespace StgSharp.Mathematics.Graphics
vec = v;
}
internal Vec4(
M128 v
)
internal Vec4(M128 v)
{
Unsafe.SkipInit(out X);
Unsafe.SkipInit(out Y);
@@ -78,10 +74,7 @@ namespace StgSharp.Mathematics.Graphics
reg = v;
}
public Vec4(
Vec3 v3,
float w
)
public Vec4(Vec3 v3, float w)
{
Unsafe.SkipInit(out X);
Unsafe.SkipInit(out Y);
@@ -91,12 +84,7 @@ namespace StgSharp.Mathematics.Graphics
W = w;
}
public Vec4(
float x,
float y,
float z,
float w
)
public Vec4(float x, float y, float z, float w)
{
vec = new Vector4(x, y, z, w);
}
@@ -135,10 +123,7 @@ namespace StgSharp.Mathematics.Graphics
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec4 Add(
Vec4 left,
Vec4 right
)
public static Vec4 Add(Vec4 left, Vec4 right)
{
return left + right;
}
@@ -148,16 +133,12 @@ namespace StgSharp.Mathematics.Graphics
return MemoryMarshal.CreateReadOnlySpan(ref reg.Member<float>(0), 4);
}
public override bool Equals(
object obj
)
public override bool Equals(object obj)
{
return obj is Vec4 v && v == this;
}
public static Vec4 FromSpan(
ReadOnlySpan<float> span
)
public static Vec4 FromSpan(ReadOnlySpan<float> span)
{
if (span.Length < 4) {
throw new ArgumentException("Span length must be at least 4.", nameof(span));
@@ -180,10 +161,7 @@ namespace StgSharp.Mathematics.Graphics
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec4 Subtract(
Vec4 left,
Vec4 right
)
public static Vec4 Subtract(Vec4 left, Vec4 right)
{
return left - right;
}
@@ -194,55 +172,36 @@ namespace StgSharp.Mathematics.Graphics
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec4 operator -(
Vec4 left,
Vec4 right
)
public static Vec4 operator -(Vec4 left, Vec4 right)
{
return new Vec4(left.vec - right.vec);
}
public static bool operator !=(
Vec4 left,
Vec4 right
)
public static bool operator !=(Vec4 left, Vec4 right)
{
return !(left == right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec4 operator *(
Matrix44 mat,
Vec4 vec
)
public static Vec4 operator *(Matrix44 mat, Vec4 vec)
{
Matrix44 transpose = mat.Transpose;
return new Vec4(Vector4.Dot(transpose.mat.colum0, vec.vec),
Vector4.Dot(transpose.mat.colum1, vec.vec),
Vector4.Dot(transpose.mat.colum2, vec.vec),
Vector4.Dot(transpose.mat.colum3, vec.vec));
return new Vec4(Vector4.Dot(transpose.mat.colum0, vec.vec), Vector4.Dot(transpose.mat.colum1, vec.vec),
Vector4.Dot(transpose.mat.colum2, vec.vec), Vector4.Dot(transpose.mat.colum3, vec.vec));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vec4 operator +(
Vec4 left,
Vec4 right
)
public static Vec4 operator +(Vec4 left, Vec4 right)
{
return new Vec4(left.vec + right.vec);
}
public static bool operator ==(
Vec4 left,
Vec4 right
)
public static bool operator ==(Vec4 left, Vec4 right)
{
return left.vec == right.vec;
}
bool IEquatable<Vec4>.Equals(
Vec4 other
)
bool IEquatable<Vec4>.Equals(Vec4 other)
{
return vec == other.vec;
}
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Matrix.Create"
// Project: StgSharp
@@ -25,8 +25,8 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.HighPerformance.Memory;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
+11 -32
View File
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="Matrix"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,7 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Numeric;
using System;
using System.Numerics;
@@ -35,7 +35,7 @@ using System.Runtime.CompilerServices;
namespace StgSharp.Mathematics.Numeric
{
public unsafe partial class Matrix<T> where T : unmanaged, INumber<T>
public unsafe partial class Matrix<T> where T: unmanaged, INumber<T>
{
private protected static readonly int t_count = 16 / sizeof(T);
@@ -57,10 +57,7 @@ namespace StgSharp.Mathematics.Numeric
_buffer = buffer;
}
public T this[
int x,
int y
]
public T this[int x, int y]
{
get
{
@@ -101,10 +98,7 @@ namespace StgSharp.Mathematics.Numeric
/// <exception cref="NotImplementedException">
///
/// </exception>
public unsafe Matrix<T> this[
ReadOnlySpan<MatrixIndex> column,
ReadOnlySpan<MatrixIndex> row
]
public unsafe Matrix<T> this[ReadOnlySpan<MatrixIndex> column, ReadOnlySpan<MatrixIndex> row]
{
get { throw new NotImplementedException(); }
set { throw new NotImplementedException(); }
@@ -133,20 +127,14 @@ namespace StgSharp.Mathematics.Numeric
protected internal int KernelRowLength => _size.KernelRowLength;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe ref MatrixKernel<T> GetMatrixKernel(
int x,
int y
)
public unsafe ref MatrixKernel<T> GetMatrixKernel(int x, int y)
{
return ref _boarder.IsInBuffer(x, y, in _size) ?
ref _buffer[_boarder.GetIndexOffset(x, y, in _size)] :
ref Unsafe.NullRef<MatrixKernel<T>>();
}
internal long GetElementOffset(
int x,
int y
)
internal long GetElementOffset(int x, int y)
{
int
k_c = y / 4,
@@ -162,10 +150,7 @@ namespace StgSharp.Mathematics.Numeric
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal unsafe ref T GetElementUnsafe(
int x,
int y
)
internal unsafe ref T GetElementUnsafe(int x, int y)
{
// Caller guarantees: indices in range, layout is dense square.
int k_c = y / 4;
@@ -178,19 +163,13 @@ namespace StgSharp.Mathematics.Numeric
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal unsafe MatrixKernel<T>* GetKernelAddressUnsafe(
int x,
int y
)
internal unsafe MatrixKernel<T>* GetKernelAddressUnsafe(int x, int y)
{
return Buffer + _boarder.GetIndexOffset(x, y, in _size);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal unsafe ref MatrixKernel<T> GetKernelUnsafe(
int x,
int y
)
internal unsafe ref MatrixKernel<T> GetKernelUnsafe(int x, int y)
{
// Caller guarantees: indices in range, layout is dense square.
int k_c = y / 4;
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="MatrixStorage"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,8 +25,8 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.HighPerformance.Memory;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -35,12 +35,12 @@ using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using HLSFAllocator = global::StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocator;
using HLSFHandle = global::StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle;
using HLSFAllocator = global::StgSharp.Mathematics.Memory.HybridLayerSegregatedFitAllocator;
using HLSFHandle = global::StgSharp.Mathematics.Memory.HybridLayerSegregatedFitAllocationHandle;
namespace StgSharp.Mathematics.Numeric
{
public abstract class MatrixStorage<T> : IDisposable where T : unmanaged, INumber<T>
public abstract class MatrixStorage<T> : IDisposable where T: unmanaged, INumber<T>
{
internal unsafe ref MatrixKernel<T> this[long index]
@@ -55,7 +55,7 @@ namespace StgSharp.Mathematics.Numeric
}
internal class MatrixStorageHLSF<T>(HLSFAllocator allocator, HLSFHandle handle) : MatrixStorage<T>
where T : unmanaged, INumber<T>
where T: unmanaged, INumber<T>
{
internal HLSFAllocator _allocator = allocator;
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="MatrixCompute.Float"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -26,8 +26,8 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Collections;
using StgSharp.HighPerformance;
using StgSharp.Internal;
using StgSharp.Mathematics;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
@@ -42,11 +42,7 @@ namespace StgSharp.Mathematics.Numeric
public static partial class MatrixCompute
{
public static unsafe void Add(
Matrix<float> left,
Matrix<float> right,
Matrix<float> ans
)
public static unsafe void Add(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
{
int f32 = (int)MatrixElementType.F32;
if (left.ColumnLength != right.ColumnLength ||
@@ -92,10 +88,7 @@ namespace StgSharp.Mathematics.Numeric
return;
}
public static unsafe void Fill(
Matrix<float> ans,
float value
)
public static unsafe void Fill(Matrix<float> ans, float value)
{
int f32 = (int)MatrixElementType.F32;
long count = (long)ans.KernelColumnLength * ans.KernelRowLength;
@@ -126,11 +119,7 @@ namespace StgSharp.Mathematics.Numeric
taskGroup.Dispose();
}
public static unsafe void Mul(
Matrix<float> left,
Matrix<float> right,
Matrix<float> ans
)
public static unsafe void Mul(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
{
int f32 = (int)MatrixElementType.F32;
@@ -168,8 +157,7 @@ namespace StgSharp.Mathematics.Numeric
NativeIntrinsic.Context
.mat[f32].kernel_tile_fma((MatrixKernel*)left.Buffer,
(MatrixKernel*)right.Buffer,
(MatrixKernel*)ans.Buffer,
enumeration);
(MatrixKernel*)ans.Buffer, enumeration);
}
}
@@ -196,18 +184,13 @@ namespace StgSharp.Mathematics.Numeric
return;
}
public static unsafe void Mul(
Matrix<float> left,
float right,
Matrix<float> ans
)
public static unsafe void Mul(Matrix<float> left, float right, Matrix<float> ans)
{
int f32 = (int)MatrixElementType.F32;
if (left.ColumnLength != ans.ColumnLength || left.RowLength != ans.RowLength) {
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
}
if (left.Layout != MatrixLayout.DenseRectangle ||
ans.Layout != MatrixLayout.DenseRectangle) {
if (left.Layout != MatrixLayout.DenseRectangle || ans.Layout != MatrixLayout.DenseRectangle) {
throw new NotSupportedException("Only dense rectangle matrices are supported.");
}
long count = (long)left.KernelColumnLength * left.KernelRowLength;
@@ -248,11 +231,7 @@ namespace StgSharp.Mathematics.Numeric
return;
}
public static unsafe void Sub(
Matrix<float> left,
Matrix<float> right,
Matrix<float> ans
)
public static unsafe void Sub(Matrix<float> left, Matrix<float> right, Matrix<float> ans)
{
int f32 = (int)MatrixElementType.F32;
if (left.ColumnLength != right.ColumnLength ||
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="MatrixCompute"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,8 +25,8 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.Internal;
using StgSharp.Mathematics;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -45,8 +45,8 @@ namespace StgSharp.Mathematics.Numeric
MatrixKernel<T>* buffer,
int colLength,
int x,
int y
) where T : unmanaged, INumber<T>
int y)
where T: unmanaged, INumber<T>
{
return (MatrixKernel*)(buffer + (colLength * x + y));
}
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="MatrixCompute.double"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,8 +25,8 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.Internal;
using StgSharp.Mathematics;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -38,11 +38,7 @@ namespace StgSharp.Mathematics.Numeric
public partial class MatrixCompute
{
public static unsafe void Add(
Matrix<double> left,
Matrix<double> right,
Matrix<double> ans
)
public static unsafe void Add(Matrix<double> left, Matrix<double> right, Matrix<double> ans)
{
int f64 = (int)MatrixElementType.F64;
if (left.ColumnLength != right.ColumnLength ||
@@ -88,10 +84,7 @@ namespace StgSharp.Mathematics.Numeric
return;
}
public static unsafe void Fill(
Matrix<double> ans,
double value
)
public static unsafe void Fill(Matrix<double> ans, double value)
{
int f64 = (int)MatrixElementType.F64;
long count = (long)ans.KernelColumnLength * ans.KernelRowLength;
@@ -122,11 +115,7 @@ namespace StgSharp.Mathematics.Numeric
taskGroup.Dispose();
}
public static unsafe void Mul(
Matrix<double> left,
Matrix<double> right,
Matrix<double> ans
)
public static unsafe void Mul(Matrix<double> left, Matrix<double> right, Matrix<double> ans)
{
int f64 = (int)MatrixElementType.F64;
@@ -158,8 +147,7 @@ namespace StgSharp.Mathematics.Numeric
NativeIntrinsic.Context
.mat[f64].kernel_tile_fma((MatrixKernel*)left.Buffer,
(MatrixKernel*)right.Buffer,
(MatrixKernel*)ans.Buffer,
enumeration);
(MatrixKernel*)ans.Buffer, enumeration);
}
}
if (count > 256) {
@@ -185,18 +173,13 @@ namespace StgSharp.Mathematics.Numeric
return;
}
public static unsafe void Mul(
Matrix<double> left,
double right,
Matrix<double> ans
)
public static unsafe void Mul(Matrix<double> left, double right, Matrix<double> ans)
{
int f64 = (int)MatrixElementType.F64;
if (left.ColumnLength != ans.ColumnLength || left.RowLength != ans.RowLength) {
throw new IndexOutOfRangeException("Matrix dimensions must agree.");
}
if (left.Layout != MatrixLayout.DenseRectangle ||
ans.Layout != MatrixLayout.DenseRectangle) {
if (left.Layout != MatrixLayout.DenseRectangle || ans.Layout != MatrixLayout.DenseRectangle) {
throw new NotSupportedException("Only dense rectangle matrices are supported.");
}
long count = (long)left.KernelColumnLength * left.KernelRowLength;
@@ -237,11 +220,7 @@ namespace StgSharp.Mathematics.Numeric
return;
}
public static unsafe void Sub(
Matrix<double> left,
Matrix<double> right,
Matrix<double> ans
)
public static unsafe void Sub(Matrix<double> left, Matrix<double> right, Matrix<double> ans)
{
int f64 = (int)MatrixElementType.F64;
if (left.ColumnLength != right.ColumnLength ||
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="MatrixParallel.Publish"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -26,7 +26,7 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Collections;
using StgSharp.HighPerformance;
using StgSharp.Mathematics;
using System;
using System.Collections.Generic;
@@ -46,9 +46,7 @@ namespace StgSharp.Mathematics.Numeric
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe MatrixParallelWrap ScheduleTask(
MatrixParallelTask* package
)
internal static unsafe MatrixParallelWrap ScheduleTask(MatrixParallelTask* package)
{
switch (package->ComputeMode.OperationStyle)
{
@@ -59,9 +57,7 @@ namespace StgSharp.Mathematics.Numeric
}
}
private static unsafe MatrixParallelWrap ScheduleBufferTask(
MatrixParallelTask* package
)
private static unsafe MatrixParallelWrap ScheduleBufferTask(MatrixParallelTask* package)
{
int primCount = package->PrimCount;
int secCount = package->SecCount;
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="MatrixParallel"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -26,9 +26,9 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Collections;
using StgSharp.HighPerformance.Memory;
using StgSharp.Internal;
using StgSharp.Mathematics.Internal;
using StgSharp.Mathematics.Intrinsic;
using StgSharp.Mathematics.Memory;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -57,9 +57,7 @@ namespace StgSharp.Mathematics.Numeric
private static bool IsInitialized { get; set; } = false;
internal static unsafe IntrinsicContext* GetContext(
SIMDID simd
)
internal static unsafe IntrinsicContext* GetContext(SIMDID simd)
{
if (!IsParallelSupported) {
return null;
@@ -116,17 +114,11 @@ namespace StgSharp.Mathematics.Numeric
[LibraryImport(Native.LibName, EntryPoint = "sn_compare_simd")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
private static unsafe partial ulong CompareSIMDID(
IntrinsicContext* context,
ulong id
);
private static unsafe partial ulong CompareSIMDID(IntrinsicContext* context, ulong id);
[LibraryImport(Native.LibName, EntryPoint = "load_intrinsic_function")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
private static unsafe partial void LoadIntrinsicFunction(
IntrinsicContext* context,
ulong id
);
private static unsafe partial void LoadIntrinsicFunction(IntrinsicContext* context, ulong id);
}
}
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="MatrixParallelTask"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,8 +25,8 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.Mathematics.Internal;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Intrinsic;
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
@@ -51,13 +51,9 @@ namespace StgSharp.Mathematics.Numeric
[FieldOffset(24)] public nint Span; // 24
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Copy(
MatrixParallelTask* source,
MatrixParallelTask* target
)
public static void Copy(MatrixParallelTask* source, MatrixParallelTask* target)
{
Buffer.MemoryCopy(source, target, sizeof(MatrixParallelTask),
sizeof(MatrixParallelTask));
Buffer.MemoryCopy(source, target, sizeof(MatrixParallelTask), sizeof(MatrixParallelTask));
}
}
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="MatrixParallelThread.Fma"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,8 +25,8 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.Internal;
using StgSharp.Mathematics;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -39,9 +39,7 @@ namespace StgSharp.Mathematics.Numeric
public partial class MatrixParallelThread
{
internal static unsafe void ComputeFmaPanelF32(
MatrixParallelTask* p
)
internal static unsafe void ComputeFmaPanelF32(MatrixParallelTask* p)
{
int f32 = MatrixElementType.F32.IntrinsicNode;
MatrixKernel* leftBuffer = (MatrixKernel*)p->Left;
@@ -64,14 +62,11 @@ namespace StgSharp.Mathematics.Numeric
int j = (int)(c % ansHeight);
enumeration->Member<int>(0) = i;
enumeration->Member<int>(1) = j;
NativeIntrinsic.Context.mat[f32].kernel_tile_fma(leftBuffer, rightBuffer, ansBuffer,
enumeration);
NativeIntrinsic.Context.mat[f32].kernel_tile_fma(leftBuffer, rightBuffer, ansBuffer, enumeration);
}
}
internal static unsafe void ComputeFmaPanelF64(
MatrixParallelTask* p
)
internal static unsafe void ComputeFmaPanelF64(MatrixParallelTask* p)
{
int f64 = MatrixElementType.F64.IntrinsicNode;
@@ -96,8 +91,7 @@ namespace StgSharp.Mathematics.Numeric
int j = (int)(c % ansHeight);
enumeration->Member<int>(0) = i;
enumeration->Member<int>(1) = j;
NativeIntrinsic.Context.mat[f64].kernel_tile_fma(leftBuffer, rightBuffer, ansBuffer,
enumeration);
NativeIntrinsic.Context.mat[f64].kernel_tile_fma(leftBuffer, rightBuffer, ansBuffer, enumeration);
}
}
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="MatrixParallelThread.Model"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,7 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.Mathematics;
using System;
using System.Runtime.CompilerServices;
@@ -36,9 +36,7 @@ namespace StgSharp.Mathematics.Numeric
private const int KernelStealCount = 64;
internal unsafe void BufferCompute(
MatrixParallelTask* p
)
internal unsafe void BufferCompute(MatrixParallelTask* p)
{
// while () { }
int size = p->ElementSize * 16;
@@ -49,14 +47,11 @@ namespace StgSharp.Mathematics.Numeric
((delegate* unmanaged[Cdecl]<void*, void*, void*, void*, long, void>)computeHandle)((void*)(p->Left + offset),
(void*)(p->Right + offset),
(void*)(p->Answer + offset),
scalar,
count);
scalar, count);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal unsafe void SpecialBufferCompute(
MatrixParallelTask* p
)
internal unsafe void SpecialBufferCompute(MatrixParallelTask* p)
{
switch ((MatrixElementType)p->ElementSize)
{
@@ -26,7 +26,7 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Internal;
using StgSharp.Mathematics.Internal;
using StgSharp.Mathematics.Intrinsic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="MatrixTaskFactory"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,8 +25,8 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance;
using StgSharp.HighPerformance.Memory;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -36,7 +36,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using hlsfAllocator = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocator;
using hlsfAllocator = StgSharp.Mathematics.Memory.HybridLayerSegregatedFitAllocator;
namespace StgSharp.Mathematics.Numeric
{
@@ -74,9 +74,7 @@ namespace StgSharp.Mathematics.Numeric
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe MatrixParallelTask* FromExistPackage(
MatrixParallelTask* exist
)
public static unsafe MatrixParallelTask* FromExistPackage(MatrixParallelTask* exist)
{
MatrixParallelTask* ptr = (MatrixParallelTask*)_wrapAllocator.Allocate();
MatrixParallelTask.Copy(exist, ptr);
@@ -85,17 +83,13 @@ namespace StgSharp.Mathematics.Numeric
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Release(
ScalarPacket* source
)
public static void Release(ScalarPacket* source)
{
_scalarAllocator.Free((nuint)source);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Release(
MatrixParallelTask* source
)
public static void Release(MatrixParallelTask* source)
{
if (source->Scalar != null) {
_scalarAllocator.Free((nuint)source->Scalar);
@@ -1,31 +1,34 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="RandomGenerator"
// file="RandomGenerator.cs"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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:
// 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 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.
// 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.HighPerformance;
using StgSharp.Mathematics.Internal;
using System;
using System.IO;
@@ -33,7 +36,7 @@ using System.Runtime.CompilerServices;
using System.Text;
using System.Xml.Serialization;
namespace StgSharp.Data
namespace StgSharp.Mathematics.Numeric.Scalar
{
public unsafe class RandomGenerator
{
@@ -53,12 +56,7 @@ namespace StgSharp.Data
string data = sw.ToString();
originKey = Encoding.Unicode.GetBytes(data);
}
currentKey = [
0,
0,
0,
0
];
currentKey = [ 0, 0, 0, 0 ];
fixed (byte* o = originKey, c = currentKey) {
*(int*)c = UnsafeCompute.CityHashSimplify((char*)o, 0, originKey.Length / 2);
}
-1
View File
@@ -2,7 +2,6 @@
<ItemGroup>
<ProjectReference Include="..\StgSharp.Common\StgSharp.Common.csproj" />
<ProjectReference Include="..\StgSharp.Script\StgSharp.Script.csproj" />
</ItemGroup>
</Project>
+36 -16
View File
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="HlsfStressTest"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,7 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance.Memory;
using StgSharp.Mathematics.Memory;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -45,8 +45,36 @@ namespace StgSharp
3UL * 1024UL * 1024UL * 1024UL; // lower default to 512MB
private static readonly uint[] SizeSweep = {
64, 128, 192, 256, 512, 768, 1024, 2048, 3072, 4096, 8192, 12288, 16384, 32768, 49152, 65536, 131072, 196608, 262144, 524288, 786432, 1_048_576, 2_097_152, 3_145_728, 4_194_304, 8_388_608, 12_582_912, 16_777_216, 25_165_824, 33_554_432
};
64,
128,
192,
256,
512,
768,
1024,
2048,
3072,
4096,
8192,
12288,
16384,
32768,
49152,
65536,
131072,
196608,
262144,
524288,
786432,
1_048_576,
2_097_152,
3_145_728,
4_194_304,
8_388_608,
12_582_912,
16_777_216,
25_165_824,
33_554_432 };
public static unsafe void Run()
{
@@ -116,10 +144,7 @@ namespace StgSharp
Console.WriteLine("=== Benchmark Complete ===");
}
private static void BenchAllocFreePairs(
HybridLayerSegregatedFitAllocator allocator,
int pairs,
uint blockSize)
private static void BenchAllocFreePairs(HybridLayerSegregatedFitAllocator allocator, int pairs, uint blockSize)
{
Stopwatch sw = Stopwatch.StartNew();
for (int i = 0; i < pairs; i++)
@@ -176,9 +201,7 @@ namespace StgSharp
Console.WriteLine($" size={Fmt(blockSize),-12} ops={ops,-12} alloc/s={allocOpsPerSec,-16:0.0} touch={touch,-5}");
}
private static void BenchFragmentationCycle(
HybridLayerSegregatedFitAllocator allocator,
int targetMiB)
private static void BenchFragmentationCycle(HybridLayerSegregatedFitAllocator allocator, int targetMiB)
{
int targetBytes = targetMiB * 1024 * 1024;
Random rng = new Random(123);
@@ -229,10 +252,7 @@ namespace StgSharp
Console.WriteLine($" cleanup freed {live.Count} in {swD.Elapsed.TotalSeconds:0.00}s");
}
private static void BenchFreeThroughput(
HybridLayerSegregatedFitAllocator allocator,
int count,
uint blockSize)
private static void BenchFreeThroughput(HybridLayerSegregatedFitAllocator allocator, int count, uint blockSize)
{
List<HybridLayerSegregatedFitAllocationHandle> list = new List<HybridLayerSegregatedFitAllocationHandle>(count);
for (int i = 0; i < count; i++) {
+2 -2
View File
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="MatrixTest"
// Project: StgSharp
@@ -26,7 +26,7 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using Microsoft.CodeAnalysis.CSharp.Syntax;
using StgSharp.HighPerformance.Memory;
using StgSharp.Mathematics.Memory;
using StgSharp.Mathematics.Numeric;
using System;
using System.Collections.Generic;
+3 -3
View File
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Program"
// Project: StgSharp
@@ -26,9 +26,9 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Common.Timing;
using StgSharp.HighPerformance;
using StgSharp.HighPerformance.Memory;
using StgSharp.Internal;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Memory;
using StgSharp.Mathematics.Numeric;
using StgSharp.Timing;
+3 -3
View File
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="SlabStressTest"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,7 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance.Memory;
using StgSharp.Mathematics.Memory;
using System;
using System.Diagnostics;
-1
View File
@@ -14,7 +14,6 @@
<ProjectReference Include="..\StgSharp.Mathematics\StgSharp.Mathematics.csproj" />
<ProjectReference Include="..\StgSharp.Model\StgSharp.Model.csproj" />
<ProjectReference Include="..\StgSharp.RegularAnalysis\StgSharp.RegularAnalysis.csproj" />
<ProjectReference Include="..\StgSharp.Script\StgSharp.Script.csproj" />
</ItemGroup>
<ItemGroup>
+26 -29
View File
@@ -1,38 +1,35 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="NewRender.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
// -----------------------------------------------------------------------
// file="NewRender"
// 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:
// 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 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.
// 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 StgSharp.HighPerformance;
using StgSharp.Internal;
using StgSharp.Mathematics;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -49,12 +46,12 @@ namespace StgSharp
private class NewRender : ViewRender<ViewMain>
{
public NewRender( ViewMain view ) : base( view ) { }
public NewRender(ViewMain view) : base(view) { }
public override void CustomizedInitialize()
{
Binding.Stream = CreateRenderStream<ParticleRenderStream>();
Render[ "only".AsLabel() ] = Binding.Stream;
Render["only".AsLabel()] = Binding.Stream;
}
public override bool ValidateInitializing()
+9 -6
View File
@@ -1,9 +1,9 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="hlsf-test"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// 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
@@ -25,7 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.HighPerformance.Memory;
using StgSharp.Mathematics.Memory;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -50,8 +50,11 @@ namespace StgSharp
int maxRounds = 10000; // 可调整
uint[] sizes = {
64u, 128u, 256u, 512u, 1024u
};
64u,
128u,
256u,
512u,
1024u };
Random rnd = new Random(42);
for (int round = 1; round <= maxRounds; round++)
{
+4 -17
View File
@@ -1,6 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32825.248
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.3.11520.95 d18.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp.Common", "StgSharp.Common\StgSharp.Common.csproj", "{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}"
ProjectSection(ProjectDependencies) = postProject
@@ -25,8 +26,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp.TerminalDialogue", "StgSharp.TerminalDialogue\StgSharp.TerminalDialogue.csproj", "{10B5819F-2A62-41B6-980A-EB9E76A0E95C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp.Script", "StgSharp.Script\StgSharp.Script.csproj", "{5B51F5EA-138C-46B5-B36F-1D389968B6CF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp.Model", "StgSharp.Model\StgSharp.Model.csproj", "{D9538DE0-EE4C-4183-86D6-7DFC08A7BDFB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp.Mathematics", "StgSharp.Mathematics\StgSharp.Mathematics.csproj", "{9946599F-4D34-440F-840D-F9443D5AEFAA}"
@@ -105,18 +104,6 @@ Global
{10B5819F-2A62-41B6-980A-EB9E76A0E95C}.Release|ARM64.Build.0 = Release|ARM64
{10B5819F-2A62-41B6-980A-EB9E76A0E95C}.Release|x64.ActiveCfg = Release|x64
{10B5819F-2A62-41B6-980A-EB9E76A0E95C}.Release|x64.Build.0 = Release|x64
{5B51F5EA-138C-46B5-B36F-1D389968B6CF}.Debug|ARM64.ActiveCfg = Debug|ARM64
{5B51F5EA-138C-46B5-B36F-1D389968B6CF}.Debug|ARM64.Build.0 = Debug|ARM64
{5B51F5EA-138C-46B5-B36F-1D389968B6CF}.Debug|x64.ActiveCfg = Debug|x64
{5B51F5EA-138C-46B5-B36F-1D389968B6CF}.Debug|x64.Build.0 = Debug|x64
{5B51F5EA-138C-46B5-B36F-1D389968B6CF}.PerformanceDebug|ARM64.ActiveCfg = PerformanceDebug|ARM64
{5B51F5EA-138C-46B5-B36F-1D389968B6CF}.PerformanceDebug|ARM64.Build.0 = PerformanceDebug|ARM64
{5B51F5EA-138C-46B5-B36F-1D389968B6CF}.PerformanceDebug|x64.ActiveCfg = PerformanceDebug|x64
{5B51F5EA-138C-46B5-B36F-1D389968B6CF}.PerformanceDebug|x64.Build.0 = PerformanceDebug|x64
{5B51F5EA-138C-46B5-B36F-1D389968B6CF}.Release|ARM64.ActiveCfg = Release|ARM64
{5B51F5EA-138C-46B5-B36F-1D389968B6CF}.Release|ARM64.Build.0 = Release|ARM64
{5B51F5EA-138C-46B5-B36F-1D389968B6CF}.Release|x64.ActiveCfg = Release|x64
{5B51F5EA-138C-46B5-B36F-1D389968B6CF}.Release|x64.Build.0 = Release|x64
{D9538DE0-EE4C-4183-86D6-7DFC08A7BDFB}.Debug|ARM64.ActiveCfg = Debug|ARM64
{D9538DE0-EE4C-4183-86D6-7DFC08A7BDFB}.Debug|ARM64.Build.0 = Debug|ARM64
{D9538DE0-EE4C-4183-86D6-7DFC08A7BDFB}.Debug|x64.ActiveCfg = Debug|x64