Adjust field visibility, fix naming violations in non test projects
このコミットが含まれているのは:
1 親
f73915bf93
コミット
746f132182
34ファイル変更
+171
-171
検索条件に一致するファイルはありません
+4
-4
@@ -219,8 +219,8 @@ dotnet_naming_style.prefix_interface_interface_with_i.required_prefix
|
||||
|
||||
# Naming Rules
|
||||
|
||||
# Async
|
||||
dotnet_naming_rule.async_methods_end_in_async.severity = warning
|
||||
# Async methods should have the "Async" suffix (disabled because it can't currently exclude async void methods)
|
||||
dotnet_naming_rule.async_methods_end_in_async.severity = none
|
||||
dotnet_naming_rule.async_methods_end_in_async.symbols = any_async_methods
|
||||
dotnet_naming_rule.async_methods_end_in_async.style = end_in_async
|
||||
|
||||
@@ -251,8 +251,8 @@ dotnet_naming_rule.non_private_fields_must_be_pascal_case.style
|
||||
dotnet_naming_rule.public_symbols_must_be_capitalized.severity = warning
|
||||
dotnet_naming_rule.public_symbols_must_be_capitalized.symbols = public_symbols
|
||||
dotnet_naming_rule.public_symbols_must_be_capitalized.style = pascal_case
|
||||
# Parameters must be camelCase
|
||||
dotnet_naming_rule.parameters_must_be_camel_case.severity = warning
|
||||
# Parameters must be camelCase (ignored because some use PascalCase to match Win32 parameter names)
|
||||
dotnet_naming_rule.parameters_must_be_camel_case.severity = none
|
||||
dotnet_naming_rule.parameters_must_be_camel_case.symbols = parameters
|
||||
dotnet_naming_rule.parameters_must_be_camel_case.style = camel_case
|
||||
# Interfaces must be PascalCase and start with an 'I'
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -34,12 +34,12 @@ internal ref struct TryWriteFormatInterpolatedStringHandler
|
||||
/// <summary>
|
||||
/// The number of characters written to <see cref="destination"/>.
|
||||
/// </summary>
|
||||
internal int position;
|
||||
private int position;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether all formatting operations have succeeded.
|
||||
/// </summary>
|
||||
internal bool success;
|
||||
private bool success;
|
||||
|
||||
/// <summary>
|
||||
/// Whether <see cref="formatProvider"/> provides an <see cref="ICustomFormatter"/>.
|
||||
|
||||
@@ -13,7 +13,7 @@ public readonly struct Bool
|
||||
/// The wrapped <see cref="int"/> value for the current instance.
|
||||
/// </summary>
|
||||
[FieldOffset(0)]
|
||||
private readonly int Value;
|
||||
private readonly int value;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Bool"/> instance for a given <see cref="bool"/> value.
|
||||
@@ -21,19 +21,19 @@ public readonly struct Bool
|
||||
/// <param name="value">.</param>
|
||||
private Bool(bool value)
|
||||
{
|
||||
Value = value ? 1 : 0;
|
||||
this.value = value ? 1 : 0;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is Bool x && Value == x.Value;
|
||||
return obj is Bool x && value == x.value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Value.GetHashCode();
|
||||
return value.GetHashCode();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -94,20 +94,20 @@ public readonly struct Bool
|
||||
/// </summary>
|
||||
/// <param name="left">The left <see cref="Bool"/> instance.</param>
|
||||
/// <param name="right">The right <see cref="Bool"/> instance.</param>
|
||||
public static bool operator ==(Bool left, Bool right) => left.Value == right.Value;
|
||||
public static bool operator ==(Bool left, Bool right) => left.value == right.value;
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether or not two <see cref="Bool"/> instances represent a different <see cref="bool"/> value.
|
||||
/// </summary>
|
||||
/// <param name="left">The left <see cref="Bool"/> instance.</param>
|
||||
/// <param name="right">The right <see cref="Bool"/> instance.</param>
|
||||
public static bool operator !=(Bool left, Bool right) => left.Value != right.Value;
|
||||
public static bool operator !=(Bool left, Bool right) => left.value != right.value;
|
||||
|
||||
/// <summary>
|
||||
/// Converts a given <see cref="Bool"/> instance to its corresponding <see cref="bool"/> value.
|
||||
/// </summary>
|
||||
/// <param name="x">The input <see cref="Bool"/> instance.</param>
|
||||
public static implicit operator bool(Bool x) => x.Value != 0;
|
||||
public static implicit operator bool(Bool x) => x.value != 0;
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="bool"/> value to a corresponding <see cref="Bool"/> instance.
|
||||
|
||||
+3
-3
@@ -189,7 +189,7 @@ partial class ID2D1ShaderGenerator
|
||||
/// <summary>
|
||||
/// A mapping of precomputed literals for all <see cref="byte"/> values.
|
||||
/// </summary>
|
||||
private static readonly string[] formattedBytes =
|
||||
private static readonly string[] FormattedBytes =
|
||||
{
|
||||
"0x00", "0x01", "0x02", "0x03", "0x04", "0x05", "0x06", "0x07", "0x08", "0x09", "0x0A", "0x0B", "0x0C", "0x0D", "0x0E", "0x0F",
|
||||
"0x10", "0x11", "0x12", "0x13", "0x14", "0x15", "0x16", "0x17", "0x18", "0x19", "0x1A", "0x1B", "0x1C", "0x1D", "0x1E", "0x1F",
|
||||
@@ -218,12 +218,12 @@ partial class ID2D1ShaderGenerator
|
||||
{
|
||||
using ImmutableArrayBuilder<char> builder = ImmutableArrayBuilder<char>.Rent();
|
||||
|
||||
builder.AddRange(formattedBytes[bytecode[0]].AsSpan());
|
||||
builder.AddRange(FormattedBytes[bytecode[0]].AsSpan());
|
||||
|
||||
foreach (byte b in bytecode.Slice(1))
|
||||
{
|
||||
builder.AddRange(", ".AsSpan());
|
||||
builder.AddRange(formattedBytes[b].AsSpan());
|
||||
builder.AddRange(FormattedBytes[b].AsSpan());
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
|
||||
@@ -26,17 +26,17 @@ internal sealed unsafe partial class ShaderCompiler
|
||||
/// <summary>
|
||||
/// The <see cref="IDxcCompiler"/> instance to use to create the bytecode for HLSL sources.
|
||||
/// </summary>
|
||||
private readonly ComPtr<IDxcCompiler> DxcCompiler;
|
||||
private readonly ComPtr<IDxcCompiler> dxcCompiler;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IDxcLibrary"/> instance to use to work with <see cref="DxcCompiler"/>.
|
||||
/// The <see cref="IDxcLibrary"/> instance to use to work with <see cref="dxcCompiler"/>.
|
||||
/// </summary>
|
||||
private readonly ComPtr<IDxcLibrary> DxcLibrary;
|
||||
private readonly ComPtr<IDxcLibrary> dxcLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IDxcIncludeHandler"/> instance used to compile shaders with <see cref="DxcCompiler"/>.
|
||||
/// The <see cref="IDxcIncludeHandler"/> instance used to compile shaders with <see cref="dxcCompiler"/>.
|
||||
/// </summary>
|
||||
private readonly ComPtr<IDxcIncludeHandler> DxcIncludeHandler;
|
||||
private readonly ComPtr<IDxcIncludeHandler> dxcIncludeHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ShaderCompiler"/> instance.
|
||||
@@ -59,9 +59,9 @@ internal sealed unsafe partial class ShaderCompiler
|
||||
|
||||
dxcLibrary.Get()->CreateIncludeHandler(dxcIncludeHandler.GetAddressOf()).Assert();
|
||||
|
||||
DxcCompiler = dxcCompiler.Move();
|
||||
DxcLibrary = dxcLibrary.Move();
|
||||
DxcIncludeHandler = dxcIncludeHandler.Move();
|
||||
this.dxcCompiler = dxcCompiler.Move();
|
||||
this.dxcLibrary = dxcLibrary.Move();
|
||||
this.dxcIncludeHandler = dxcIncludeHandler.Move();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -69,9 +69,9 @@ internal sealed unsafe partial class ShaderCompiler
|
||||
/// </summary>
|
||||
~ShaderCompiler()
|
||||
{
|
||||
DxcCompiler.Dispose();
|
||||
DxcLibrary.Dispose();
|
||||
DxcIncludeHandler.Dispose();
|
||||
dxcCompiler.Dispose();
|
||||
dxcLibrary.Dispose();
|
||||
dxcIncludeHandler.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -93,7 +93,7 @@ internal sealed unsafe partial class ShaderCompiler
|
||||
// Get the encoded blob from the source code
|
||||
fixed (char* p = source)
|
||||
{
|
||||
DxcLibrary.Get()->CreateBlobWithEncodingOnHeapCopy(
|
||||
dxcLibrary.Get()->CreateBlobWithEncodingOnHeapCopy(
|
||||
p,
|
||||
(uint)source.Length * 2,
|
||||
1200,
|
||||
@@ -110,7 +110,7 @@ internal sealed unsafe partial class ShaderCompiler
|
||||
{
|
||||
char** arguments = stackalloc char*[3] { optimization, rowMajor, warningsAsErrors };
|
||||
|
||||
DxcCompiler.Get()->Compile(
|
||||
dxcCompiler.Get()->Compile(
|
||||
(IDxcBlob*)dxcBlobEncoding.Get(),
|
||||
(ushort*)shaderName,
|
||||
(ushort*)entryPoint,
|
||||
@@ -119,7 +119,7 @@ internal sealed unsafe partial class ShaderCompiler
|
||||
3,
|
||||
null,
|
||||
0,
|
||||
DxcIncludeHandler.Get(),
|
||||
dxcIncludeHandler.Get(),
|
||||
dxcOperationResult.GetAddressOf()).Assert();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
#pragma warning disable CS0809
|
||||
#pragma warning disable CS0809, IDE0009, IDE1006
|
||||
|
||||
namespace System;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ internal struct ImmutableArrayBuilder<T> : IDisposable
|
||||
/// <summary>
|
||||
/// The shared <see cref="ObjectPool{T}"/> instance to share <see cref="Writer"/> objects.
|
||||
/// </summary>
|
||||
private static readonly ObjectPool<Writer> sharedObjectPool = new(static () => new Writer());
|
||||
private static readonly ObjectPool<Writer> SharedObjectPool = new(static () => new Writer());
|
||||
|
||||
/// <summary>
|
||||
/// The owner <see cref="ObjectPool{T}"/> instance.
|
||||
@@ -35,7 +35,7 @@ internal struct ImmutableArrayBuilder<T> : IDisposable
|
||||
/// <returns>A <see cref="ImmutableArrayBuilder{T}"/> instance to write data to.</returns>
|
||||
public static ImmutableArrayBuilder<T> Rent()
|
||||
{
|
||||
return new(sharedObjectPool, sharedObjectPool.Allocate());
|
||||
return new(SharedObjectPool, SharedObjectPool.Allocate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -211,7 +211,7 @@ partial class IShaderGenerator
|
||||
/// <summary>
|
||||
/// A mapping of precomputed literals for all <see cref="byte"/> values.
|
||||
/// </summary>
|
||||
private static readonly string[] formattedBytes =
|
||||
private static readonly string[] FormattedBytes =
|
||||
{
|
||||
"0x00", "0x01", "0x02", "0x03", "0x04", "0x05", "0x06", "0x07", "0x08", "0x09", "0x0A", "0x0B", "0x0C", "0x0D", "0x0E", "0x0F",
|
||||
"0x10", "0x11", "0x12", "0x13", "0x14", "0x15", "0x16", "0x17", "0x18", "0x19", "0x1A", "0x1B", "0x1C", "0x1D", "0x1E", "0x1F",
|
||||
@@ -240,12 +240,12 @@ partial class IShaderGenerator
|
||||
{
|
||||
using ImmutableArrayBuilder<char> builder = ImmutableArrayBuilder<char>.Rent();
|
||||
|
||||
builder.AddRange(formattedBytes[bytecode[0]].AsSpan());
|
||||
builder.AddRange(FormattedBytes[bytecode[0]].AsSpan());
|
||||
|
||||
foreach (byte b in bytecode.Slice(1))
|
||||
{
|
||||
builder.AddRange(", ".AsSpan());
|
||||
builder.AddRange(formattedBytes[b].AsSpan());
|
||||
builder.AddRange(FormattedBytes[b].AsSpan());
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
|
||||
@@ -41,7 +41,7 @@ unsafe partial class IWICStreamExtensions
|
||||
/// <summary>
|
||||
/// A manual CCW implementation for an <see cref="IStream"/> object wrapping an <see cref="IBufferWriter{T}"/> instance.
|
||||
/// </summary>
|
||||
internal unsafe partial struct IBufferWriterWrapper
|
||||
private unsafe partial struct IBufferWriterWrapper
|
||||
#if NET6_0_OR_GREATER
|
||||
: IUnknown.Interface
|
||||
#endif
|
||||
@@ -225,17 +225,17 @@ unsafe partial class IWICStreamExtensions
|
||||
/// <summary>
|
||||
/// The vtable pointer for the current instance.
|
||||
/// </summary>
|
||||
public void** lpVtbl;
|
||||
private void** lpVtbl;
|
||||
|
||||
/// <summary>
|
||||
/// The current reference count for the object (from <c>IUnknown</c>).
|
||||
/// </summary>
|
||||
public volatile int referenceCount;
|
||||
private volatile int referenceCount;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="GCHandle"/> to the captured <see cref="IBufferWriter{T}"/>.
|
||||
/// </summary>
|
||||
public GCHandle writerHandle;
|
||||
private GCHandle writerHandle;
|
||||
|
||||
/// <summary>
|
||||
/// Creates and initializes a new <see cref="IBufferWriterWrapper"/> instance.
|
||||
|
||||
@@ -44,7 +44,7 @@ internal static unsafe partial class IWICStreamExtensions
|
||||
/// <summary>
|
||||
/// A manual CCW implementation for an <see cref="IStream"/> object wrapping a <see cref="Stream"/> instance.
|
||||
/// </summary>
|
||||
internal unsafe partial struct IStreamWrapper
|
||||
private unsafe partial struct IStreamWrapper
|
||||
#if NET6_0_OR_GREATER
|
||||
: IUnknown.Interface
|
||||
#endif
|
||||
@@ -228,17 +228,17 @@ internal static unsafe partial class IWICStreamExtensions
|
||||
/// <summary>
|
||||
/// The vtable pointer for the current instance.
|
||||
/// </summary>
|
||||
public void** lpVtbl;
|
||||
private void** lpVtbl;
|
||||
|
||||
/// <summary>
|
||||
/// The current reference count for the object (from <c>IUnknown</c>).
|
||||
/// </summary>
|
||||
public volatile int referenceCount;
|
||||
private volatile int referenceCount;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="GCHandle"/> to the captured <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
public GCHandle streamHandle;
|
||||
private GCHandle streamHandle;
|
||||
|
||||
/// <summary>
|
||||
/// Creates and initializes a new <see cref="IStreamWrapper"/> instance.
|
||||
|
||||
@@ -22,7 +22,7 @@ partial class DeviceHelper
|
||||
/// <summary>
|
||||
/// The cached default <see cref="GraphicsDevice"/> instance, if any.
|
||||
/// </summary>
|
||||
internal static GraphicsDevice? defaultDevice;
|
||||
private static GraphicsDevice? defaultDevice;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the cached <see cref="GraphicsDevice"/> instance or creates and caches a new one.
|
||||
|
||||
@@ -204,7 +204,7 @@ partial class DeviceHelper
|
||||
|
||||
/// <inheritdoc cref="IUnknown.Release"/>
|
||||
[UnmanagedCallersOnly]
|
||||
public static uint Release(IDXGIFactory4As6Backcompat* @this)
|
||||
private static uint Release(IDXGIFactory4As6Backcompat* @this)
|
||||
{
|
||||
@this->dxgiFactory4->Release();
|
||||
|
||||
@@ -215,21 +215,21 @@ partial class DeviceHelper
|
||||
|
||||
/// <inheritdoc cref="IDXGIFactory6.EnumAdapters(uint, IDXGIAdapter**)"/>
|
||||
[UnmanagedCallersOnly]
|
||||
public static int EnumAdapters(IDXGIFactory4As6Backcompat* @this, uint Adapter, IDXGIAdapter** ppAdapter)
|
||||
private static int EnumAdapters(IDXGIFactory4As6Backcompat* @this, uint Adapter, IDXGIAdapter** ppAdapter)
|
||||
{
|
||||
return @this->dxgiFactory4->EnumAdapters(Adapter, ppAdapter);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IDXGIFactory6.EnumWarpAdapter(Guid*, void**)"/>
|
||||
[UnmanagedCallersOnly]
|
||||
public static int EnumWarpAdapter(IDXGIFactory4As6Backcompat* @this, Guid* riid, void** ppvAdapter)
|
||||
private static int EnumWarpAdapter(IDXGIFactory4As6Backcompat* @this, Guid* riid, void** ppvAdapter)
|
||||
{
|
||||
return @this->dxgiFactory4->EnumWarpAdapter(riid, ppvAdapter);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IDXGIFactory6.EnumAdapterByGpuPreference(uint, DXGI_GPU_PREFERENCE, Guid*, void**)"/>
|
||||
[UnmanagedCallersOnly]
|
||||
public static int EnumAdapterByGpuPreference(IDXGIFactory4As6Backcompat* @this, uint Adapter, DXGI_GPU_PREFERENCE GpuPreference, Guid* riid, void** ppvAdapter)
|
||||
private static int EnumAdapterByGpuPreference(IDXGIFactory4As6Backcompat* @this, uint Adapter, DXGI_GPU_PREFERENCE GpuPreference, Guid* riid, void** ppvAdapter)
|
||||
{
|
||||
return @this->dxgiFactory4->EnumAdapters1(Adapter, (IDXGIAdapter1**)ppvAdapter);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.ComponentModel;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using static TerraFX.Interop.DirectX.D3D12_DESCRIPTOR_RANGE_FLAGS;
|
||||
|
||||
#pragma warning disable IDE0052, CS0414
|
||||
#pragma warning disable IDE0052, IDE1006, CS0414
|
||||
|
||||
namespace ComputeSharp.__Internals;
|
||||
|
||||
|
||||
@@ -11,22 +11,22 @@ internal readonly struct ShaderKey : IEquatable<ShaderKey>
|
||||
/// <summary>
|
||||
/// The hashcode of the current shader type.
|
||||
/// </summary>
|
||||
private readonly int Id;
|
||||
private readonly int id;
|
||||
|
||||
/// <summary>
|
||||
/// The number of iterations to run on the X axis.
|
||||
/// </summary>
|
||||
private readonly int ThreadsX;
|
||||
private readonly int threadsX;
|
||||
|
||||
/// <summary>
|
||||
/// The number of iterations to run on the Y axis.
|
||||
/// </summary>
|
||||
private readonly int ThreadsY;
|
||||
private readonly int threadsY;
|
||||
|
||||
/// <summary>
|
||||
/// The number of iterations to run on the Z axis.
|
||||
/// </summary>
|
||||
private readonly int ThreadsZ;
|
||||
private readonly int threadsZ;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ShaderKey"/> instance with the specified parameters.
|
||||
@@ -38,10 +38,10 @@ internal readonly struct ShaderKey : IEquatable<ShaderKey>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public ShaderKey(int id, int threadsX, int threadsY, int threadsZ)
|
||||
{
|
||||
Id = id;
|
||||
ThreadsX = threadsX;
|
||||
ThreadsY = threadsY;
|
||||
ThreadsZ = threadsZ;
|
||||
this.id = id;
|
||||
this.threadsX = threadsX;
|
||||
this.threadsY = threadsY;
|
||||
this.threadsZ = threadsZ;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -49,10 +49,10 @@ internal readonly struct ShaderKey : IEquatable<ShaderKey>
|
||||
public bool Equals(ShaderKey other)
|
||||
{
|
||||
return
|
||||
Id == other.Id &&
|
||||
ThreadsX == other.ThreadsX &&
|
||||
ThreadsY == other.ThreadsY &&
|
||||
ThreadsZ == other.ThreadsZ;
|
||||
id == other.id &&
|
||||
threadsX == other.threadsX &&
|
||||
threadsY == other.threadsY &&
|
||||
threadsZ == other.threadsZ;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -65,6 +65,6 @@ internal readonly struct ShaderKey : IEquatable<ShaderKey>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(Id, ThreadsX, ThreadsY, ThreadsZ);
|
||||
return HashCode.Combine(id, threadsX, threadsY, threadsZ);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
# Disable naming rule violation warnings just for unit tests
|
||||
dotnet_diagnostic.IDE1006.severity = none
|
||||
新しいイシューから参照
ユーザーをブロックする