Enhance mathematical capabilities and job system
Added new numeric types for unsigned integers, including uint2, uint3, and uint4, along with their matrix types. Added a new `quaternion` struct with constructors and methods for creating and manipulating quaternions. Added methods for projecting and reflecting vectors, enhancing geometric operations. Added utility functions for generating orthonormal bases and changing vector signs. Added comprehensive unit tests for new mathematical functions and quaternion operations. Added a high-performance job scheduling system with job management features and worker thread management. Added new structs for job execution, allowing efficient job scheduling and execution. Added utility functions for job execution, including methods for obtaining unique job IDs. Changed access modifiers and property definitions in several files for improved clarity and maintainability. Changed property definitions and method implementations in `ImageInfo.cs`, `ImageResult.cs`, and `ImageResultFloat.cs` for better readability. Changed memory management functions in `CRuntime.cs` and improved memory allocation tracking in `MemoryStats.cs`. Changed the project file to include references to necessary projects and enable unsafe code blocks. Removed the `WorkerThreadPool.cs` file, integrating worker thread management directly into the `JobScheduler`. Removed the `float4` struct and its associated methods and properties, transitioning to a new code generation strategy. Removed the `float4.tt` template and other related files, indicating a shift in code generation approach. Removed the `Vectorize.cs` file, indicating a change in how vector operations are handled. Updated the `.gitignore` file to include IDE-specific settings. Updated various XML files to define project components and structure. Updated the `AllocationManager.cs` to improve memory allocation management and introduce new strategies. Updated the `UnsafeArray.cs`, `UnsafeHashMap.cs`, and `UnsafeList.cs` to enhance performance and safety in unsafe contexts. Updated error handling and function pointer management in `MemoryLeakException.cs` and `FunctionPointer.cs`. Updated the `AssemblyInfo.cs` file to include global using directives for better code organization.
This commit is contained in:
@@ -2,94 +2,88 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Misaki.HighPerformance.Image;
|
||||
|
||||
namespace Misaki.HighPerformance.Image
|
||||
namespace Misaki.HighPerformance.Image;
|
||||
|
||||
public static unsafe partial class StbImage
|
||||
{
|
||||
#if !STBSHARP_INTERNAL
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
static unsafe partial class StbImage
|
||||
{
|
||||
public static string stbi__g_failure_reason;
|
||||
public static readonly char[] stbi__parse_png_file_invalid_chunk = new char[25];
|
||||
public static string stbi__g_failure_reason;
|
||||
public static readonly char[] stbi__parse_png_file_invalid_chunk = new char[25];
|
||||
|
||||
public static int NativeAllocations
|
||||
{
|
||||
get
|
||||
{
|
||||
return MemoryStats.Allocations;
|
||||
}
|
||||
}
|
||||
public static int NativeAllocations
|
||||
{
|
||||
get
|
||||
{
|
||||
return MemoryStats.Allocations;
|
||||
}
|
||||
}
|
||||
|
||||
public class stbi__context
|
||||
{
|
||||
private readonly Stream _stream;
|
||||
public class stbi__context
|
||||
{
|
||||
private readonly Stream _stream;
|
||||
|
||||
public byte[] _tempBuffer;
|
||||
public int img_n = 0;
|
||||
public int img_out_n = 0;
|
||||
public uint img_x = 0;
|
||||
public uint img_y = 0;
|
||||
public byte[] _tempBuffer;
|
||||
public int img_n = 0;
|
||||
public int img_out_n = 0;
|
||||
public uint img_x = 0;
|
||||
public uint img_y = 0;
|
||||
|
||||
public stbi__context(Stream stream)
|
||||
{
|
||||
if (stream == null)
|
||||
throw new ArgumentNullException("stream");
|
||||
public stbi__context(Stream stream)
|
||||
{
|
||||
if (stream == null)
|
||||
throw new ArgumentNullException("stream");
|
||||
|
||||
_stream = stream;
|
||||
}
|
||||
_stream = stream;
|
||||
}
|
||||
|
||||
public Stream Stream
|
||||
{
|
||||
get
|
||||
{
|
||||
return _stream;
|
||||
}
|
||||
}
|
||||
}
|
||||
public Stream Stream
|
||||
{
|
||||
get
|
||||
{
|
||||
return _stream;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int stbi__err(string str)
|
||||
{
|
||||
stbi__g_failure_reason = str;
|
||||
return 0;
|
||||
}
|
||||
private static int stbi__err(string str)
|
||||
{
|
||||
stbi__g_failure_reason = str;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static byte stbi__get8(stbi__context s)
|
||||
{
|
||||
var b = s.Stream.ReadByte();
|
||||
if (b == -1) return 0;
|
||||
public static byte stbi__get8(stbi__context s)
|
||||
{
|
||||
var b = s.Stream.ReadByte();
|
||||
if (b == -1)
|
||||
return 0;
|
||||
|
||||
return (byte)b;
|
||||
}
|
||||
return (byte)b;
|
||||
}
|
||||
|
||||
public static void stbi__skip(stbi__context s, int skip)
|
||||
{
|
||||
s.Stream.Seek(skip, SeekOrigin.Current);
|
||||
}
|
||||
public static void stbi__skip(stbi__context s, int skip)
|
||||
{
|
||||
s.Stream.Seek(skip, SeekOrigin.Current);
|
||||
}
|
||||
|
||||
public static void stbi__rewind(stbi__context s)
|
||||
{
|
||||
s.Stream.Seek(0, SeekOrigin.Begin);
|
||||
}
|
||||
public static void stbi__rewind(stbi__context s)
|
||||
{
|
||||
s.Stream.Seek(0, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
public static int stbi__at_eof(stbi__context s)
|
||||
{
|
||||
return s.Stream.Position == s.Stream.Length ? 1 : 0;
|
||||
}
|
||||
public static int stbi__at_eof(stbi__context s)
|
||||
{
|
||||
return s.Stream.Position == s.Stream.Length ? 1 : 0;
|
||||
}
|
||||
|
||||
public static int stbi__getn(stbi__context s, byte* buf, int size)
|
||||
{
|
||||
if (s._tempBuffer == null ||
|
||||
s._tempBuffer.Length < size)
|
||||
s._tempBuffer = new byte[size * 2];
|
||||
public static int stbi__getn(stbi__context s, byte* buf, int size)
|
||||
{
|
||||
if (s._tempBuffer == null ||
|
||||
s._tempBuffer.Length < size)
|
||||
s._tempBuffer = new byte[size * 2];
|
||||
|
||||
var result = s.Stream.Read(s._tempBuffer, 0, size);
|
||||
Marshal.Copy(s._tempBuffer, 0, new IntPtr(buf), result);
|
||||
var result = s.Stream.Read(s._tempBuffer, 0, size);
|
||||
Marshal.Copy(s._tempBuffer, 0, new IntPtr(buf), result);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user