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