Fix nested .editorconfig files and unit test IDE warnings

このコミットが含まれているのは:
Sergio Pedri committed 2022-10-15 09:10:18 -07:00
1 親 746f132182
コミット 1c26d37bc3
17ファイル変更
+133 -77

検索条件に一致するファイルはありません

+17 -1
ファイルの表示
@@ -1,2 +1,18 @@
# Disable all rules from above directories
root = true
root = true
# All files
[*]
# Encoding
charset = utf-8
# Indentation and spacing
tab_width = 4
indent_size = 4
indent_style = space
# New line preferences
end_of_line = crlf
insert_final_newline = false
trim_trailing_whitespace = true
+17 -1
ファイルの表示
@@ -1,2 +1,18 @@
# Disable all rules from above directories
root = true
root = true
# All files
[*]
# Encoding
charset = utf-8
# Indentation and spacing
tab_width = 4
indent_size = 4
indent_style = space
# New line preferences
end_of_line = crlf
insert_final_newline = false
trim_trailing_whitespace = true
+17 -1
ファイルの表示
@@ -1,2 +1,18 @@
# Disable all rules from above directories
root = true
root = true
# All files
[*]
# Encoding
charset = utf-8
# Indentation and spacing
tab_width = 4
indent_size = 4
indent_style = space
# New line preferences
end_of_line = crlf
insert_final_newline = false
trim_trailing_whitespace = true
+8 -2
ファイルの表示
@@ -1,2 +1,8 @@
# Disable naming rule violation warnings just for unit tests
dotnet_diagnostic.IDE1006.severity = none
# C# files
[*.cs]
# Disable fields naming rule violation warnings just for unit tests
dotnet_naming_rule.private_fields_must_be_pascal_case.severity = none
dotnet_naming_rule.constant_fields_must_be_pascal_case.severity = none
dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.severity = none
dotnet_naming_rule.non_private_fields_must_be_pascal_case.severity = none
+37 -35
ファイルの表示
@@ -31,40 +31,40 @@ using D2D1 = Win32.Graphics.Direct2D.Apis;
/// </summary>
public sealed partial class BokehBlurEffect
{
/// <summary>
/// The mapping of initialized complex kernels and parameters, to speed up the initialization of new <see cref="BokehBlurEffect"/> instances.
/// </summary>
private static readonly ConcurrentDictionary<(int Radius, int ComponentsCount), (Vector4[] Parameters, float Scale, (float[] Real, float[] Imaginary)[] Kernels)> Cache = new();
/// <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 (float[] Real, float[] Imaginary)[] Kernels;
private readonly (float[] Real, float[] Imaginary)[] kernels;
/// <summary>
/// The scaling factor for kernel values.
/// </summary>
private readonly float KernelsScale;
/// <summary>
/// The mapping of initialized complex kernels and parameters, to speed up the initialization of new <see cref="BokehBlurEffect"/> instances.
/// </summary>
private static readonly ConcurrentDictionary<(int Radius, int ComponentsCount), (Vector4[] Parameters, float Scale, (float[] Real, float[] Imaginary)[] Kernels)> Cache = new();
private readonly float kernelsScale;
/// <summary>
/// Initializes a new instance of the <see cref="BokehBlurEffect"/> class.
@@ -73,30 +73,32 @@ public sealed partial class BokehBlurEffect
/// <param name="componentsCount">The number of components to use to approximate the original 2D bokeh blur convolution kernel.</param>
public BokehBlurEffect(int radius, int componentsCount)
{
Radius = radius;
KernelSize = Radius * 2 + 1;
ComponentsCount = componentsCount;
this.radius = radius;
this.kernelSize = this.radius * 2 + 1;
this.componentsCount = componentsCount;
// Reuse the initialized values from the cache, if possible
var parameters = (Radius, ComponentsCount);
var parameters = (this.radius, this.componentsCount);
if (Cache.TryGetValue(parameters, out var info))
{
KernelParameters = info.Parameters;
KernelsScale = info.Scale;
Kernels = info.Kernels;
this.kernelParameters = info.Parameters;
this.kernelsScale = info.Scale;
this.kernels = info.Kernels;
}
else
{
// Initialize the complex kernels and parameters with the current arguments
(KernelParameters, KernelsScale) = GetParameters();
(this.kernelParameters, this.kernelsScale) = GetParameters();
var kernels = CreateComplexKernels();
NormalizeKernels(kernels, KernelParameters);
NormalizeKernels(kernels, this.kernelParameters);
Kernels = ConvertKernelsToStructureOfArrays(kernels);
this.kernels = ConvertKernelsToStructureOfArrays(kernels);
// Store them in the cache for future use
Cache.TryAdd(parameters, (KernelParameters, KernelsScale, Kernels));
_ = Cache.TryAdd(parameters, (this.kernelParameters, this.kernelsScale, this.kernels));
}
}
@@ -165,7 +167,7 @@ public sealed partial class BokehBlurEffect
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]);
}
@@ -175,10 +177,10 @@ public sealed partial class BokehBlurEffect
/// </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);
@@ -195,15 +197,15 @@ public sealed partial class BokehBlurEffect
/// <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;
@@ -319,7 +321,7 @@ public sealed partial class BokehBlurEffect
D2D1PixelShaderEffect.RegisterForD2D1Factory1<GammaHighlight>(d2D1Factory2.Get(), out _);
D2D1PixelShaderEffect.RegisterForD2D1Factory1<InverseGammaHighlight>(d2D1Factory2.Get(), out _);
int numberOfComponents = KernelParameters.Length;
int numberOfComponents = kernelParameters.Length;
using ComPtr<ID2D1Effect> gammaExposureEffect = default;
using ComPtr<ID2D1Effect> inverseGammaExposureEffect = default;
@@ -379,7 +381,7 @@ public sealed partial class BokehBlurEffect
using ComPtr<ID2D1Bitmap> d2D1BitmapTarget = D2D1Helper.CreateD2D1BitmapAndSetAsTarget(d2D1DeviceContext.Get(), width, height);
(D2D1ResourceTextureManager Reals, D2D1ResourceTextureManager Imaginaries)[] kernels = new (D2D1ResourceTextureManager, D2D1ResourceTextureManager)[numberOfComponents];
uint kernelSize = (uint)KernelSize;
uint kernelSize = (uint)this.kernelSize;
for (int i = 0; i < numberOfComponents; i++)
{
@@ -390,7 +392,7 @@ public sealed partial class BokehBlurEffect
channelDepth: D2D1ChannelDepth.One,
filter: D2D1Filter.MinMagMipPoint,
extendModes: stackalloc[] { D2D1ExtendMode.Clamp },
data: MemoryMarshal.AsBytes(Kernels[i].Real.AsSpan()),
data: MemoryMarshal.AsBytes(this.kernels[i].Real.AsSpan()),
strides: ReadOnlySpan<uint>.Empty);
// Also create the one for the imaginary kernel
@@ -400,7 +402,7 @@ public sealed partial class BokehBlurEffect
channelDepth: D2D1ChannelDepth.One,
filter: D2D1Filter.MinMagMipPoint,
extendModes: stackalloc[] { D2D1ExtendMode.Clamp },
data: MemoryMarshal.AsBytes(Kernels[i].Imaginary.AsSpan()),
data: MemoryMarshal.AsBytes(this.kernels[i].Imaginary.AsSpan()),
strides: ReadOnlySpan<uint>.Empty);
kernels[i] = (kernelReals, kernelImaginary);
@@ -420,7 +422,7 @@ public sealed partial class BokehBlurEffect
{
D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect(new VerticalConvolution.Shader((int)kernelSize), verticalConvolutionEffectsForReals[i].Get());
D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect(new VerticalConvolution.Shader((int)kernelSize), verticalConvolutionEffectsForImaginaries[i].Get());
D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect(new HorizontalConvolutionAndAccumulatePartials.Shader((int)kernelSize, KernelParameters[i].Z, KernelParameters[i].W), horizontalConvolutionEffects[i].Get());
D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect(new HorizontalConvolutionAndAccumulatePartials.Shader((int)kernelSize, kernelParameters[i].Z, kernelParameters[i].W), horizontalConvolutionEffects[i].Get());
}
// Build the effect graph:
+2 -2
ファイルの表示
@@ -12,12 +12,12 @@ internal readonly partial struct ColorfulInfinity : IComputeShader
/// <summary>
/// The target texture.
/// </summary>
public readonly IReadWriteNormalizedTexture2D<float4> texture;
private readonly IReadWriteNormalizedTexture2D<float4> texture;
/// <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.
+3 -3
ファイルの表示
@@ -11,17 +11,17 @@ internal readonly partial struct ContouredLayers : IComputeShader
/// <summary>
/// The target texture.
/// </summary>
public readonly IReadWriteNormalizedTexture2D<float4> destination;
private readonly IReadWriteNormalizedTexture2D<float4> destination;
/// <summary>
/// The current time Hlsl.Since the start of the application.
/// </summary>
public readonly float time;
private readonly float time;
/// <summary>
/// The sampling texture.
/// </summary>
public readonly IReadOnlyNormalizedTexture2D<float4> texture;
private readonly IReadOnlyNormalizedTexture2D<float4> texture;
// float3 to float hash.
private static float Hash21(float2 p)
+2 -2
ファイルの表示
@@ -11,12 +11,12 @@ internal readonly partial struct ExtrudedTruchetPattern : IComputeShader
/// <summary>
/// The target texture.
/// </summary>
public readonly IReadWriteNormalizedTexture2D<float4> texture;
private readonly IReadWriteNormalizedTexture2D<float4> texture;
/// <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.
+8 -8
ファイルの表示
@@ -12,18 +12,18 @@ internal readonly partial struct FourColorGradient : IComputeShader
/// <summary>
/// The target texture.
/// </summary>
public readonly IReadWriteNormalizedTexture2D<float4> texture;
private readonly IReadWriteNormalizedTexture2D<float4> texture;
/// <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.
@@ -101,8 +101,8 @@ internal readonly partial struct FourColorGradient : IComputeShader
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));
texture[ThreadIds.XY] = new float4(col, 1.0f);
+2 -2
ファイルの表示
@@ -12,12 +12,12 @@ internal readonly partial struct FractalTiling : IComputeShader
/// <summary>
/// The target texture.
/// </summary>
public readonly IReadWriteNormalizedTexture2D<float4> texture;
private readonly IReadWriteNormalizedTexture2D<float4> texture;
/// <summary>
/// The current time since the start of the application.
/// </summary>
public readonly float time;
private readonly float time;
/// <inheritdoc/>
public void Execute()
+1 -1
ファイルの表示
@@ -10,7 +10,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()
+4 -4
ファイルの表示
@@ -11,12 +11,12 @@ internal readonly partial struct MengerJourney : IComputeShader
/// <summary>
/// The target texture.
/// </summary>
public readonly IReadWriteNormalizedTexture2D<float4> texture;
private readonly IReadWriteNormalizedTexture2D<float4> texture;
/// <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;
@@ -102,7 +102,7 @@ internal readonly partial struct MengerJourney : IComputeShader
/// <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);
@@ -143,7 +143,7 @@ internal readonly partial struct MengerJourney : IComputeShader
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);
+2 -2
ファイルの表示
@@ -11,12 +11,12 @@ internal readonly partial struct Octagrams : IComputeShader
/// <summary>
/// The target texture.
/// </summary>
public readonly IReadWriteNormalizedTexture2D<float4> texture;
private readonly IReadWriteNormalizedTexture2D<float4> texture;
/// <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)
{
+4 -4
ファイルの表示
@@ -12,14 +12,14 @@ internal readonly partial struct ProteanClouds : IComputeShader
/// <summary>
/// The target texture.
/// </summary>
public readonly IReadWriteNormalizedTexture2D<float4> texture;
private readonly IReadWriteNormalizedTexture2D<float4> texture;
/// <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)
{
@@ -62,7 +62,7 @@ internal readonly partial struct ProteanClouds : IComputeShader
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;
+2 -2
ファイルの表示
@@ -12,12 +12,12 @@ internal readonly partial struct PyramidPattern : IComputeShader
/// <summary>
/// The target texture.
/// </summary>
public readonly IReadWriteNormalizedTexture2D<float4> texture;
private readonly IReadWriteNormalizedTexture2D<float4> texture;
/// <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)
+5 -5
ファイルの表示
@@ -11,12 +11,12 @@ internal readonly partial struct TriangleGridContouring : IComputeShader
/// <summary>
/// The target texture.
/// </summary>
public readonly IReadWriteNormalizedTexture2D<float4> texture;
private readonly IReadWriteNormalizedTexture2D<float4> texture;
/// <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)
@@ -80,7 +80,7 @@ internal readonly partial struct TriangleGridContouring : IComputeShader
}
// 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)));
}
@@ -190,7 +190,7 @@ internal readonly partial struct TriangleGridContouring : IComputeShader
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)
{
@@ -208,7 +208,7 @@ internal readonly partial struct TriangleGridContouring : IComputeShader
int iTh2 = IsoLine(n3, ip0, ip1, ip2, isovalue, i, ref p0, ref p1);
d2 = Hlsl.Min(d2, distEdge(p - p0, p - p1));
d2 = Hlsl.Min(d2, DistEdge(p - p0, p - p1));
float oldD2 = d2;
+2 -2
ファイルの表示
@@ -11,12 +11,12 @@ internal readonly partial struct TwoTiledTruchet : IComputeShader
/// <summary>
/// The target texture.
/// </summary>
public readonly IReadWriteNormalizedTexture2D<float4> texture;
private readonly IReadWriteNormalizedTexture2D<float4> texture;
/// <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.