Adjust field visibility, fix naming violations in non test projects
このコミットが含まれているのは:
1 親
f73915bf93
コミット
746f132182
34ファイル変更
+171
-171
検索条件に一致するファイルはありません
@@ -83,13 +83,13 @@ internal static partial class BlasHelpers
|
||||
[AutoConstructor]
|
||||
public readonly partial struct FullyConnectedForwardKernel : IComputeShader
|
||||
{
|
||||
public readonly int n;
|
||||
public readonly int m;
|
||||
public readonly int p;
|
||||
public readonly ReadOnlyBuffer<float> x;
|
||||
public readonly ReadOnlyBuffer<float> w;
|
||||
public readonly ReadOnlyBuffer<float> b;
|
||||
public readonly ReadWriteBuffer<float> y;
|
||||
private readonly int n;
|
||||
private readonly int m;
|
||||
private readonly int p;
|
||||
private readonly ReadOnlyBuffer<float> x;
|
||||
private readonly ReadOnlyBuffer<float> w;
|
||||
private readonly ReadOnlyBuffer<float> b;
|
||||
private readonly ReadWriteBuffer<float> y;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
|
||||
@@ -111,7 +111,7 @@ public partial class DispatchingBenchmark : IDisposable
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct TestShader : IComputeShader
|
||||
{
|
||||
public readonly ReadWriteBuffer<float> buffer;
|
||||
private readonly ReadWriteBuffer<float> buffer;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
|
||||
@@ -23,37 +23,37 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
/// <summary>
|
||||
/// The <see cref="ComputeSharp.GraphicsDevice"/> instance in use.
|
||||
/// </summary>
|
||||
private readonly GraphicsDevice GraphicsDevice;
|
||||
private readonly GraphicsDevice graphicsDevice;
|
||||
|
||||
/// <summary>
|
||||
/// The kernel radius.
|
||||
/// </summary>
|
||||
private readonly int Radius;
|
||||
private readonly int radius;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum size of the kernel in either direction.
|
||||
/// </summary>
|
||||
private readonly int KernelSize;
|
||||
private readonly int kernelSize;
|
||||
|
||||
/// <summary>
|
||||
/// The number of components to use when applying the bokeh blur.
|
||||
/// </summary>
|
||||
private readonly int ComponentsCount;
|
||||
private readonly int componentsCount;
|
||||
|
||||
/// <summary>
|
||||
/// The kernel parameters to use for the current instance (a: X, b: Y, A: Z, B: W)
|
||||
/// </summary>
|
||||
private readonly Vector4[] KernelParameters;
|
||||
private readonly Vector4[] kernelParameters;
|
||||
|
||||
/// <summary>
|
||||
/// The kernel components for the current instance.
|
||||
/// </summary>
|
||||
private readonly Complex64[][] Kernels;
|
||||
private readonly Complex64[][] kernels;
|
||||
|
||||
/// <summary>
|
||||
/// The scaling factor for kernel values.
|
||||
/// </summary>
|
||||
private readonly float KernelsScale;
|
||||
private readonly float kernelsScale;
|
||||
|
||||
/// <summary>
|
||||
/// The mapping of initialized complex kernels and parameters, to speed up the initialization of new <see cref="HlslBokehBlurProcessor"/> instances.
|
||||
@@ -70,29 +70,29 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
public Implementation(HlslBokehBlurProcessor definition, Configuration configuration, Image<ImageSharpRgba32> source, Rectangle sourceRectangle)
|
||||
: base(configuration, source, sourceRectangle)
|
||||
{
|
||||
GraphicsDevice = definition.GraphicsDevice;
|
||||
Radius = definition.Radius;
|
||||
KernelSize = Radius * 2 + 1;
|
||||
ComponentsCount = definition.Components;
|
||||
graphicsDevice = definition.GraphicsDevice;
|
||||
radius = definition.Radius;
|
||||
kernelSize = radius * 2 + 1;
|
||||
componentsCount = definition.Components;
|
||||
|
||||
// Reuse the initialized values from the cache, if possible
|
||||
var parameters = (Radius, ComponentsCount);
|
||||
var parameters = (radius, componentsCount);
|
||||
if (Cache.TryGetValue(parameters, out var info))
|
||||
{
|
||||
KernelParameters = info.Parameters;
|
||||
KernelsScale = info.Scale;
|
||||
Kernels = info.Kernels;
|
||||
kernelParameters = info.Parameters;
|
||||
kernelsScale = info.Scale;
|
||||
kernels = info.Kernels;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Initialize the complex kernels and parameters with the current arguments
|
||||
(KernelParameters, KernelsScale) = GetParameters();
|
||||
Kernels = CreateComplexKernels();
|
||||
(kernelParameters, kernelsScale) = GetParameters();
|
||||
kernels = CreateComplexKernels();
|
||||
|
||||
NormalizeKernels();
|
||||
|
||||
// Store them in the cache for future use
|
||||
Cache.TryAdd(parameters, (KernelParameters, KernelsScale, Kernels));
|
||||
Cache.TryAdd(parameters, (kernelParameters, kernelsScale, kernels));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
private (Vector4[] Parameters, float Scale) GetParameters()
|
||||
{
|
||||
// Prepare the kernel components
|
||||
int index = Math.Max(0, Math.Min(ComponentsCount - 1, KernelComponents.Count));
|
||||
int index = Math.Max(0, Math.Min(componentsCount - 1, KernelComponents.Count));
|
||||
|
||||
return (KernelComponents[index], KernelScales[index]);
|
||||
}
|
||||
@@ -171,10 +171,10 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
/// </summary>
|
||||
private Complex64[][] CreateComplexKernels()
|
||||
{
|
||||
var kernels = new Complex64[KernelParameters.Length][];
|
||||
ref Vector4 baseRef = ref MemoryMarshal.GetReference(KernelParameters.AsSpan());
|
||||
var kernels = new Complex64[kernelParameters.Length][];
|
||||
ref Vector4 baseRef = ref MemoryMarshal.GetReference(kernelParameters.AsSpan());
|
||||
|
||||
for (int i = 0; i < KernelParameters.Length; i++)
|
||||
for (int i = 0; i < kernelParameters.Length; i++)
|
||||
{
|
||||
ref Vector4 paramsRef = ref Unsafe.Add(ref baseRef, i);
|
||||
|
||||
@@ -191,15 +191,15 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
/// <param name="b">The angle component for each complex component.</param>
|
||||
private Complex64[] CreateComplex1DKernel(float a, float b)
|
||||
{
|
||||
var kernel = new Complex64[KernelSize];
|
||||
var kernel = new Complex64[kernelSize];
|
||||
ref Complex64 baseRef = ref MemoryMarshal.GetReference(kernel.AsSpan());
|
||||
int r = Radius;
|
||||
int r = radius;
|
||||
int n = -r;
|
||||
|
||||
for (int i = 0; i < KernelSize; i++, n++)
|
||||
for (int i = 0; i < kernelSize; i++, n++)
|
||||
{
|
||||
// Incrementally compute the range values
|
||||
float value = n * KernelsScale * (1f / r);
|
||||
float value = n * kernelsScale * (1f / r);
|
||||
|
||||
value *= value;
|
||||
|
||||
@@ -219,11 +219,11 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
{
|
||||
// Calculate the complex weighted sum
|
||||
float total = 0;
|
||||
Span<Complex64[]> kernelsSpan = Kernels.AsSpan();
|
||||
Span<Complex64[]> kernelsSpan = kernels.AsSpan();
|
||||
ref Complex64[] baseKernelsRef = ref MemoryMarshal.GetReference(kernelsSpan);
|
||||
ref Vector4 baseParamsRef = ref MemoryMarshal.GetReference(KernelParameters.AsSpan());
|
||||
ref Vector4 baseParamsRef = ref MemoryMarshal.GetReference(kernelParameters.AsSpan());
|
||||
|
||||
for (int i = 0; i < KernelParameters.Length; i++)
|
||||
for (int i = 0; i < kernelParameters.Length; i++)
|
||||
{
|
||||
ref Complex64[] kernelRef = ref Unsafe.Add(ref baseKernelsRef, i);
|
||||
int length = kernelRef.Length;
|
||||
@@ -270,23 +270,23 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
|
||||
Span<Rgba32> span = MemoryMarshal.Cast<ImageSharpRgba32, Rgba32>(pixelMemory.Span);
|
||||
|
||||
using ReadWriteTexture2D<Rgba32, float4> texture = GraphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(span, source.Width, source.Height);
|
||||
using ReadWriteTexture2D<float4> temporary = GraphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height, AllocationMode.Clear);
|
||||
using ReadWriteTexture2D<float4> reals = GraphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height);
|
||||
using ReadWriteTexture2D<float4> imaginaries = GraphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height);
|
||||
using ReadOnlyBuffer<Complex64> kernel = GraphicsDevice.AllocateReadOnlyBuffer<Complex64>(KernelSize);
|
||||
using ReadWriteTexture2D<Rgba32, float4> texture = graphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(span, source.Width, source.Height);
|
||||
using ReadWriteTexture2D<float4> temporary = graphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height, AllocationMode.Clear);
|
||||
using ReadWriteTexture2D<float4> reals = graphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height);
|
||||
using ReadWriteTexture2D<float4> imaginaries = graphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height);
|
||||
using ReadOnlyBuffer<Complex64> kernel = graphicsDevice.AllocateReadOnlyBuffer<Complex64>(kernelSize);
|
||||
|
||||
// Preliminary gamma highlight pass
|
||||
GraphicsDevice.For<GammaHighlightProcessor>(source.Height, new(texture));
|
||||
graphicsDevice.For<GammaHighlightProcessor>(source.Height, new(texture));
|
||||
|
||||
// Perform two 1D convolutions for each component in the current instance
|
||||
for (int j = 0; j < Kernels.Length; j++)
|
||||
for (int j = 0; j < kernels.Length; j++)
|
||||
{
|
||||
Vector4 parameters = KernelParameters[j];
|
||||
Vector4 parameters = kernelParameters[j];
|
||||
|
||||
kernel.CopyFrom(Kernels[j]);
|
||||
kernel.CopyFrom(kernels[j]);
|
||||
|
||||
using var context = GraphicsDevice.CreateComputeContext();
|
||||
using var context = graphicsDevice.CreateComputeContext();
|
||||
|
||||
context.For<VerticalConvolutionProcessor>(
|
||||
source.Width,
|
||||
@@ -303,7 +303,7 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
}
|
||||
|
||||
// Apply the inverse gamma exposure pass
|
||||
GraphicsDevice.For<InverseGammaHighlightProcessor>(source.Height, new(temporary, texture));
|
||||
graphicsDevice.For<InverseGammaHighlightProcessor>(source.Height, new(temporary, texture));
|
||||
|
||||
// Write the final pixel data
|
||||
texture.CopyTo(span);
|
||||
@@ -315,10 +315,10 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
[AutoConstructor]
|
||||
internal partial struct VerticalConvolutionProcessor : IComputeShader
|
||||
{
|
||||
public IReadWriteNormalizedTexture2D<float4> source;
|
||||
public ReadWriteTexture2D<float4> reals;
|
||||
public ReadWriteTexture2D<float4> imaginaries;
|
||||
public ReadOnlyBuffer<Complex64> kernel;
|
||||
private IReadWriteNormalizedTexture2D<float4> source;
|
||||
private ReadWriteTexture2D<float4> reals;
|
||||
private ReadWriteTexture2D<float4> imaginaries;
|
||||
private ReadOnlyBuffer<Complex64> kernel;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
@@ -352,13 +352,13 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
[AutoConstructor]
|
||||
internal partial struct HorizontalConvolutionAndAccumulatePartialsProcessor : IComputeShader
|
||||
{
|
||||
public float z;
|
||||
public float w;
|
||||
private float z;
|
||||
private float w;
|
||||
|
||||
public ReadWriteTexture2D<float4> reals;
|
||||
public ReadWriteTexture2D<float4> imaginaries;
|
||||
public ReadWriteTexture2D<float4> target;
|
||||
public ReadOnlyBuffer<Complex64> kernel;
|
||||
private ReadWriteTexture2D<float4> reals;
|
||||
private ReadWriteTexture2D<float4> imaginaries;
|
||||
private ReadWriteTexture2D<float4> target;
|
||||
private ReadOnlyBuffer<Complex64> kernel;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
@@ -391,7 +391,7 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct GammaHighlightProcessor : IComputeShader
|
||||
{
|
||||
public readonly IReadWriteNormalizedTexture2D<float4> source;
|
||||
private readonly IReadWriteNormalizedTexture2D<float4> source;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
@@ -415,8 +415,8 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct InverseGammaHighlightProcessor : IComputeShader
|
||||
{
|
||||
public readonly ReadWriteTexture2D<float4> source;
|
||||
public readonly IReadWriteNormalizedTexture2D<float4> target;
|
||||
private readonly ReadWriteTexture2D<float4> source;
|
||||
private readonly IReadWriteNormalizedTexture2D<float4> target;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
|
||||
@@ -52,7 +52,8 @@ public sealed partial class HlslGaussianBlurProcessor : IImageProcessor
|
||||
/// <param name="radius">The radius value representing the size of the area to sample (this should be at least twice the sigma value)</param>
|
||||
public HlslGaussianBlurProcessor(GraphicsDevice device, float sigma, int radius)
|
||||
{
|
||||
GraphicsDevice = device;
|
||||
graphicsDevice = device;
|
||||
|
||||
Sigma = sigma;
|
||||
Radius = radius;
|
||||
}
|
||||
@@ -60,7 +61,7 @@ public sealed partial class HlslGaussianBlurProcessor : IImageProcessor
|
||||
/// <summary>
|
||||
/// The <see cref="ComputeSharp.GraphicsDevice"/> instance in use.
|
||||
/// </summary>
|
||||
private readonly GraphicsDevice GraphicsDevice;
|
||||
private readonly GraphicsDevice graphicsDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sigma value representing the weight of the blur.
|
||||
|
||||
+14
-14
@@ -19,12 +19,12 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
/// <summary>
|
||||
/// The <see cref="ComputeSharp.GraphicsDevice"/> instance in use.
|
||||
/// </summary>
|
||||
private readonly GraphicsDevice GraphicsDevice;
|
||||
private readonly GraphicsDevice graphicsDevice;
|
||||
|
||||
/// <summary>
|
||||
/// The 1D kernel to apply.
|
||||
/// </summary>
|
||||
private readonly float[] Kernel;
|
||||
private readonly float[] kernel;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Implementation"/> class.
|
||||
@@ -38,8 +38,8 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
{
|
||||
int kernelSize = definition.Radius * 2 + 1;
|
||||
|
||||
GraphicsDevice = definition.GraphicsDevice;
|
||||
Kernel = CreateGaussianBlurKernel(kernelSize, definition.Sigma);
|
||||
graphicsDevice = definition.graphicsDevice;
|
||||
kernel = CreateGaussianBlurKernel(kernelSize, definition.Sigma);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -100,11 +100,11 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
|
||||
Span<Rgba32> span = MemoryMarshal.Cast<ImageSharpRgba32, Rgba32>(pixelMemory.Span);
|
||||
|
||||
using ReadWriteTexture2D<Rgba32, float4> sourceTexture = GraphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(span, source.Width, source.Height);
|
||||
using ReadWriteTexture2D<Rgba32, float4> firstPassTexture = GraphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(source.Width, source.Height);
|
||||
using ReadOnlyBuffer<float> kernelBuffer = GraphicsDevice.AllocateReadOnlyBuffer(Kernel);
|
||||
using ReadWriteTexture2D<Rgba32, float4> sourceTexture = graphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(span, source.Width, source.Height);
|
||||
using ReadWriteTexture2D<Rgba32, float4> firstPassTexture = graphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(source.Width, source.Height);
|
||||
using ReadOnlyBuffer<float> kernelBuffer = graphicsDevice.AllocateReadOnlyBuffer(kernel);
|
||||
|
||||
using (var context = GraphicsDevice.CreateComputeContext())
|
||||
using (var context = graphicsDevice.CreateComputeContext())
|
||||
{
|
||||
context.For<VerticalConvolutionProcessor>(source.Width, source.Height, new(sourceTexture, firstPassTexture, kernelBuffer));
|
||||
context.Barrier(firstPassTexture);
|
||||
@@ -120,9 +120,9 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct VerticalConvolutionProcessor : IComputeShader
|
||||
{
|
||||
public readonly IReadWriteNormalizedTexture2D<float4> source;
|
||||
public readonly IReadWriteNormalizedTexture2D<float4> target;
|
||||
public readonly ReadOnlyBuffer<float> kernel;
|
||||
private readonly IReadWriteNormalizedTexture2D<float4> source;
|
||||
private readonly IReadWriteNormalizedTexture2D<float4> target;
|
||||
private readonly ReadOnlyBuffer<float> kernel;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
@@ -152,9 +152,9 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct HorizontalConvolutionProcessor : IComputeShader
|
||||
{
|
||||
public readonly IReadWriteNormalizedTexture2D<float4> source;
|
||||
public readonly IReadWriteNormalizedTexture2D<float4> target;
|
||||
public readonly ReadOnlyBuffer<float> kernel;
|
||||
private readonly IReadWriteNormalizedTexture2D<float4> source;
|
||||
private readonly IReadWriteNormalizedTexture2D<float4> target;
|
||||
private readonly ReadOnlyBuffer<float> kernel;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace ComputeSharp.Sample.FSharp.Shaders;
|
||||
[AutoConstructor]
|
||||
public readonly partial struct MultiplyByTwo : IComputeShader
|
||||
{
|
||||
public readonly ReadWriteBuffer<float> buffer;
|
||||
private readonly ReadWriteBuffer<float> buffer;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
|
||||
@@ -26,7 +26,7 @@ Formatting.PrintMatrix(array, 10, 10, "AFTER");
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct MultiplyByTwo : IComputeShader
|
||||
{
|
||||
public readonly ReadWriteBuffer<float> buffer;
|
||||
private readonly ReadWriteBuffer<float> buffer;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
|
||||
@@ -15,7 +15,7 @@ internal readonly partial struct ColorfulInfinity : IPixelShader<float4>
|
||||
/// <summary>
|
||||
/// The current time since the start of the application.
|
||||
/// </summary>
|
||||
public readonly float time;
|
||||
private readonly float time;
|
||||
|
||||
/// <summary>
|
||||
/// The total number of layers for the final animation.
|
||||
|
||||
@@ -14,12 +14,12 @@ internal readonly partial struct ContouredLayers : IPixelShader<float4>
|
||||
/// <summary>
|
||||
/// The current time Hlsl.Since the start of the application.
|
||||
/// </summary>
|
||||
public readonly float time;
|
||||
private readonly float time;
|
||||
|
||||
/// <summary>
|
||||
/// The background texture to sample.
|
||||
/// </summary>
|
||||
public readonly IReadOnlyNormalizedTexture2D<float4> texture;
|
||||
private readonly IReadOnlyNormalizedTexture2D<float4> texture;
|
||||
|
||||
// float3 to float hash.
|
||||
private static float Hash21(float2 p)
|
||||
|
||||
@@ -14,7 +14,7 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
|
||||
/// <summary>
|
||||
/// The current time since the start of the application.
|
||||
/// </summary>
|
||||
public readonly float time;
|
||||
private readonly float time;
|
||||
|
||||
/// <summary>
|
||||
/// Curve shape - Round: 0, Semi-round: 1, Octagonal: 2, Superellipse: 3, Straight: 4.
|
||||
|
||||
@@ -15,13 +15,13 @@ internal readonly partial struct FourColorGradient : IPixelShader<float4>
|
||||
/// <summary>
|
||||
/// The current time since the start of the application.
|
||||
/// </summary>
|
||||
public readonly float time;
|
||||
private readonly float time;
|
||||
|
||||
// Colors to blend together
|
||||
private static readonly float3 colorOne = new(0.999f, 0.999f, 0.999f);
|
||||
private static readonly float3 colorTwo = new(0.999f, 0f, 0f);
|
||||
private static readonly float3 colorThree = new(0f, 0.999f, 0f);
|
||||
private static readonly float3 colorFour = new(0f, 0f, 0.999f);
|
||||
private static readonly float3 ColorOne = new(0.999f, 0.999f, 0.999f);
|
||||
private static readonly float3 ColorTwo = new(0.999f, 0f, 0f);
|
||||
private static readonly float3 ColorThree = new(0f, 0.999f, 0f);
|
||||
private static readonly float3 ColorFour = new(0f, 0f, 0.999f);
|
||||
|
||||
/// <summary>
|
||||
/// Standard 2D rotation formula.
|
||||
@@ -99,8 +99,8 @@ internal readonly partial struct FourColorGradient : IPixelShader<float4>
|
||||
tuv.Y += Hlsl.Sin(tuv.X * frequency * 1.5f + speed) / (amplitude * 0.5f);
|
||||
|
||||
// Draw the image
|
||||
float3 layer1 = Hlsl.Lerp(colorOne, colorTwo, Hlsl.SmoothStep(-0.3f, 0.2f, Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(-5.0f))).X));
|
||||
float3 layer2 = Hlsl.Lerp(colorThree, colorFour, Hlsl.SmoothStep(-0.3f, 0.2f, Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(-5.0f))).X));
|
||||
float3 layer1 = Hlsl.Lerp(ColorOne, ColorTwo, Hlsl.SmoothStep(-0.3f, 0.2f, Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(-5.0f))).X));
|
||||
float3 layer2 = Hlsl.Lerp(ColorThree, ColorFour, Hlsl.SmoothStep(-0.3f, 0.2f, Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(-5.0f))).X));
|
||||
float3 col = Hlsl.Lerp(layer1, layer2, Hlsl.SmoothStep(0.5f, -0.3f, tuv.Y));
|
||||
|
||||
return new(col, 1.0f);
|
||||
|
||||
@@ -15,7 +15,7 @@ internal readonly partial struct FractalTiling : IPixelShader<float4>
|
||||
/// <summary>
|
||||
/// The current time since the start of the application.
|
||||
/// </summary>
|
||||
public readonly float time;
|
||||
private readonly float time;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
|
||||
@@ -13,7 +13,7 @@ internal readonly partial struct HelloWorld : IPixelShader<float4>
|
||||
/// <summary>
|
||||
/// The current time since the start of the application.
|
||||
/// </summary>
|
||||
public readonly float time;
|
||||
private readonly float time;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
|
||||
@@ -14,7 +14,7 @@ internal readonly partial struct MengerJourney : IPixelShader<float4>
|
||||
/// <summary>
|
||||
/// The current time since the start of the application.
|
||||
/// </summary>
|
||||
public readonly float time;
|
||||
private readonly float time;
|
||||
|
||||
private const int MaxSteps = 30;
|
||||
private const float MinimumDistance = 0.0009f;
|
||||
@@ -100,7 +100,7 @@ internal readonly partial struct MengerJourney : IPixelShader<float4>
|
||||
/// <summary>
|
||||
/// Calculates the finite difference normal at a given position.
|
||||
/// </summary>
|
||||
private float3 getNormal(in float3 pos)
|
||||
private float3 GetNormal(in float3 pos)
|
||||
{
|
||||
float3 e = new(0.0f, NormalDistance, 0.0f);
|
||||
|
||||
@@ -141,7 +141,7 @@ internal readonly partial struct MengerJourney : IPixelShader<float4>
|
||||
|
||||
float smoothStep = steps + distance / MinimumDistance;
|
||||
float ao = 1.1f - smoothStep / MaxSteps;
|
||||
float3 normal = getNormal(pos - dir * NormalDistance * 3.0f);
|
||||
float3 normal = GetNormal(pos - dir * NormalDistance * 3.0f);
|
||||
float3 color = 1.0f;
|
||||
float3 light = GetLight(color, normal);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ internal readonly partial struct Octagrams : IPixelShader<float4>
|
||||
/// <summary>
|
||||
/// The current time since the start of the application.
|
||||
/// </summary>
|
||||
public readonly float time;
|
||||
private readonly float time;
|
||||
|
||||
private static float2x2 Rotate(float a)
|
||||
{
|
||||
|
||||
@@ -15,9 +15,9 @@ internal readonly partial struct ProteanClouds : IPixelShader<float4>
|
||||
/// <summary>
|
||||
/// The current time Hlsl.Since the start of the application.
|
||||
/// </summary>
|
||||
public readonly float time;
|
||||
private readonly float time;
|
||||
|
||||
private static readonly float3x3 m3 = new float3x3(0.33338f, 0.56034f, -0.71817f, -0.87887f, 0.32651f, -0.15323f, 0.15162f, 0.69596f, 0.61339f) * 1.93f;
|
||||
private static readonly float3x3 M3 = new float3x3(0.33338f, 0.56034f, -0.71817f, -0.87887f, 0.32651f, -0.15323f, 0.15162f, 0.69596f, 0.61339f) * 1.93f;
|
||||
|
||||
private static float2x2 Rotate(in float a)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ internal readonly partial struct ProteanClouds : IPixelShader<float4>
|
||||
z *= 0.57f;
|
||||
trk *= 1.4f;
|
||||
|
||||
p = Hlsl.Mul(p, m3);
|
||||
p = Hlsl.Mul(p, M3);
|
||||
}
|
||||
|
||||
d = Hlsl.Abs(d + prm1 * 3.0f) + prm1 * 0.3f - 2.5f + bsMo.Y;
|
||||
|
||||
@@ -15,7 +15,7 @@ internal readonly partial struct PyramidPattern : IPixelShader<float4>
|
||||
/// <summary>
|
||||
/// The current time Hlsl.Since the start of the application.
|
||||
/// </summary>
|
||||
public readonly float time;
|
||||
private readonly float time;
|
||||
|
||||
// Standard 2D rotation formula.
|
||||
private static float2x2 Rotate2x2(in float a)
|
||||
|
||||
@@ -14,7 +14,7 @@ internal readonly partial struct TriangleGridContouring : IPixelShader<float4>
|
||||
/// <summary>
|
||||
/// The current time Hlsl.Since the start of the application.
|
||||
/// </summary>
|
||||
public readonly float time;
|
||||
private readonly float time;
|
||||
|
||||
// Standard 2D rotation formula.
|
||||
private static float2x2 Rotate2x2(in float a)
|
||||
@@ -60,7 +60,6 @@ internal readonly partial struct TriangleGridContouring : IPixelShader<float4>
|
||||
return Hlsl.Lerp(Hlsl.Lerp(v.X, v.Y, p.X), Hlsl.Lerp(v.Z, v.W, p.X), p.Y);
|
||||
}
|
||||
|
||||
|
||||
// The isofunction. Just a Hlsl.Single noise function, but it can be more elaborate.
|
||||
private float IsoFunction(in float2 p)
|
||||
{
|
||||
@@ -78,7 +77,7 @@ internal readonly partial struct TriangleGridContouring : IPixelShader<float4>
|
||||
}
|
||||
|
||||
// Based on IQ's signed distance to the segment joining "a" and "b".
|
||||
private static float distEdge(float2 a, float2 b)
|
||||
private static float DistEdge(float2 a, float2 b)
|
||||
{
|
||||
return Hlsl.Dot((a + b) * 0.5f, Hlsl.Normalize((b - a).YX * new float2(-1, 1)));
|
||||
}
|
||||
@@ -188,7 +187,7 @@ internal readonly partial struct TriangleGridContouring : IPixelShader<float4>
|
||||
float2 p1 = default;
|
||||
int iTh = IsoLine(n3, ip0, ip1, ip2, isovalue, i, ref p0, ref p1);
|
||||
|
||||
d = Hlsl.Min(d, distEdge(p - p0, p - p1));
|
||||
d = Hlsl.Min(d, DistEdge(p - p0, p - p1));
|
||||
|
||||
if (iTh == 7)
|
||||
{
|
||||
@@ -206,9 +205,7 @@ internal readonly partial struct TriangleGridContouring : IPixelShader<float4>
|
||||
|
||||
int iTh2 = IsoLine(n3, ip0, ip1, ip2, isovalue, i, ref p0, ref p1);
|
||||
|
||||
d2 = Hlsl.Min(d2, distEdge(p - p0, p - p1));
|
||||
|
||||
float oldD2 = d2;
|
||||
d2 = Hlsl.Min(d2, DistEdge(p - p0, p - p1));
|
||||
|
||||
if (iTh2 == 7) d2 = 0.0f;
|
||||
if (iTh == 7) d2 = 1e5f;
|
||||
|
||||
@@ -14,7 +14,7 @@ internal readonly partial struct TwoTiledTruchet : IPixelShader<float4>
|
||||
/// <summary>
|
||||
/// The current time since the start of the application.
|
||||
/// </summary>
|
||||
public readonly float time;
|
||||
private readonly float time;
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the Truchet distance field.
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする