Add image processing and memory management features
Added new namespace `Misaki.HighPerformance.Image` for image processing, including classes for animated GIF handling and memory management. Added `AnimatedFrameResult` class for individual frames in animated images. Added `AnimatedGifEnumerator` class for enumerating frames in animated GIFs. Added `ColorComponents` enum for different color formats. Added `ImageInfo` struct for image dimensions and color components. Added `CRuntime` class for low-level memory management functions. Added `MemoryStats` class to track memory allocation statistics. Added utility functions for creating multi-dimensional arrays. Added new structures for fixed-size UTF-8 encoded strings. Added benchmarking classes to test new memory management features. Changed `StbImage.cs` to include new namespaces and functionality for image data manipulation. Changed project files to target .NET 9.0 and enable new features. Changed `Arena.cs` and `DynamicArena.cs` to use `nuint` for size parameters. Changed `BitSet.cs` to enhance bit manipulation methods. Changed `Program.cs` to run `FunctionPtrBenchmark` for performance testing. Removed memory tracking code from `AllocationManager.cs`, including the `_allocated` dictionary and related logic. Removed `Free` method from `IAllocator.cs` interface. Removed `UNSAFE_COLLECTION_CHECK` preprocessor directive from the codebase. Refactored various files to improve organization, moving from `Unsafe` to `LowLevel` namespace. Refactored `MemoryUtilities` class to include new memory operation methods. Refactored `UnsafeUtilities.cs` to support new collection structures.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
namespace Misaki.HighPerformance.LowLevel.Collections;
|
||||
|
||||
[Flags]
|
||||
public enum AllocationOption : byte
|
||||
{
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// Allocator for initialized memory.
|
||||
/// </summary>
|
||||
Clear = 1 << 0,
|
||||
/// <summary>
|
||||
/// Allocator for untracked memory. It always allocates memory without using the allocation manager.
|
||||
/// Always free it manually even if you use the <see cref="Allocator.Temp"/> allocator.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Use this option carefully, as the allocation manager will not track the memory.
|
||||
/// No warning will be given if the memory is not freed.
|
||||
/// </remarks>
|
||||
UnTracked = 1 << 1,
|
||||
}
|
||||
|
||||
public enum Allocator : byte
|
||||
{
|
||||
// Make the first allocator as invalid because we don't want to user create a default collection without passing any parameters
|
||||
Invalid,
|
||||
/// <summary>
|
||||
/// Allocator for temporary allocations. Allocations are cleared after use.
|
||||
/// </summary>
|
||||
Temp,
|
||||
/// <summary>
|
||||
/// Allocator for persistent allocations. Allocations are not cleared after use.
|
||||
/// </summary>
|
||||
Persistent,
|
||||
/// <summary>
|
||||
/// Allocator for external memory. Allocations are not cleared after use.
|
||||
/// </summary>
|
||||
External
|
||||
}
|
||||
Reference in New Issue
Block a user