Merge remote-tracking branch 'origin/ILGpu' into ILGpu
This commit is contained in:
@@ -141,7 +141,7 @@ public class Program {
|
||||
|
||||
sw.Stop();
|
||||
Console.WriteLine(
|
||||
$"\nEdge pixels: {maskData.Edges.Count} | {maskData.Edges.Count / (sw.ElapsedMilliseconds + 1)} pixels/s\n Time: {sw.Elapsed.TotalSeconds:F4}s");
|
||||
$"\nEdge pixels: {maskData.Edges.Count} | {width*height / (sw.ElapsedMilliseconds + 1)} pixels/s\n Time: {sw.Elapsed.TotalSeconds:F4}s");
|
||||
}
|
||||
|
||||
static Vector3[,] Gradient(TransitionMaskData mask, SDFData sdfA, SDFData sdfB) {
|
||||
@@ -172,9 +172,7 @@ public class Program {
|
||||
});*/
|
||||
|
||||
kernels.Gradient(mask.Mask, sdfA.SDF, sdfB.SDF, out var temp);
|
||||
Console.WriteLine(
|
||||
$"Gradient Time: {sw.Elapsed.TotalSeconds:N4}s ({iterCount / (float)sw.Elapsed.TotalSeconds:N0} pixels/s)");
|
||||
//Console.WriteLine($"Min: {min} | Max: {max}");
|
||||
Console.WriteLine($"Gradient Time: {sw.Elapsed.TotalSeconds:N4}s ({width*height / (float)sw.Elapsed.TotalSeconds:N0} pixels/s)");
|
||||
return temp;
|
||||
}
|
||||
|
||||
@@ -185,7 +183,7 @@ public class Program {
|
||||
|
||||
kernels.Sdf(mask.Edges.ToArray(), (int)width, (int)height, out var temp);
|
||||
|
||||
Console.WriteLine($"\nSDF Generation Time: {sw.Elapsed.TotalSeconds:N4}s ({iterCount / sw.Elapsed.TotalSeconds:N0} pixels/s)");
|
||||
Console.WriteLine($"\nSDF Generation Time: {sw.Elapsed.TotalSeconds:N4}s ({width*height / sw.Elapsed.TotalSeconds:N0} pixels/s)");
|
||||
|
||||
return new(temp);
|
||||
}
|
||||
@@ -224,7 +222,7 @@ public class Program {
|
||||
where T : INumber<T>, IMultiplyOperators<T, float, T>, IAdditionOperators<T, T, T>
|
||||
=> a * (1 - t) + b * t;
|
||||
|
||||
static T Remap<T>(T value, T min, T max, T newMin, T newMax)
|
||||
public static T Remap<T>(T value, T min, T max, T newMin, T newMax)
|
||||
where T : INumber<T>, ISubtractionOperators<T, T, T>, IMultiplyOperators<T, T, T>, IAdditionOperators<T, T, T>
|
||||
=> (value - min) / (max - min) * (newMax - newMin) + newMin;
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ILGPU" Version="1.5.2" />
|
||||
<PackageReference Include="ILGPU.Algorithms" Version="1.5.2" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
|
||||
<PackageReference Include="System.Numerics.Vectors" Version="4.6.1" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -160,7 +160,7 @@ public partial class SdfKernels {
|
||||
|
||||
accelerator.Synchronize();
|
||||
|
||||
gradient = bufferMask.GetAsArray2D();
|
||||
gradient = bufferGradient.GetAsArray2D();
|
||||
|
||||
public void DirectionalBlur(Vector3[,] image, Vector3[,] mask, out Vector3[,] output, float radius = 3f, float step = .5f, float sigma = 1f) {
|
||||
var dev = gpuContext.GetPreferredDevice(preferCPU:false);
|
||||
|
||||
Reference in New Issue
Block a user