use individual panel define as compute unit, kernel is now storage and loading unit

This commit is contained in:
Youmu Liu
2025-11-12 21:13:00 +08:00
parent bbe69f0384
commit 2dfb4ae86a
33 changed files with 522 additions and 58 deletions
@@ -185,7 +185,7 @@ namespace StgSharp.Mathematics.Graphic
far = distance + depthRange.back,
offsetX = offset.X,
offsetY = offset.Y,
width = Scaler.Abs(GeometryScaler.Tan(fovRadius / 2) * near * 2),
width = Scalar.Abs(GeometryScaler.Tan(fovRadius / 2) * near * 2),
height = width * size.Y / size.X;
_projection.column[0].X = 2 * near / width;
@@ -34,13 +34,13 @@ namespace StgSharp.Mathematics.Graphic
public static float GetAngle(Vec2 vec1, Vec2 vec2)
{
return Scaler.ACos(
return Scalar.ACos(
1 / (vec1.GetLength() * vec2.GetLength()));
}
public static float GetAngle(Vec3 vec1, Vec3 vec2)
{
return Scaler.ACos((vec1 * vec2) / (vec1.GetLength() * vec2.GetLength()));
return Scalar.ACos((vec1 * vec2) / (vec1.GetLength() * vec2.GetLength()));
}
}
@@ -34,12 +34,12 @@ namespace StgSharp.Mathematics.Graphic
public static float GetLength(this Vec3 vec)
{
return Scaler.Sqrt(vec.Dot(vec));
return Scalar.Sqrt(vec.Dot(vec));
}
public static float GetLength(this Vec2 vec)
{
return Scaler.Sqrt(vec.Dot(vec));
return Scalar.Sqrt(vec.Dot(vec));
}
}
+1 -1
View File
@@ -30,7 +30,7 @@ using System.Runtime.CompilerServices;
namespace StgSharp.Mathematics
{
public static unsafe partial class Scaler
public static unsafe partial class Scalar
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+1 -1
View File
@@ -29,7 +29,7 @@ using System;
namespace StgSharp.Mathematics
{
public static unsafe partial class Scaler
public static unsafe partial class Scalar
{
private const float
+1 -1
View File
@@ -30,7 +30,7 @@ using System.Runtime.CompilerServices;
namespace StgSharp.Mathematics
{
public static unsafe partial class Scaler
public static unsafe partial class Scalar
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -31,7 +31,7 @@ using System.Runtime.CompilerServices;
namespace StgSharp.Mathematics
{
public static unsafe partial class Scaler
public static unsafe partial class Scalar
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -33,7 +33,7 @@ using System.Threading.Tasks;
namespace StgSharp.Mathematics
{
public static partial class Scaler
public static partial class Scalar
{
public static float MaxOf(params float[] stream)
+1 -1
View File
@@ -30,7 +30,7 @@ using System.Runtime.CompilerServices;
namespace StgSharp.Mathematics
{
public static partial class Scaler
public static partial class Scalar
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+2 -2
View File
@@ -32,7 +32,7 @@ namespace StgSharp.Mathematics
{
public unsafe delegate float ScalarCalcHandler(float* x);
public static unsafe partial class Scaler
public static unsafe partial class Scalar
{
private const uint MEM_COMMIT = 0x1000;
@@ -40,7 +40,7 @@ namespace StgSharp.Mathematics
private const uint MEM_RESERVE = 0x2000;
private const uint PAGE_EXECUTE_READWRITE = 0x40;
static Scaler() { }
static Scalar() { }
[DllImport("Kernel32.dll", EntryPoint = "VirtualAlloc")]
private static extern IntPtr VirtualAlloc(IntPtr address, int size, uint allocType, uint protect);
+1 -1
View File
@@ -30,7 +30,7 @@ using System.Runtime.CompilerServices;
namespace StgSharp.Mathematics
{
public static unsafe partial class Scaler
public static unsafe partial class Scalar
{
public const float E = 2.718281828f;
@@ -29,7 +29,7 @@ using System;
namespace StgSharp.Mathematics
{
public static partial class Scaler
public static partial class Scalar
{
private static readonly uint[] factorialResult = [
+1 -1
View File
@@ -29,7 +29,7 @@ using System;
namespace StgSharp.Mathematics
{
public static partial class Scaler
public static partial class Scalar
{
private static readonly float[] logArray = {
+2 -2
View File
@@ -29,7 +29,7 @@ using System.Runtime.CompilerServices;
namespace StgSharp.Mathematics
{
public static unsafe partial class Scaler
public static unsafe partial class Scalar
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -81,7 +81,7 @@ namespace StgSharp.Mathematics
return 0;
}
z = Scaler.Log(x) * y;
z = Scalar.Log(x) * y;
bool sign = false;
if (z < 0)
+4 -4
View File
@@ -38,7 +38,7 @@ using System.Text;
namespace StgSharp.Mathematics
{
public static unsafe partial class Scaler
public static unsafe partial class Scalar
{
private static byte[] randomSeed;
@@ -61,9 +61,9 @@ namespace StgSharp.Mathematics
{
float seed = currentSeed;
float sample = Scaler.Pow(Scaler.SeedSqrt(seed), 2);
float sample = Scalar.Pow(Scalar.SeedSqrt(seed), 2);
float sample2 = (sample - seed) / seed;
sample2 = Scaler.Abs(sample2);
sample2 = Scalar.Abs(sample2);
if (sample == 1) {
sample = sample2;
@@ -76,7 +76,7 @@ namespace StgSharp.Mathematics
if (result == 0)
{
currentSeed = sample2 + 0.1f;
result = Scaler.LowProceisionRandom();
result = Scalar.LowProceisionRandom();
}
return result;
}
+1 -1
View File
@@ -34,7 +34,7 @@ using System.Threading.Tasks;
namespace StgSharp.Mathematics
{
public static unsafe partial class Scaler
public static unsafe partial class Scalar
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+1 -1
View File
@@ -31,7 +31,7 @@ using System.Runtime.CompilerServices;
namespace StgSharp.Mathematics
{
public static partial class Scaler
public static partial class Scalar
{
public const float Pi = 3.1415926f;
+1 -1
View File
@@ -30,7 +30,7 @@ using System.Runtime.CompilerServices;
namespace StgSharp.Mathematics
{
public static partial class Scaler
public static partial class Scalar
{
public static unsafe float SeedSqrt(float x)
+1 -1
View File
@@ -30,7 +30,7 @@ using System.Runtime.CompilerServices;
namespace StgSharp.Mathematics
{
public static partial class Scaler
public static partial class Scalar
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]