diff --git a/samples/ComputeSharp.Benchmark/Blas/BlasHelpers.cs b/samples/ComputeSharp.Benchmark/Blas/BlasHelpers.cs index 3ae91639..a2d94d21 100644 --- a/samples/ComputeSharp.Benchmark/Blas/BlasHelpers.cs +++ b/samples/ComputeSharp.Benchmark/Blas/BlasHelpers.cs @@ -94,15 +94,15 @@ internal static partial class BlasHelpers /// public void Execute() { - int x_offset = (ThreadIds.X * n * p) + (ThreadIds.Y * m); + int x_offset = (ThreadIds.X * this.n * this.p) + (ThreadIds.Y * this.m); float result = 0f; - for (int k = 0; k < m; k++) + for (int k = 0; k < this.m; k++) { - result += x[x_offset + k] * w[(k * p) + ThreadIds.Z]; + result += this.x[x_offset + k] * this.w[(k * this.p) + ThreadIds.Z]; } - y[(ThreadIds.X * n * p) + (ThreadIds.Y * p) + ThreadIds.Z] = result + b[ThreadIds.Z]; + this.y[(ThreadIds.X * this.n * this.p) + (ThreadIds.Y * this.p) + ThreadIds.Z] = result + this.b[ThreadIds.Z]; } } } \ No newline at end of file diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs index fe46d6d0..69027eaf 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs @@ -70,30 +70,30 @@ public sealed partial class HlslBokehBlurProcessor public Implementation(HlslBokehBlurProcessor definition, Configuration configuration, Image source, Rectangle sourceRectangle) : base(configuration, source, sourceRectangle) { - graphicsDevice = definition.GraphicsDevice; - radius = definition.Radius; - kernelSize = (radius * 2) + 1; - componentsCount = definition.Components; + this.graphicsDevice = definition.GraphicsDevice; + this.radius = definition.Radius; + this.kernelSize = (this.radius * 2) + 1; + this.componentsCount = definition.Components; // Reuse the initialized values from the cache, if possible - (int radius, int componentsCount) parameters = (radius, componentsCount); + (int radius, int componentsCount) parameters = (this.radius, this.componentsCount); if (Cache.TryGetValue(parameters, out (Vector4[] Parameters, float Scale, Complex64[][] Kernels) 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(); - kernels = CreateComplexKernels(); + (this.kernelParameters, this.kernelsScale) = GetParameters(); + this.kernels = CreateComplexKernels(); NormalizeKernels(); // Store them in the cache for future use - _ = Cache.TryAdd(parameters, (kernelParameters, kernelsScale, kernels)); + _ = Cache.TryAdd(parameters, (this.kernelParameters, this.kernelsScale, this.kernels)); } } @@ -162,7 +162,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(this.componentsCount - 1, KernelComponents.Count)); return (KernelComponents[index], KernelScales[index]); } @@ -172,10 +172,10 @@ public sealed partial class HlslBokehBlurProcessor /// private Complex64[][] CreateComplexKernels() { - Complex64[][] kernels = new Complex64[kernelParameters.Length][]; - ref Vector4 baseRef = ref MemoryMarshal.GetReference(kernelParameters.AsSpan()); + Complex64[][] kernels = new Complex64[this.kernelParameters.Length][]; + ref Vector4 baseRef = ref MemoryMarshal.GetReference(this.kernelParameters.AsSpan()); - for (int i = 0; i < kernelParameters.Length; i++) + for (int i = 0; i < this.kernelParameters.Length; i++) { ref Vector4 paramsRef = ref Unsafe.Add(ref baseRef, i); @@ -192,15 +192,15 @@ public sealed partial class HlslBokehBlurProcessor /// The angle component for each complex component. private Complex64[] CreateComplex1DKernel(float a, float b) { - Complex64[] kernel = new Complex64[kernelSize]; + Complex64[] kernel = new Complex64[this.kernelSize]; ref Complex64 baseRef = ref MemoryMarshal.GetReference(kernel.AsSpan()); - int r = radius; + int r = this.radius; int n = -r; - for (int i = 0; i < kernelSize; i++, n++) + for (int i = 0; i < this.kernelSize; i++, n++) { // Incrementally compute the range values - float value = n * kernelsScale * (1f / r); + float value = n * this.kernelsScale * (1f / r); value *= value; @@ -220,11 +220,11 @@ public sealed partial class HlslBokehBlurProcessor { // Calculate the complex weighted sum float total = 0; - Span kernelsSpan = kernels.AsSpan(); + Span kernelsSpan = this.kernels.AsSpan(); ref Complex64[] baseKernelsRef = ref MemoryMarshal.GetReference(kernelsSpan); - ref Vector4 baseParamsRef = ref MemoryMarshal.GetReference(kernelParameters.AsSpan()); + ref Vector4 baseParamsRef = ref MemoryMarshal.GetReference(this.kernelParameters.AsSpan()); - for (int i = 0; i < kernelParameters.Length; i++) + for (int i = 0; i < this.kernelParameters.Length; i++) { ref Complex64[] kernelRef = ref Unsafe.Add(ref baseKernelsRef, i); int length = kernelRef.Length; @@ -271,23 +271,23 @@ public sealed partial class HlslBokehBlurProcessor Span span = MemoryMarshal.Cast(pixelMemory.Span); - using ReadWriteTexture2D texture = graphicsDevice.AllocateReadWriteTexture2D(span, source.Width, source.Height); - using ReadWriteTexture2D temporary = graphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height, AllocationMode.Clear); - using ReadWriteTexture2D reals = graphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height); - using ReadWriteTexture2D imaginaries = graphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height); - using ReadOnlyBuffer kernel = graphicsDevice.AllocateReadOnlyBuffer(kernelSize); + using ReadWriteTexture2D texture = this.graphicsDevice.AllocateReadWriteTexture2D(span, source.Width, source.Height); + using ReadWriteTexture2D temporary = this.graphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height, AllocationMode.Clear); + using ReadWriteTexture2D reals = this.graphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height); + using ReadWriteTexture2D imaginaries = this.graphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height); + using ReadOnlyBuffer kernel = this.graphicsDevice.AllocateReadOnlyBuffer(this.kernelSize); // Preliminary gamma highlight pass - graphicsDevice.For(source.Height, new(texture)); + this.graphicsDevice.For(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 < this.kernels.Length; j++) { - Vector4 parameters = kernelParameters[j]; + Vector4 parameters = this.kernelParameters[j]; - kernel.CopyFrom(kernels[j]); + kernel.CopyFrom(this.kernels[j]); - using ComputeContext context = graphicsDevice.CreateComputeContext(); + using ComputeContext context = this.graphicsDevice.CreateComputeContext(); context.For( source.Width, @@ -304,7 +304,7 @@ public sealed partial class HlslBokehBlurProcessor } // Apply the inverse gamma exposure pass - graphicsDevice.For(source.Height, new(temporary, texture)); + this.graphicsDevice.For(source.Height, new(temporary, texture)); // Write the final pixel data texture.CopyTo(span); @@ -326,24 +326,24 @@ public sealed partial class HlslBokehBlurProcessor { float4 real = float4.Zero; float4 imaginary = float4.Zero; - int maxY = source.Height; - int maxX = source.Width; - int kernelLength = kernel.Length; + int maxY = this.source.Height; + int maxX = this.source.Width; + int kernelLength = this.kernel.Length; int radiusY = kernelLength >> 1; for (int i = 0; i < kernelLength; i++) { int offsetY = Hlsl.Clamp(ThreadIds.Y + i - radiusY, 0, maxY); int offsetX = Hlsl.Clamp(ThreadIds.X, 0, maxX); - float4 color = source[offsetX, offsetY]; - Complex64 factors = kernel[i]; + float4 color = this.source[offsetX, offsetY]; + Complex64 factors = this.kernel[i]; real += factors.Real * color; imaginary += factors.Imaginary * color; } - reals[ThreadIds.XY] = real; - imaginaries[ThreadIds.XY] = imaginary; + this.reals[ThreadIds.XY] = real; + this.imaginaries[ThreadIds.XY] = imaginary; } } @@ -364,9 +364,9 @@ public sealed partial class HlslBokehBlurProcessor /// public void Execute() { - int maxY = target.Height; - int maxX = target.Width; - int kernelLength = kernel.Length; + int maxY = this.target.Height; + int maxX = this.target.Width; + int kernelLength = this.kernel.Length; int radiusX = kernelLength >> 1; int offsetY = Hlsl.Clamp(ThreadIds.Y, 0, maxY); ComplexVector4 result = default; @@ -374,15 +374,15 @@ public sealed partial class HlslBokehBlurProcessor for (int i = 0; i < kernelLength; i++) { int offsetX = Hlsl.Clamp(ThreadIds.X + i - radiusX, 0, maxX); - float4 sourceReal = reals[offsetX, offsetY]; - float4 sourceImaginary = imaginaries[offsetX, offsetY]; - Complex64 factors = kernel[i]; + float4 sourceReal = this.reals[offsetX, offsetY]; + float4 sourceImaginary = this.imaginaries[offsetX, offsetY]; + Complex64 factors = this.kernel[i]; result.Real += (Vector4)((factors.Real * sourceReal) - (factors.Imaginary * sourceImaginary)); result.Imaginary += (Vector4)((factors.Real * sourceImaginary) + (factors.Imaginary * sourceReal)); } - target[ThreadIds.XY] += (float4)result.WeightedSum(z, w); + this.target[ThreadIds.XY] += (float4)result.WeightedSum(this.z, this.w); } } @@ -397,15 +397,15 @@ public sealed partial class HlslBokehBlurProcessor /// public void Execute() { - int width = source.Width; + int width = this.source.Width; for (int i = 0; i < width; i++) { - float4 v = source[i, ThreadIds.X]; + float4 v = this.source[i, ThreadIds.X]; v.XYZ = v.XYZ * v.XYZ * v.XYZ; - source[i, ThreadIds.X] = v; + this.source[i, ThreadIds.X] = v; } } } @@ -422,16 +422,16 @@ public sealed partial class HlslBokehBlurProcessor /// public void Execute() { - int width = source.Width; + int width = this.source.Width; for (int i = 0; i < width; i++) { - float4 v = source[i, ThreadIds.X]; + float4 v = this.source[i, ThreadIds.X]; v = Hlsl.Clamp(v, 0, float.MaxValue); v.XYZ = Hlsl.Pow(v.XYZ, 1 / 3f); - target[i, ThreadIds.X] = v; + this.target[i, ThreadIds.X] = v; } } } diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs index 68a6bad5..c2e67e9d 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs @@ -52,7 +52,7 @@ public sealed partial class HlslGaussianBlurProcessor : IImageProcessor /// The radius value representing the size of the area to sample (this should be at least twice the sigma value) public HlslGaussianBlurProcessor(GraphicsDevice device, float sigma, int radius) { - graphicsDevice = device; + this.graphicsDevice = device; Sigma = sigma; Radius = radius; diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs index c7aebcce..e24a82a2 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs @@ -38,8 +38,8 @@ public sealed partial class HlslGaussianBlurProcessor { int kernelSize = (definition.Radius * 2) + 1; - graphicsDevice = definition.graphicsDevice; - kernel = CreateGaussianBlurKernel(kernelSize, definition.Sigma); + this.graphicsDevice = definition.graphicsDevice; + this.kernel = CreateGaussianBlurKernel(kernelSize, definition.Sigma); } /// @@ -100,11 +100,11 @@ public sealed partial class HlslGaussianBlurProcessor Span span = MemoryMarshal.Cast(pixelMemory.Span); - using ReadWriteTexture2D sourceTexture = graphicsDevice.AllocateReadWriteTexture2D(span, source.Width, source.Height); - using ReadWriteTexture2D firstPassTexture = graphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height); - using ReadOnlyBuffer kernelBuffer = graphicsDevice.AllocateReadOnlyBuffer(kernel); + using ReadWriteTexture2D sourceTexture = this.graphicsDevice.AllocateReadWriteTexture2D(span, source.Width, source.Height); + using ReadWriteTexture2D firstPassTexture = this.graphicsDevice.AllocateReadWriteTexture2D(source.Width, source.Height); + using ReadOnlyBuffer kernelBuffer = this.graphicsDevice.AllocateReadOnlyBuffer(this.kernel); - using (ComputeContext context = graphicsDevice.CreateComputeContext()) + using (ComputeContext context = this.graphicsDevice.CreateComputeContext()) { context.For(source.Width, source.Height, new(sourceTexture, firstPassTexture, kernelBuffer)); context.Barrier(firstPassTexture); @@ -128,21 +128,21 @@ public sealed partial class HlslGaussianBlurProcessor public void Execute() { float4 result = float4.Zero; - int maxY = source.Height - 1; - int maxX = source.Width - 1; - int kernelLength = kernel.Length; + int maxY = this.source.Height - 1; + int maxX = this.source.Width - 1; + int kernelLength = this.kernel.Length; int radiusY = kernelLength >> 1; for (int i = 0; i < kernelLength; i++) { int offsetY = Hlsl.Clamp(ThreadIds.Y + i - radiusY, 0, maxY); int offsetX = Hlsl.Clamp(ThreadIds.X, 0, maxX); - float4 color = source[offsetX, offsetY]; + float4 color = this.source[offsetX, offsetY]; - result += kernel[i] * color; + result += this.kernel[i] * color; } - target[ThreadIds.XY] = result; + this.target[ThreadIds.XY] = result; } } @@ -160,21 +160,21 @@ public sealed partial class HlslGaussianBlurProcessor public void Execute() { float4 result = float4.Zero; - int maxY = source.Height - 1; - int maxX = source.Width - 1; - int kernelLength = kernel.Length; + int maxY = this.source.Height - 1; + int maxX = this.source.Width - 1; + int kernelLength = this.kernel.Length; int radiusX = kernelLength >> 1; int offsetY = Hlsl.Clamp(ThreadIds.Y, 0, maxY); for (int i = 0; i < kernelLength; i++) { int offsetX = Hlsl.Clamp(ThreadIds.X + i - radiusX, 0, maxX); - float4 color = source[offsetX, offsetY]; + float4 color = this.source[offsetX, offsetY]; - result += kernel[i] * color; + result += this.kernel[i] * color; } - target[ThreadIds.XY] = result; + this.target[ThreadIds.XY] = result; } } } diff --git a/samples/ComputeSharp.Sample.FSharp.Shaders/MultiplyByTwo.cs b/samples/ComputeSharp.Sample.FSharp.Shaders/MultiplyByTwo.cs index 75298a2d..3b9e6f98 100644 --- a/samples/ComputeSharp.Sample.FSharp.Shaders/MultiplyByTwo.cs +++ b/samples/ComputeSharp.Sample.FSharp.Shaders/MultiplyByTwo.cs @@ -11,6 +11,6 @@ public readonly partial struct MultiplyByTwo : IComputeShader /// public void Execute() { - buffer[ThreadIds.X] *= 2; + this.buffer[ThreadIds.X] *= 2; } } \ No newline at end of file diff --git a/samples/ComputeSharp.Sample/Program.cs b/samples/ComputeSharp.Sample/Program.cs index ec27ab04..21e050fa 100644 --- a/samples/ComputeSharp.Sample/Program.cs +++ b/samples/ComputeSharp.Sample/Program.cs @@ -31,6 +31,6 @@ internal readonly partial struct MultiplyByTwo : IComputeShader /// public void Execute() { - buffer[ThreadIds.X] *= 2; + this.buffer[ThreadIds.X] *= 2; } } \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs index 9dbc5e8a..932b1ffc 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ColorfulInfinity.cs @@ -32,7 +32,7 @@ internal readonly partial struct ColorfulInfinity : IPixelShader /// private float4 Tex(float3 p) { - float t = time + 78.0f; + float t = this.time + 78.0f; float4 o = new(p.X, p.Y, p.Z, 3.0f * Hlsl.Sin(t * 0.1f)); float4 dec = new float4(1.0f, 0.9f, 0.1f, 0.15f) + @@ -51,7 +51,7 @@ internal readonly partial struct ColorfulInfinity : IPixelShader { float2 uv = (ThreadIds.XY - ((float2)DispatchSize.XY * 0.5f)) / DispatchSize.Y; float3 col = 0; - float t = time * 0.3f; + float t = this.time * 0.3f; for (float i = 0.0f; i <= 1.0f; i += 1.0f / NumberOfLayers) { diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs index 6f69b9a8..04b6f7ab 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ContouredLayers.cs @@ -34,7 +34,7 @@ internal readonly partial struct ContouredLayers : IPixelShader p = Hlsl.Frac(new float2(262144, 32768) * n); - return Hlsl.Sin((p * 6.2831853f) + time); + return Hlsl.Sin((p * 6.2831853f) + this.time); } // float2 to float2 hash. @@ -111,7 +111,7 @@ internal readonly partial struct ContouredLayers : IPixelShader // Layer color. Based on the shade, layer number and smoothing factor. private float3 GetColor(float2 p, float sh, float fi) { - float3 tx = texture.Sample(p + Hash21(new float2(sh, fi))).XYZ; + float3 tx = this.texture.Sample(p + Hash21(new float2(sh, fi))).XYZ; tx *= tx; diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs index a5a07d24..888530d8 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ExtrudedTruchetPattern.cs @@ -170,7 +170,7 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader float sca = 2.0f; float occ = 0.0f; - for (int i = (int)Hlsl.Min(time, 0f); i < 5; i++) + for (int i = (int)Hlsl.Min(this.time, 0f); i < 5; i++) { float hr = (i + 1f) * 0.15f / 5.0f; float d = M(p + (n * hr)); @@ -204,15 +204,15 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader int2 coords = new(ThreadIds.X, DispatchSize.Y - ThreadIds.Y); float2 u = (coords - ((float2)DispatchSize.XY * 0.5f)) / DispatchSize.Y; float3 r = Hlsl.Normalize(new float3(u, 1)); - float3 o = new(0, time / 2.0f, -3); + float3 o = new(0, this.time / 2.0f, -3); float3 l = o + new float3(0.25f, 0.25f, 2.0f); r.YZ = Hlsl.Mul(Rotate2x2(0.15f), r.YZ); - r.XZ = Hlsl.Mul(Rotate2x2(-Hlsl.Cos(time * 3.14159f / 32.0f) / 8.0f), r.XZ); - r.XY = Hlsl.Mul(Rotate2x2(Hlsl.Sin(time * 3.14159f / 32.0f) / 8.0f), r.XY); + r.XZ = Hlsl.Mul(Rotate2x2(-Hlsl.Cos(this.time * 3.14159f / 32.0f) / 8.0f), r.XZ); + r.XY = Hlsl.Mul(Rotate2x2(Hlsl.Sin(this.time * 3.14159f / 32.0f) / 8.0f), r.XY); float d; - float t = Hash21((r.XY * 57.0f) + Hlsl.Frac(time)) * 0.5f; + float t = Hash21((r.XY * 57.0f) + Hlsl.Frac(this.time)) * 0.5f; float glow = 0; for (int i = 0; i < 96; i++) diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs index bdb9db97..dc14ebe5 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/FourColorGradient.cs @@ -83,7 +83,7 @@ internal readonly partial struct FourColorGradient : IPixelShader tuv -= 0.5f; // Rotate with noise - float degree = Noise(new float2(time * 0.1f, tuv.X * tuv.Y)); + float degree = Noise(new float2(this.time * 0.1f, tuv.X * tuv.Y)); tuv.Y *= 1.0f / ratio; tuv.XY = Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(((degree - 0.5f) * 720.0f) + 180.0f))); @@ -92,7 +92,7 @@ internal readonly partial struct FourColorGradient : IPixelShader // Wave warp with sin float frequency = 5.0f; float amplitude = 30.0f; - float speed = time * 2.0f; + float speed = this.time * 2.0f; tuv.X += Hlsl.Sin((tuv.Y * frequency) + speed) / amplitude; tuv.Y += Hlsl.Sin((tuv.X * frequency * 1.5f) + speed) / (amplitude * 0.5f); diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs index 75d7c757..5b7b8d56 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/FractalTiling.cs @@ -20,7 +20,7 @@ internal readonly partial struct FractalTiling : IPixelShader /// public float4 Execute() { - float2 position = (((float2)(256 * ThreadIds.XY)) / DispatchSize.X) + time; + float2 position = (((float2)(256 * ThreadIds.XY)) / DispatchSize.X) + this.time; float4 color = 0; for (int i = 0; i < 6; i++) @@ -28,7 +28,7 @@ internal readonly partial struct FractalTiling : IPixelShader float2 a = Hlsl.Floor(position); float2 b = Hlsl.Frac(position); float4 w = Hlsl.Frac( - (Hlsl.Sin((a.X * 7) + (31.0f * a.Y) + (0.01f * time)) + + (Hlsl.Sin((a.X * 7) + (31.0f * a.Y) + (0.01f * this.time)) + new float4(0.035f, 0.01f, 0, 0.7f)) * 13.545317f); diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs index 1437f7a8..1fa112b7 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs @@ -22,7 +22,7 @@ internal readonly partial struct HelloWorld : IPixelShader float2 uv = ThreadIds.Normalized.XY; // Time varying pixel color - float3 col = 0.5f + (0.5f * Hlsl.Cos(time + new float3(uv, uv.X) + new float3(0, 2, 4))); + float3 col = 0.5f + (0.5f * Hlsl.Cos(this.time + new float3(uv, uv.X) + new float3(0, 2, 4))); // Output to screen return new(col, 1f); diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs index 9c5946c5..58eab595 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/MengerJourney.cs @@ -77,7 +77,7 @@ internal readonly partial struct MengerJourney : IPixelShader for (int n = 0; n < Iterations; n++) { - z.XY = Rotate(z.XY, 4.0f + (2.0f * Hlsl.Cos(time / 8.0f))); + z.XY = Rotate(z.XY, 4.0f + (2.0f * Hlsl.Cos(this.time / 8.0f))); z = Hlsl.Abs(z); if (z.X < z.Y) { z.XY = z.YX; } @@ -123,7 +123,7 @@ internal readonly partial struct MengerJourney : IPixelShader return Hlsl.Frac(Hlsl.Cos(Hlsl.Dot(co, new float2(4.898f, 7.23f))) * 23421.631f); } - float totalDistance = Jitter * Rand(fragCoord.XY + time); + float totalDistance = Jitter * Rand(fragCoord.XY + this.time); float3 dir2 = dir; float distance = 0; int steps = 0; @@ -131,7 +131,7 @@ internal readonly partial struct MengerJourney : IPixelShader for (int i = 0; i < MaxSteps; i++) { - dir.ZY = Rotate(dir2.ZY, totalDistance * Hlsl.Cos(time / 4.0f) * NonLinearPerspective); + dir.ZY = Rotate(dir2.ZY, totalDistance * Hlsl.Cos(this.time / 4.0f) * NonLinearPerspective); pos = from + (totalDistance * dir); distance = DE(pos) * FudgeFactor; totalDistance += distance; @@ -158,8 +158,8 @@ internal readonly partial struct MengerJourney : IPixelShader /// public float4 Execute() { - float3 camPos = 0.5f * time * new float3(1.0f, 0.0f, 0.0f); - float3 target = camPos + new float3(1.0f, 0.0f * Hlsl.Cos(time), 0.0f * Hlsl.Sin(0.4f * time)); + float3 camPos = 0.5f * this.time * new float3(1.0f, 0.0f, 0.0f); + float3 target = camPos + new float3(1.0f, 0.0f * Hlsl.Cos(this.time), 0.0f * Hlsl.Sin(0.4f * this.time)); float3 camDir = Hlsl.Normalize(target - camPos); float3 camUp = new(0.0f, 1.0f, 0.0f); diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs index 8cc6df70..f10aa0c3 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/Octagrams.cs @@ -90,11 +90,11 @@ internal readonly partial struct Octagrams : IPixelShader public float4 Execute() { float2 p = (((float2)ThreadIds.XY * 2.0f) - DispatchSize.XY) / Hlsl.Min(DispatchSize.X, DispatchSize.Y); - float3 ro = new(0.0f, -0.2f, time * 4.0f); + float3 ro = new(0.0f, -0.2f, this.time * 4.0f); float3 ray = Hlsl.Normalize(new float3(p, 1.5f)); - ray.XY = Hlsl.Mul(ray.XY, Rotate(Hlsl.Sin(time * 0.03f) * 5.0f)); - ray.YZ = Hlsl.Mul(ray.YZ, Rotate(Hlsl.Sin(time * 0.05f) * 0.2f)); + ray.XY = Hlsl.Mul(ray.XY, Rotate(Hlsl.Sin(this.time * 0.03f) * 5.0f)); + ray.YZ = Hlsl.Mul(ray.YZ, Rotate(Hlsl.Sin(this.time * 0.05f) * 0.2f)); float t = 0.1f; float ac = 0.0f; @@ -110,7 +110,7 @@ internal readonly partial struct Octagrams : IPixelShader pos = Mod(pos - 2.0f, 4.0f) - 2.0f; - float gTime = time - (i * 0.01f); + float gTime = this.time - (i * 0.01f); float d = BoxSet(pos, gTime); d = Hlsl.Max(Hlsl.Abs(d), 0.01f); @@ -118,8 +118,8 @@ internal readonly partial struct Octagrams : IPixelShader t += d * 0.55f; } - float3 col = (ac * 0.02f) + new float3(0.0f, 0.2f * Hlsl.Abs(Hlsl.Sin(time)), 0.5f + (Hlsl.Sin(time) * 0.2f)); - float4 color = new(col, 1.0f - (t * (0.02f + (0.02f * Hlsl.Sin(time))))); + float3 col = (ac * 0.02f) + new float3(0.0f, 0.2f * Hlsl.Abs(Hlsl.Sin(this.time)), 0.5f + (Hlsl.Sin(this.time) * 0.2f)); + float4 color = new(col, 1.0f - (t * (0.02f + (0.02f * Hlsl.Sin(this.time))))); return color; } diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs index 6be31f8f..33b358bc 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/ProteanClouds.cs @@ -42,7 +42,7 @@ internal readonly partial struct ProteanClouds : IPixelShader float3 p2 = p; p2.XY -= Disp(p.Z).XY; - p.XY = Hlsl.Mul(p.XY, Rotate((Hlsl.Sin(p.Z + time) * (0.1f + (prm1 * 0.05f))) + (time * 0.09f))); + p.XY = Hlsl.Mul(p.XY, Rotate((Hlsl.Sin(p.Z + this.time) * (0.1f + (prm1 * 0.05f))) + (this.time * 0.09f))); float cl = Hlsl.Dot(p2.XY, p2.XY); float d = 0.0f; @@ -55,7 +55,7 @@ internal readonly partial struct ProteanClouds : IPixelShader for (int i = 0; i < 5; i++) { - p += Hlsl.Sin((p.ZXY * 0.75f * trk) + (time * trk * 0.8f)) * dspAmp; + p += Hlsl.Sin((p.ZXY * 0.75f * trk) + (this.time * trk * 0.8f)) * dspAmp; d -= Hlsl.Abs(Hlsl.Dot(Hlsl.Cos(p), Hlsl.Sin(p.YZX)) * z); z *= 0.57f; trk *= 1.4f; @@ -138,10 +138,10 @@ internal readonly partial struct ProteanClouds : IPixelShader float2 q = (float2)ThreadIds.XY / DispatchSize.XY; float2 p = (ThreadIds.XY - (0.5f * (float2)DispatchSize.XY)) / DispatchSize.Y; float2 bsMo = -0.5f * (float2)DispatchSize.XY / DispatchSize.Y; - float scaledTime = time * 3.0f; + float scaledTime = this.time * 3.0f; float3 ro = new(0, 0, scaledTime); - ro += new float3(Hlsl.Sin(time) * 0.5f, Hlsl.Sin(time * 1.0f) * 0.0f, 0); + ro += new float3(Hlsl.Sin(this.time) * 0.5f, Hlsl.Sin(this.time * 1.0f) * 0.0f, 0); float dspAmp = 0.85f; @@ -161,7 +161,7 @@ internal readonly partial struct ProteanClouds : IPixelShader rd.XY = Hlsl.Mul(rd.XY, Rotate((-Disp(scaledTime + 3.5f).X * 0.2f) + bsMo.X)); - float prm1 = Hlsl.SmoothStep(-0.4f, 0.4f, Hlsl.Sin(time * 0.3f)); + float prm1 = Hlsl.SmoothStep(-0.4f, 0.4f, Hlsl.Sin(this.time * 0.3f)); float4 scn = Render(ro, rd, scaledTime, prm1, bsMo); float3 col = scn.RGB; diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs index b4ea047f..ce8988f3 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/PyramidPattern.cs @@ -84,7 +84,7 @@ internal readonly partial struct PyramidPattern : IPixelShader p -= ip + 0.5f; - float ang = (-3.14159f * 3.0f / 5.0f) + (FBM((ip / 8.0f) + (time / 3.0f)) * 6.2831f * 2.0f); + float ang = (-3.14159f * 3.0f / 5.0f) + (FBM((ip / 8.0f) + (this.time / 3.0f)) * 6.2831f * 2.0f); float2 offs = new float2(Hlsl.Cos(ang), Hlsl.Sin(ang)) * 0.35f; @@ -154,7 +154,7 @@ internal readonly partial struct PyramidPattern : IPixelShader float2 uv = (coordinate - ((float2)DispatchSize.XY * 0.5f)) / iRes; float3 rd = Hlsl.Normalize(new float3(uv, 0.5f)); const float gSc = 10.0f; - float2 p = (uv * gSc) + new float2(0, time / 2.0f); + float2 p = (uv * gSc) + new float2(0, this.time / 2.0f); float2 oP = p; float m = BMap(p); float3 n = new(0, 0, -1); @@ -163,7 +163,7 @@ internal readonly partial struct PyramidPattern : IPixelShader n = DoBumpMap(p, n, bumpFactor, ref edge); - float3 lp = new float3(-0.0f + (Hlsl.Sin(time) * 0.3f), 0.0f + (Hlsl.Cos(time * 1.3f) * 0.3f), -1) - new float3(uv, 0); + float3 lp = new float3(-0.0f + (Hlsl.Sin(this.time) * 0.3f), 0.0f + (Hlsl.Cos(this.time * 1.3f) * 0.3f), -1) - new float3(uv, 0); float lDist = Hlsl.Max(Hlsl.Length(lp), 0.001f); float3 ld = lp / lDist; float diff = Hlsl.Max(Hlsl.Dot(n, ld), 0.0f); diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs index 02dd4a8d..52c87473 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/TriangleGridContouring.cs @@ -38,7 +38,7 @@ internal readonly partial struct TriangleGridContouring : IPixelShader p = Hlsl.Frac(new float2(262144, 32768) * n); - return Hlsl.Sin((p * 6.2831853f) + time); + return Hlsl.Sin((p * 6.2831853f) + this.time); } // Based on IQ's gradient noise formula. @@ -297,7 +297,7 @@ internal readonly partial struct TriangleGridContouring : IPixelShader { int2 coordinate = new(ThreadIds.X, DispatchSize.Y - ThreadIds.Y); float2 uv = (coordinate - ((float2)DispatchSize.XY * 0.5f)) / Hlsl.Min(650.0f, DispatchSize.Y); - float2 p = Hlsl.Mul(Rotate2x2(3.14159f / 12.0f), uv) + (new float2(0.8660254f, 0.5f) * time / 16.0f); + float2 p = Hlsl.Mul(Rotate2x2(3.14159f / 12.0f), uv) + (new float2(0.8660254f, 0.5f) * this.time / 16.0f); float3 col = SimplexContour(p); uv = coordinate / (float2)DispatchSize.XY; diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs index 1004cce9..701344da 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/TwoTiledTruchet.cs @@ -106,7 +106,7 @@ internal readonly partial struct TwoTiledTruchet : IPixelShader ang *= 2.0f; } - ang = Hlsl.Frac(ang + (time / 4.0f)); + ang = Hlsl.Frac(ang + (this.time / 4.0f)); return d; } @@ -116,7 +116,7 @@ internal readonly partial struct TwoTiledTruchet : IPixelShader { float2 uv = (ThreadIds.XY - ((float2)DispatchSize.XY * 0.5f)) / DispatchSize.Y; float gSc = 7.0f; - float2 p = (uv * gSc) - (new float2(-1, -0.5f) * time / 2.0f); + float2 p = (uv * gSc) - (new float2(-1, -0.5f) * this.time / 2.0f); float sf = 2.0f / DispatchSize.Y * gSc; float lSc = 6.0f; float lw = 1.0f / lSc / gSc; @@ -126,7 +126,7 @@ internal readonly partial struct TwoTiledTruchet : IPixelShader for (int i = 0; i < 2; i++) { float di = d[i] - (lw / 4.0f); - float tracks = Hlsl.Clamp(Hlsl.Sin((ang[i] * 6.2831f) + (time * 6.0f)) * 4.0f, 0.0f, 1.0f); + float tracks = Hlsl.Clamp(Hlsl.Sin((ang[i] * 6.2831f) + (this.time * 6.0f)) * 4.0f, 0.0f, 1.0f); float gap = 1.0f + lw; col = Hlsl.Lerp(col, 0, (1.0f - Hlsl.SmoothStep(0.0f, sf * 6.0f, di)) * 0.35f); diff --git a/samples/ComputeSharp.SwapChain.Uwp/Views/MainView.xaml.cs b/samples/ComputeSharp.SwapChain.Uwp/Views/MainView.xaml.cs index f249acd9..9973a613 100644 --- a/samples/ComputeSharp.SwapChain.Uwp/Views/MainView.xaml.cs +++ b/samples/ComputeSharp.SwapChain.Uwp/Views/MainView.xaml.cs @@ -31,8 +31,8 @@ public sealed partial class MainView : UserControl { Ioc.Default.GetRequiredService().Log(Event.OpenShaderSelectionPanel); - _ = Root.Resources.Remove("ShaderSelectionPanel"); - Root.Children.Add(ShaderSelectionPanel); + _ = this.Root.Resources.Remove("ShaderSelectionPanel"); + this.Root.Children.Add(this.ShaderSelectionPanel); } // Hides the shader selection panel @@ -40,13 +40,13 @@ public sealed partial class MainView : UserControl { Ioc.Default.GetRequiredService().Log(Event.CloseShaderSelectionPanel); - _ = Root.Children.Remove(ShaderSelectionPanel); + _ = this.Root.Children.Remove(this.ShaderSelectionPanel); } // Updates the size of the shaders list panel private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e) { - ShadersListContainerPanel.Height = Math.Round(e.NewSize.Height * 0.35); + this.ShadersListContainerPanel.Height = Math.Round(e.NewSize.Height * 0.35); } // Logs rendering failed in the main panel @@ -54,7 +54,7 @@ public sealed partial class MainView : UserControl { Ioc.Default.GetRequiredService().Log(args.Exception, (nameof(Error), Error.RenderingFailedOnMainPanel)); - RenderingErrorInfoBar.IsOpen = true; + this.RenderingErrorInfoBar.IsOpen = true; } // Logs rendering failed in a secondary panel @@ -62,6 +62,6 @@ public sealed partial class MainView : UserControl { Ioc.Default.GetRequiredService().Log(args.Exception, (nameof(Error), Error.RenderingFailedOnSelectionPanel)); - RenderingErrorInfoBar.IsOpen = true; + this.RenderingErrorInfoBar.IsOpen = true; } } \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml.cs b/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml.cs index b8f42ccb..0d03b5a1 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml.cs +++ b/samples/ComputeSharp.SwapChain.WinUI/Views/MainWindow.xaml.cs @@ -23,22 +23,22 @@ public sealed partial class MainWindow : Window this.InitializeComponent(); this.ExtendsContentIntoTitleBar = true; - SetTitleBar(TitleBarRectangle); + SetTitleBar(this.TitleBarRectangle); - Root.DataContext = new MainViewModel(new DebugAnalyticsService()); + this.Root.DataContext = new MainViewModel(new DebugAnalyticsService()); } /// /// Gets the instance for the current view. /// - public MainViewModel ViewModel => (MainViewModel)Root.DataContext; + public MainViewModel ViewModel => (MainViewModel)this.Root.DataContext; /// /// Stops all rendering when the application is closing. /// public void OnShutdown() { - ShaderPanel.ShaderRunner = null; + this.ShaderPanel.ShaderRunner = null; foreach ((AnimatedComputeShaderPanel panel, object _) in this.shaderPanels) { @@ -49,20 +49,20 @@ public sealed partial class MainWindow : Window // Opens the shader selection panel private void OpenShaderSelectionPanelButton_Click(object sender, RoutedEventArgs e) { - _ = Root.Resources.Remove("ShaderSelectionPanel"); - Root.Children.Add(ShaderSelectionPanel); + _ = this.Root.Resources.Remove("ShaderSelectionPanel"); + this.Root.Children.Add(this.ShaderSelectionPanel); } // Hides the shader selection panel private void ShaderSelectionPanel_Tapped(object sender, TappedRoutedEventArgs e) { - _ = Root.Children.Remove(ShaderSelectionPanel); + _ = this.Root.Children.Remove(this.ShaderSelectionPanel); } // Updates the size of the shaders list panel private void UserControl_SizeChanged(object sender, WindowSizeChangedEventArgs e) { - ShadersListContainerPanel.Height = Math.Round(e.Size.Height * 0.35); + this.ShadersListContainerPanel.Height = Math.Round(e.Size.Height * 0.35); } // Tracks the current panel diff --git a/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs b/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs index 83e84f0d..9affa55c 100644 --- a/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs +++ b/samples/ComputeSharp.SwapChain/Backend/SwapChainApplication{T}.cs @@ -100,7 +100,7 @@ internal sealed class SwapChainApplication : Win32Application d3D12CommandQueueDesc.Flags = D3D12_COMMAND_QUEUE_FLAGS.D3D12_COMMAND_QUEUE_FLAG_NONE; d3D12CommandQueueDesc.NodeMask = 0; - _ = d3D12Device.Get()->CreateCommandQueue( + _ = this.d3D12Device.Get()->CreateCommandQueue( &d3D12CommandQueueDesc, Windows.__uuidof(), (void**)d3D12CommandQueue); @@ -136,7 +136,7 @@ internal sealed class SwapChainApplication : Win32Application dxgiSwapChainDesc1.SwapEffect = DXGI_SWAP_EFFECT.DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; _ = dxgiFactory2.Get()->CreateSwapChainForHwnd( - (IUnknown*)d3D12CommandQueue.Get(), + (IUnknown*)this.d3D12CommandQueue.Get(), hwnd, &dxgiSwapChainDesc1, null, @@ -159,7 +159,7 @@ internal sealed class SwapChainApplication : Win32Application _ = this.d3D12Device.Get()->CreateCommandList( 0, D3D12_COMMAND_LIST_TYPE.D3D12_COMMAND_LIST_TYPE_DIRECT, - d3D12CommandAllocator, + this.d3D12CommandAllocator, null, Windows.__uuidof(), (void**)d3D12GraphicsCommandList); @@ -206,8 +206,8 @@ internal sealed class SwapChainApplication : Win32Application fixed (ID3D12Resource** d3D12Resource0 = this.d3D12Resource0) fixed (ID3D12Resource** d3D12Resource1 = this.d3D12Resource1) { - _ = dxgiSwapChain1.Get()->GetBuffer(0, Windows.__uuidof(), (void**)d3D12Resource0); - _ = dxgiSwapChain1.Get()->GetBuffer(1, Windows.__uuidof(), (void**)d3D12Resource1); + _ = this.dxgiSwapChain1.Get()->GetBuffer(0, Windows.__uuidof(), (void**)d3D12Resource0); + _ = this.dxgiSwapChain1.Get()->GetBuffer(1, Windows.__uuidof(), (void**)d3D12Resource1); } this.texture?.Dispose(); @@ -265,10 +265,10 @@ internal sealed class SwapChainApplication : Win32Application }; // Transition the resources to COPY_DEST and COPY_SOURCE respectively - d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers); + this.d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers); // Copy the generated frame to the target back buffer - d3D12GraphicsCommandList.Get()->CopyResource(d3D12ResourceBackBuffer, d3D12Resource.Get()); + this.d3D12GraphicsCommandList.Get()->CopyResource(d3D12ResourceBackBuffer, d3D12Resource.Get()); d3D12ResourceBarriers[0] = D3D12_RESOURCE_BARRIER.InitTransition( d3D12Resource.Get(), @@ -281,12 +281,12 @@ internal sealed class SwapChainApplication : Win32Application D3D12_RESOURCE_STATES.D3D12_RESOURCE_STATE_COMMON); // Transition the resources back to COMMON and UNORDERED_ACCESS respectively - d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers); + this.d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers); - _ = d3D12GraphicsCommandList.Get()->Close(); + _ = this.d3D12GraphicsCommandList.Get()->Close(); // Execute the command list to perform the copy - this.d3D12CommandQueue.Get()->ExecuteCommandLists(1, (ID3D12CommandList**)d3D12GraphicsCommandList.GetAddressOf()); + this.d3D12CommandQueue.Get()->ExecuteCommandLists(1, (ID3D12CommandList**)this.d3D12GraphicsCommandList.GetAddressOf()); _ = this.d3D12CommandQueue.Get()->Signal(this.d3D12Fence.Get(), this.nextD3D12FenceValue); // Present the new frame diff --git a/src/ComputeSharp.Core/Helpers/FormatInterpolatedStringHandler.cs b/src/ComputeSharp.Core/Helpers/FormatInterpolatedStringHandler.cs index 694f299e..1edcaf7e 100644 --- a/src/ComputeSharp.Core/Helpers/FormatInterpolatedStringHandler.cs +++ b/src/ComputeSharp.Core/Helpers/FormatInterpolatedStringHandler.cs @@ -61,10 +61,10 @@ internal ref struct FormatInterpolatedStringHandler { this.format = format; this.formatProvider = formatProvider; - characters = initialBuffer; - arrayToReturnToPool = null; - position = 0; - hasCustomFormatter = formatProvider is not null && HasCustomFormatter(formatProvider); + this.characters = initialBuffer; + this.arrayToReturnToPool = null; + this.position = 0; + this.hasCustomFormatter = formatProvider is not null && HasCustomFormatter(formatProvider); } /// @@ -96,11 +96,11 @@ internal ref struct FormatInterpolatedStringHandler public string ToStringAndClear() { #if NET6_0_OR_GREATER - string result = new(characters.Slice(0, position)); + string result = new(this.characters.Slice(0, this.position)); #else - string result = characters.Slice(0, position).ToString(); + string result = this.characters.Slice(0, this.position).ToString(); #endif - char[]? toReturn = arrayToReturnToPool; + char[]? toReturn = this.arrayToReturnToPool; this = default; @@ -121,14 +121,14 @@ internal ref struct FormatInterpolatedStringHandler { if (value.Length == 1) { - Span chars = characters; - int pos = position; + Span chars = this.characters; + int pos = this.position; if ((uint)pos < (uint)chars.Length) { chars[pos] = value[0]; - position = pos + 1; + this.position = pos + 1; } else { @@ -140,8 +140,8 @@ internal ref struct FormatInterpolatedStringHandler if (value.Length == 2) { - Span chars = characters; - int pos = position; + Span chars = this.characters; + int pos = this.position; if ((uint)pos < chars.Length - 1) { @@ -153,7 +153,7 @@ internal ref struct FormatInterpolatedStringHandler Unsafe.ReadUnaligned(ref Unsafe.As(ref MemoryMarshal.GetReference(value.AsSpan())))); #endif - position = pos + 2; + this.position = pos + 2; } else { @@ -173,12 +173,12 @@ internal ref struct FormatInterpolatedStringHandler private void AppendStringDirect(string value) { #if NET6_0_OR_GREATER - if (value.TryCopyTo(characters.Slice(position))) + if (value.TryCopyTo(this.characters.Slice(this.position))) #else - if (value.AsSpan().TryCopyTo(characters.Slice(position))) + if (value.AsSpan().TryCopyTo(this.characters.Slice(this.position))) #endif { - position += value.Length; + this.position += value.Length; } else { @@ -206,23 +206,23 @@ internal ref struct FormatInterpolatedStringHandler where T : IFormattable #endif { - if (hasCustomFormatter) + if (this.hasCustomFormatter) { - AppendCustomFormatter(value, format); + AppendCustomFormatter(value, this.format); return; } #if NET6_0_OR_GREATER int charsWritten; - while (!value.TryFormat(characters.Slice(position), out charsWritten, format, formatProvider)) + while (!value.TryFormat(this.characters.Slice(this.position), out charsWritten, this.format, this.formatProvider)) { Grow(); } - position += charsWritten; + this.position += charsWritten; #else - AppendStringDirect(value.ToString(format, formatProvider)); + AppendStringDirect(value.ToString(this.format, this.formatProvider)); #endif } @@ -245,9 +245,9 @@ internal ref struct FormatInterpolatedStringHandler [MethodImpl(MethodImplOptions.NoInlining)] private void AppendCustomFormatter(T value, string? format) { - ICustomFormatter? formatter = (ICustomFormatter?)formatProvider?.GetFormat(typeof(ICustomFormatter)); + ICustomFormatter? formatter = (ICustomFormatter?)this.formatProvider?.GetFormat(typeof(ICustomFormatter)); - if (formatter is not null && formatter.Format(format, value, formatProvider) is string customFormatted) + if (formatter is not null && formatter.Format(format, value, this.formatProvider) is string customFormatted) { AppendStringDirect(customFormatted); } @@ -263,12 +263,12 @@ internal ref struct FormatInterpolatedStringHandler Grow(value.Length); #if NET6_0_OR_GREATER - value.CopyTo(characters.Slice(position)); + value.CopyTo(this.characters.Slice(this.position)); #else - value.AsSpan().CopyTo(characters.Slice(position)); + value.AsSpan().CopyTo(this.characters.Slice(this.position)); #endif - position += value.Length; + this.position += value.Length; } /// @@ -277,7 +277,7 @@ internal ref struct FormatInterpolatedStringHandler [MethodImpl(MethodImplOptions.NoInlining)] private void Grow(int additionalChars) { - GrowCore((uint)position + (uint)additionalChars); + GrowCore((uint)this.position + (uint)additionalChars); } #if NET6_0_OR_GREATER @@ -287,7 +287,7 @@ internal ref struct FormatInterpolatedStringHandler [MethodImpl(MethodImplOptions.NoInlining)] private void Grow() { - GrowCore((uint)characters.Length + 1); + GrowCore((uint)this.characters.Length + 1); } #endif @@ -297,7 +297,7 @@ internal ref struct FormatInterpolatedStringHandler [MethodImpl(MethodImplOptions.AggressiveInlining)] private void GrowCore(uint requiredMinCapacity) { - uint newCapacity = Math.Max(requiredMinCapacity, Math.Min((uint)characters.Length * 2, 0x3FFFFFDF)); + uint newCapacity = Math.Max(requiredMinCapacity, Math.Min((uint)this.characters.Length * 2, 0x3FFFFFDF)); #if NET6_0_OR_GREATER int arraySize = (int)Math.Clamp(newCapacity, MinimumArrayPoolLength, int.MaxValue); #else @@ -305,11 +305,11 @@ internal ref struct FormatInterpolatedStringHandler #endif char[] newArray = ArrayPool.Shared.Rent(arraySize); - characters.Slice(0, position).CopyTo(newArray); + this.characters.Slice(0, this.position).CopyTo(newArray); - char[]? toReturn = arrayToReturnToPool; + char[]? toReturn = this.arrayToReturnToPool; - characters = arrayToReturnToPool = newArray; + this.characters = this.arrayToReturnToPool = newArray; if (toReturn is not null) { diff --git a/src/ComputeSharp.Core/Helpers/TryWriteFormatInterpolatedStringHandler.cs b/src/ComputeSharp.Core/Helpers/TryWriteFormatInterpolatedStringHandler.cs index 43aff97e..0aec4d5b 100644 --- a/src/ComputeSharp.Core/Helpers/TryWriteFormatInterpolatedStringHandler.cs +++ b/src/ComputeSharp.Core/Helpers/TryWriteFormatInterpolatedStringHandler.cs @@ -62,9 +62,9 @@ internal ref struct TryWriteFormatInterpolatedStringHandler this.format = format; this.formatAsString = null; this.formatProvider = formatProvider; - position = 0; - success = shouldAppend = destination.Length >= literalLength; - hasCustomFormatter = formatProvider is not null && FormatInterpolatedStringHandler.HasCustomFormatter(formatProvider); + this.position = 0; + this.success = shouldAppend = destination.Length >= literalLength; + this.hasCustomFormatter = formatProvider is not null && FormatInterpolatedStringHandler.HasCustomFormatter(formatProvider); } /// @@ -106,13 +106,13 @@ internal ref struct TryWriteFormatInterpolatedStringHandler if (value.Length == 1) { Span destination = this.destination; - int pos = position; + int pos = this.position; if ((uint)pos < (uint)destination.Length) { destination[pos] = value[0]; - position = pos + 1; + this.position = pos + 1; return true; } @@ -123,7 +123,7 @@ internal ref struct TryWriteFormatInterpolatedStringHandler if (value.Length == 2) { Span destination = this.destination; - int pos = position; + int pos = this.position; if ((uint)pos < destination.Length - 1) { @@ -135,7 +135,7 @@ internal ref struct TryWriteFormatInterpolatedStringHandler Unsafe.ReadUnaligned(ref Unsafe.As(ref MemoryMarshal.GetReference(value.AsSpan())))); #endif - position = pos + 2; + this.position = pos + 2; return true; } @@ -154,12 +154,12 @@ internal ref struct TryWriteFormatInterpolatedStringHandler private bool AppendStringDirect(string value) { #if NET6_0_OR_GREATER - if (value.TryCopyTo(destination.Slice(position))) + if (value.TryCopyTo(this.destination.Slice(this.position))) #else - if (value.AsSpan().TryCopyTo(destination.Slice(position))) + if (value.AsSpan().TryCopyTo(this.destination.Slice(this.position))) #endif { - position += value.Length; + this.position += value.Length; return true; } @@ -177,22 +177,22 @@ internal ref struct TryWriteFormatInterpolatedStringHandler where T : IFormattable #endif { - if (hasCustomFormatter) + if (this.hasCustomFormatter) { - return AppendCustomFormatter(value, formatAsString ??= format.ToString()); + return AppendCustomFormatter(value, this.formatAsString ??= this.format.ToString()); } #if NET6_0_OR_GREATER - if (value.TryFormat(destination.Slice(position), out int charsWritten, format, formatProvider)) + if (value.TryFormat(this.destination.Slice(this.position), out int charsWritten, this.format, this.formatProvider)) { - position += charsWritten; + this.position += charsWritten; return true; } return Fail(); #else - return AppendStringDirect(value.ToString(formatAsString ??= format.ToString(), formatProvider)); + return AppendStringDirect(value.ToString(this.formatAsString ??= this.format.ToString(), this.formatProvider)); #endif } @@ -202,7 +202,7 @@ internal ref struct TryWriteFormatInterpolatedStringHandler /// The value to write. public bool AppendFormatted(string? value) { - if (hasCustomFormatter) + if (this.hasCustomFormatter) { return AppendCustomFormatter(value, format: null); } @@ -213,12 +213,12 @@ internal ref struct TryWriteFormatInterpolatedStringHandler } #if NET6_0_OR_GREATER - if (value.TryCopyTo(destination.Slice(position))) + if (value.TryCopyTo(this.destination.Slice(this.position))) #else - if (value.AsSpan().TryCopyTo(destination.Slice(position))) + if (value.AsSpan().TryCopyTo(this.destination.Slice(this.position))) #endif { - position += value.Length; + this.position += value.Length; return true; } @@ -234,9 +234,9 @@ internal ref struct TryWriteFormatInterpolatedStringHandler [MethodImpl(MethodImplOptions.NoInlining)] private bool AppendCustomFormatter(T value, string? format) { - ICustomFormatter? formatter = (ICustomFormatter?)formatProvider?.GetFormat(typeof(ICustomFormatter)); + ICustomFormatter? formatter = (ICustomFormatter?)this.formatProvider?.GetFormat(typeof(ICustomFormatter)); - if (formatter is not null && formatter.Format(format, value, formatProvider) is string customFormatted) + if (formatter is not null && formatter.Format(format, value, this.formatProvider) is string customFormatted) { return AppendStringDirect(customFormatted); } @@ -249,7 +249,7 @@ internal ref struct TryWriteFormatInterpolatedStringHandler /// private bool Fail() { - success = false; + this.success = false; return false; } diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool.cs index f00c9855..d2d0490f 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool.cs @@ -27,13 +27,13 @@ public readonly struct Bool /// public override bool Equals(object? obj) { - return obj is Bool x && value == x.value; + return obj is Bool x && this.value == x.value; } /// public override int GetHashCode() { - return value.GetHashCode(); + return this.value.GetHashCode(); } /// diff --git a/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.cs b/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.cs index 68ba0487..b93f9323 100644 --- a/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.cs +++ b/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.cs @@ -69,9 +69,9 @@ internal sealed unsafe partial class ShaderCompiler /// ~ShaderCompiler() { - dxcCompiler.Dispose(); - dxcLibrary.Dispose(); - dxcIncludeHandler.Dispose(); + this.dxcCompiler.Dispose(); + this.dxcLibrary.Dispose(); + this.dxcIncludeHandler.Dispose(); } /// @@ -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( + this.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( + this.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(), + this.dxcIncludeHandler.Get(), dxcOperationResult.GetAddressOf()).Assert(); } diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs index 2aadf4cb..c0b6bc9e 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs @@ -13,6 +13,8 @@ using Microsoft.CodeAnalysis.Operations; using static ComputeSharp.SourceGeneration.Diagnostics.DiagnosticDescriptors; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; +#pragma warning disable IDE0052 + namespace ComputeSharp.SourceGeneration.SyntaxRewriters; /// diff --git a/src/ComputeSharp.UI/Helpers/DynamicResolutionManager.cs b/src/ComputeSharp.UI/Helpers/DynamicResolutionManager.cs index 4e723c2e..fc7d0e55 100644 --- a/src/ComputeSharp.UI/Helpers/DynamicResolutionManager.cs +++ b/src/ComputeSharp.UI/Helpers/DynamicResolutionManager.cs @@ -114,10 +114,10 @@ internal unsafe ref struct DynamicResolutionManager // This formula is adapted from https://software.intel.com/content/www/us/en/develop/articles/dynamic-resolution-rendering-article.html. long averageFrameTimeInTicks = this.slidingFrameTimeWindowSum / SlidingFrameTimeWindowLength; - if (averageFrameTimeInTicks < lowerFrameTimeThresholdInTicks || - averageFrameTimeInTicks > upperFrameTimeThresholdInTicks) + if (averageFrameTimeInTicks < this.lowerFrameTimeThresholdInTicks || + averageFrameTimeInTicks > this.upperFrameTimeThresholdInTicks) { - float frameTimeDelta = (targetFrameTimeInTicks - averageFrameTimeInTicks) / (float)averageFrameTimeInTicks; + float frameTimeDelta = (this.targetFrameTimeInTicks - averageFrameTimeInTicks) / (float)averageFrameTimeInTicks; float scaleFactorDelta = scaleFactor * frameTimeDelta * ScaleFactorDeltaK; float updatedScaleFactor = Math.Clamp(scaleFactor + scaleFactorDelta, 0.10f, 1.0f); diff --git a/src/ComputeSharp.UI/Helpers/SwapChainManager.cs b/src/ComputeSharp.UI/Helpers/SwapChainManager.cs index f29b22d4..5e9e2b08 100644 --- a/src/ComputeSharp.UI/Helpers/SwapChainManager.cs +++ b/src/ComputeSharp.UI/Helpers/SwapChainManager.cs @@ -422,7 +422,7 @@ internal sealed unsafe partial class SwapChainManager : NativeObject /// private unsafe partial void OnWaitForPresent() { - _ = Win32.WaitForSingleObjectEx(frameLatencyWaitableObject, Win32.INFINITE, true); + _ = Win32.WaitForSingleObjectEx(this.frameLatencyWaitableObject, Win32.INFINITE, true); } /// diff --git a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs index 7588057e..b373af48 100644 --- a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs +++ b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12CommandListPool.cs @@ -141,8 +141,8 @@ internal readonly unsafe struct ID3D12CommandListPool : IDisposable /// The value to wrap. public D3D12CommandListBundle(ID3D12GraphicsCommandList* d3D12CommandList, ID3D12CommandAllocator* d3D12CommandAllocator) { - D3D12CommandList = d3D12CommandList; - D3D12CommandAllocator = d3D12CommandAllocator; + this.D3D12CommandList = d3D12CommandList; + this.D3D12CommandAllocator = d3D12CommandAllocator; } } } \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12ResourceDescriptorHandles.cs b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12ResourceDescriptorHandles.cs index 7817ae78..c8d43081 100644 --- a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12ResourceDescriptorHandles.cs +++ b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12ResourceDescriptorHandles.cs @@ -33,8 +33,8 @@ internal readonly struct ID3D12ResourceDescriptorHandles D3D12_GPU_DESCRIPTOR_HANDLE d3D12GpuDescriptorHandle, D3D12_CPU_DESCRIPTOR_HANDLE d3D12CpuDescriptorHandleNonShaderVisible) { - D3D12CpuDescriptorHandle = d3D12CpuDescriptorHandle; - D3D12GpuDescriptorHandle = d3D12GpuDescriptorHandle; - D3D12CpuDescriptorHandleNonShaderVisible = d3D12CpuDescriptorHandleNonShaderVisible; + this.D3D12CpuDescriptorHandle = d3D12CpuDescriptorHandle; + this.D3D12GpuDescriptorHandle = d3D12GpuDescriptorHandle; + this.D3D12CpuDescriptorHandleNonShaderVisible = d3D12CpuDescriptorHandleNonShaderVisible; } } \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs index 93f1deb9..cc66f091 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs @@ -60,14 +60,14 @@ internal static unsafe class AllocatorExtensions (D3D12_HEAP_TYPE d3D12HeapType, D3D12_RESOURCE_FLAGS d3D12ResourceFlags, D3D12_RESOURCE_STATES d3D12ResourceStates) = resourceType switch - { + { ResourceType.Constant => (D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_GENERIC_READ), ResourceType.ReadOnly => (D3D12_HEAP_TYPE_DEFAULT, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COMMON), ResourceType.ReadWrite => (D3D12_HEAP_TYPE_DEFAULT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COMMON), ResourceType.ReadBack => (D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COPY_DEST), ResourceType.Upload => (D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_GENERIC_READ), _ => ThrowHelper.ThrowArgumentException<(D3D12_HEAP_TYPE, D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>() - }; + }; using ComPtr allocation = default; diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs index e81fdaea..49ed469b 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs @@ -267,19 +267,19 @@ unsafe partial class IWICStreamExtensions /// public HRESULT QueryInterface(Guid* riid, void** ppvObject) { - return ((delegate* unmanaged)lpVtbl[0])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject); + return ((delegate* unmanaged)this.lpVtbl[0])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject); } /// public uint AddRef() { - return ((delegate* unmanaged)lpVtbl[1])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged)this.lpVtbl[1])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this)); } /// public uint Release() { - return ((delegate* unmanaged)lpVtbl[2])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged)this.lpVtbl[2])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this)); } #endif diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs index df4564ef..44cb9846 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs @@ -270,19 +270,19 @@ internal static unsafe partial class IWICStreamExtensions /// public HRESULT QueryInterface(Guid* riid, void** ppvObject) { - return ((delegate* unmanaged)lpVtbl[0])((IStreamWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject); + return ((delegate* unmanaged)this.lpVtbl[0])((IStreamWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject); } /// public uint AddRef() { - return ((delegate* unmanaged)lpVtbl[1])((IStreamWrapper*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged)this.lpVtbl[1])((IStreamWrapper*)Unsafe.AsPointer(ref this)); } /// public uint Release() { - return ((delegate* unmanaged)lpVtbl[2])((IStreamWrapper*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged)this.lpVtbl[2])((IStreamWrapper*)Unsafe.AsPointer(ref this)); } #endif diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.cs b/src/ComputeSharp/Graphics/GraphicsDevice.cs index 1b33975a..b3aed608 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.cs @@ -97,12 +97,12 @@ public sealed unsafe partial class GraphicsDevice : NativeObject /// /// The event for the device removed callback. /// - private HANDLE deviceRemovedEvent; + private readonly HANDLE deviceRemovedEvent; /// /// The wait handle for the device removed callback. /// - private HANDLE deviceRemovedWaitHandle; + private readonly HANDLE deviceRemovedWaitHandle; /// /// The reason the device was removed, if any. diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs index f76638a0..e9fb6501 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs @@ -89,7 +89,7 @@ public abstract unsafe class Buffer : NativeObject, IGraphicsResource nint usableSizeInBytes = checked((nint)(length * elementSizeInBytes)); nint effectiveSizeInBytes = resourceType == ResourceType.Constant ? AlignmentHelper.Pad(usableSizeInBytes, D3D12.D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT) : usableSizeInBytes; - SizeInBytes = usableSizeInBytes; + this.SizeInBytes = usableSizeInBytes; GraphicsDevice = device; Length = length; @@ -140,7 +140,7 @@ public abstract unsafe class Buffer : NativeObject, IGraphicsResource internal bool IsPaddingPresent { [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => SizeInBytes > (nint)Length * sizeof(T); + get => this.SizeInBytes > (nint)Length * sizeof(T); } /// diff --git a/src/ComputeSharp/Graphics/Resources/Interop/ID3D12ResourceMap.cs b/src/ComputeSharp/Graphics/Resources/Interop/ID3D12ResourceMap.cs index 734fc6f1..4838fd9e 100644 --- a/src/ComputeSharp/Graphics/Resources/Interop/ID3D12ResourceMap.cs +++ b/src/ComputeSharp/Graphics/Resources/Interop/ID3D12ResourceMap.cs @@ -30,7 +30,7 @@ internal readonly unsafe ref struct ID3D12ResourceMap { this.d3D12Resource = d3D12Resource; - Pointer = pointer; + this.Pointer = pointer; } /// diff --git a/src/ComputeSharp/Shaders/Dispatching/__Internals/ArrayPoolStringBuilder.cs b/src/ComputeSharp/Shaders/Dispatching/__Internals/ArrayPoolStringBuilder.cs index c42c0bdd..2e9ef06e 100644 --- a/src/ComputeSharp/Shaders/Dispatching/__Internals/ArrayPoolStringBuilder.cs +++ b/src/ComputeSharp/Shaders/Dispatching/__Internals/ArrayPoolStringBuilder.cs @@ -130,7 +130,7 @@ public ref struct ArrayPoolStringBuilder Array.Copy(this.array, 0, newArray, 0, itemsToCopy); - ArrayPool.Shared.Return(array); + ArrayPool.Shared.Return(this.array); this.array = newArray; } diff --git a/src/ComputeSharp/Shaders/Models/ShaderKey.cs b/src/ComputeSharp/Shaders/Models/ShaderKey.cs index d805f4d0..695630c9 100644 --- a/src/ComputeSharp/Shaders/Models/ShaderKey.cs +++ b/src/ComputeSharp/Shaders/Models/ShaderKey.cs @@ -49,10 +49,10 @@ internal readonly struct ShaderKey : IEquatable public bool Equals(ShaderKey other) { return - id == other.id && - threadsX == other.threadsX && - threadsY == other.threadsY && - threadsZ == other.threadsZ; + this.id == other.id && + this.threadsX == other.threadsX && + this.threadsY == other.threadsY && + this.threadsZ == other.threadsZ; } /// @@ -65,6 +65,6 @@ internal readonly struct ShaderKey : IEquatable [MethodImpl(MethodImplOptions.AggressiveInlining)] public override int GetHashCode() { - return HashCode.Combine(id, threadsX, threadsY, threadsZ); + return HashCode.Combine(this.id, this.threadsX, this.threadsY, this.threadsZ); } } \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1EffectRegistrationDataTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1EffectRegistrationDataTests.cs index ce7c9710..712eab69 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1EffectRegistrationDataTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1EffectRegistrationDataTests.cs @@ -117,7 +117,7 @@ public partial class D2D1EffectRegistrationDataTests public float4 Execute() { - return a; + return this.a; } } } \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderEffectTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderEffectTests.cs index b85e07a4..d5a05cd0 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderEffectTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderEffectTests.cs @@ -145,7 +145,7 @@ public partial class D2D1PixelShaderEffectTests public float4 Execute() { - return dummy; + return this.dummy; } } @@ -180,7 +180,7 @@ public partial class D2D1PixelShaderEffectTests public float4 Execute() { - return a + b + c.X + d + e; + return this.a + this.b + this.c.X + this.d + this.e; } } } \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs index 33d6a7ef..5c574592 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs @@ -232,14 +232,14 @@ public partial class D2D1PixelShaderTests public Float4 Execute() { - float4 pixel1 = myTexture1[0]; - float4 pixel2 = myTexture1.Sample(0.4f); - float4 pixel3 = myTexture2[0, 1]; - float4 pixel4 = myTexture2.Sample(0.4f, 0.3f); - float4 pixel5 = myTexture3[0, 1, 2]; - float4 pixel6 = myTexture3.Sample(0.4f, 0.5f, 0.6f); - float number1 = myTexture4[0, 2]; - float number2 = myTexture4.Sample(0.4f, 0.6f); + float4 pixel1 = this.myTexture1[0]; + float4 pixel2 = this.myTexture1.Sample(0.4f); + float4 pixel3 = this.myTexture2[0, 1]; + float4 pixel4 = this.myTexture2.Sample(0.4f, 0.3f); + float4 pixel5 = this.myTexture3[0, 1, 2]; + float4 pixel6 = this.myTexture3.Sample(0.4f, 0.5f, 0.6f); + float number1 = this.myTexture4[0, 2]; + float number2 = this.myTexture4.Sample(0.4f, 0.6f); return 0; } diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs index 0a875935..eeaa1b5b 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs @@ -547,8 +547,8 @@ public partial class D2D1ResourceTextureManagerTests int2 xy = (int2)D2D.GetScenePosition().XY; int x = xy.X; - int y = (int)((uint)xy.Y % (uint)height); - int z = (int)((uint)xy.Y / (uint)height); + int y = (int)((uint)xy.Y % (uint)this.height); + int z = (int)((uint)xy.Y / (uint)this.height); return this.source[x, y, z]; } @@ -876,7 +876,7 @@ public partial class D2D1ResourceTextureManagerTests public float4 Execute() { - return source[0, 0]; + return this.source[0, 0]; } } } \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressorTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressorTests.cs index 2ab11ac8..7b5b24dd 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressorTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressorTests.cs @@ -16,7 +16,7 @@ internal sealed partial class D2D1ResourceTextureUninitializedFieldDiagnosticSup public float4 Execute() { - return texture[0]; + return this.texture[0]; } } } \ No newline at end of file diff --git a/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs b/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs index d4a2be20..b01879ee 100644 --- a/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs +++ b/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs @@ -167,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(this.componentsCount - 1, KernelComponents.Count)); return (KernelComponents[index], KernelScales[index]); } @@ -177,10 +177,10 @@ public sealed partial class BokehBlurEffect /// private Complex64[][] CreateComplexKernels() { - Complex64[][] kernels = new Complex64[kernelParameters.Length][]; - ref Vector4 baseRef = ref MemoryMarshal.GetReference(kernelParameters.AsSpan()); + Complex64[][] kernels = new Complex64[this.kernelParameters.Length][]; + ref Vector4 baseRef = ref MemoryMarshal.GetReference(this.kernelParameters.AsSpan()); - for (int i = 0; i < kernelParameters.Length; i++) + for (int i = 0; i < this.kernelParameters.Length; i++) { ref Vector4 paramsRef = ref Unsafe.Add(ref baseRef, i); @@ -197,15 +197,15 @@ public sealed partial class BokehBlurEffect /// The angle component for each complex component. private Complex64[] CreateComplex1DKernel(float a, float b) { - Complex64[] kernel = new Complex64[kernelSize]; + Complex64[] kernel = new Complex64[this.kernelSize]; ref Complex64 baseRef = ref MemoryMarshal.GetReference(kernel.AsSpan()); - int r = radius; + int r = this.radius; int n = -r; - for (int i = 0; i < kernelSize; i++, n++) + for (int i = 0; i < this.kernelSize; i++, n++) { // Incrementally compute the range values - float value = n * kernelsScale * (1f / r); + float value = n * this.kernelsScale * (1f / r); value *= value; @@ -321,7 +321,7 @@ public sealed partial class BokehBlurEffect D2D1PixelShaderEffect.RegisterForD2D1Factory1(d2D1Factory2.Get(), out _); D2D1PixelShaderEffect.RegisterForD2D1Factory1(d2D1Factory2.Get(), out _); - int numberOfComponents = kernelParameters.Length; + int numberOfComponents = this.kernelParameters.Length; using ComPtr gammaExposureEffect = default; using ComPtr inverseGammaExposureEffect = default; @@ -422,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, this.kernelParameters[i].Z, this.kernelParameters[i].W), horizontalConvolutionEffects[i].Get()); } // Build the effect graph: @@ -579,14 +579,14 @@ public sealed partial class BokehBlurEffect { float4 sourceReal = D2D.SampleInputAtOffset(0, new float2(i - radiusX, 0)); float4 sourceImaginary = D2D.SampleInputAtOffset(1, new float2(i - radiusX, 0)); - float realFactor = kernelReals[i]; - float imaginaryFactor = kernelImaginaries[i]; + float realFactor = this.kernelReals[i]; + float imaginaryFactor = this.kernelImaginaries[i]; result.Real += (Vector4)((realFactor * sourceReal) - (imaginaryFactor * sourceImaginary)); result.Imaginary += (Vector4)((realFactor * sourceImaginary) + (imaginaryFactor * sourceReal)); } - return result.WeightedSum(z, w); + return result.WeightedSum(this.z, this.w); } } } diff --git a/tests/ComputeSharp.D2D1.Tests/Effects/CheckerboardClipEffect.cs b/tests/ComputeSharp.D2D1.Tests/Effects/CheckerboardClipEffect.cs index 612dd11e..22ca046c 100644 --- a/tests/ComputeSharp.D2D1.Tests/Effects/CheckerboardClipEffect.cs +++ b/tests/ComputeSharp.D2D1.Tests/Effects/CheckerboardClipEffect.cs @@ -18,8 +18,8 @@ public partial struct CheckerboardClipEffect : ID2D1PixelShader uint x = (uint)Hlsl.Floor(position.X); uint y = (uint)Hlsl.Floor(position.Y); - uint cellX = (uint)(int)Hlsl.Floor(x / cellSize); - uint cellY = (uint)(int)Hlsl.Floor(y / cellSize); + uint cellX = (uint)(int)Hlsl.Floor(x / this.cellSize); + uint cellY = (uint)(int)Hlsl.Floor(y / this.cellSize); if ((cellX % 2 == 0 && cellY % 2 == 0) || (cellX % 2 == 1 && cellY % 2 == 1)) diff --git a/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs b/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs index 8962414f..e261d54a 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/DeviceDisposalTests.cs @@ -139,7 +139,7 @@ public partial class DeviceDisposalTests public void Execute() { - buffer[ThreadIds.X] = ThreadIds.X; + this.buffer[ThreadIds.X] = ThreadIds.X; } } diff --git a/tests/ComputeSharp.Tests.DeviceLost/TerraFX.Interop.Windows/ID3D12Device5.cs b/tests/ComputeSharp.Tests.DeviceLost/TerraFX.Interop.Windows/ID3D12Device5.cs index ca93425b..8ebba14b 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/TerraFX.Interop.Windows/ID3D12Device5.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/TerraFX.Interop.Windows/ID3D12Device5.cs @@ -19,13 +19,13 @@ namespace TerraFX.Interop.DirectX [MethodImpl(MethodImplOptions.AggressiveInlining)] public uint Release() { - return ((delegate* unmanaged[Stdcall])lpVtbl[2])((ID3D12Device5*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])this.lpVtbl[2])((ID3D12Device5*)Unsafe.AsPointer(ref this)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RemoveDevice() { - ((delegate* unmanaged[Stdcall])lpVtbl[58])((ID3D12Device5*)Unsafe.AsPointer(ref this)); + ((delegate* unmanaged[Stdcall])this.lpVtbl[58])((ID3D12Device5*)Unsafe.AsPointer(ref this)); } } } diff --git a/tests/ComputeSharp.Tests.DisableDynamicCompilation/DispatchTests.cs b/tests/ComputeSharp.Tests.DisableDynamicCompilation/DispatchTests.cs index 1b28e09f..7c8c903f 100644 --- a/tests/ComputeSharp.Tests.DisableDynamicCompilation/DispatchTests.cs +++ b/tests/ComputeSharp.Tests.DisableDynamicCompilation/DispatchTests.cs @@ -50,7 +50,7 @@ public partial class DispatchTests /// public void Execute() { - buffer[ThreadIds.X] *= factor; + this.buffer[ThreadIds.X] *= this.factor; } } @@ -94,7 +94,7 @@ public partial class DispatchTests /// public float4 Execute() { - return new(ThreadIds.Normalized.X, ThreadIds.Normalized.Y, b, a); + return new(ThreadIds.Normalized.X, ThreadIds.Normalized.Y, this.b, this.a); } } } \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.Internals/ShaderHashCodeTests.cs b/tests/ComputeSharp.Tests.Internals/ShaderHashCodeTests.cs index adbcb121..a4dcdcd5 100644 --- a/tests/ComputeSharp.Tests.Internals/ShaderHashCodeTests.cs +++ b/tests/ComputeSharp.Tests.Internals/ShaderHashCodeTests.cs @@ -17,7 +17,7 @@ public partial class ShaderHashCodeTests public void Execute() { - B[0] = A; + this.B[0] = this.A; } } @@ -49,7 +49,7 @@ public partial class ShaderHashCodeTests public void Execute() { - B[0] = F(A); + this.B[0] = this.F(this.A); } } diff --git a/tests/ComputeSharp.Tests/BufferTests.cs b/tests/ComputeSharp.Tests/BufferTests.cs index 3417d739..8f223ecf 100644 --- a/tests/ComputeSharp.Tests/BufferTests.cs +++ b/tests/ComputeSharp.Tests/BufferTests.cs @@ -286,7 +286,7 @@ public partial class BufferTests public void Execute() { - destination[ThreadIds.X] = source[ThreadIds.X]; + this.destination[ThreadIds.X] = this.source[ThreadIds.X]; } } @@ -314,7 +314,7 @@ public partial class BufferTests public void Execute() { - destination[ThreadIds.X] = source[ThreadIds.X]; + this.destination[ThreadIds.X] = this.source[ThreadIds.X]; } } @@ -342,7 +342,7 @@ public partial class BufferTests public void Execute() { - destination[ThreadIds.X] = source[ThreadIds.X]; + this.destination[ThreadIds.X] = this.source[ThreadIds.X]; } } @@ -378,7 +378,7 @@ public partial class BufferTests /// public void Execute() { - buffer[ThreadIds.X] = (buffer[ThreadIds.X] * factor) + 3.14; + this.buffer[ThreadIds.X] = (this.buffer[ThreadIds.X] * this.factor) + 3.14; } } diff --git a/tests/ComputeSharp.Tests/ComputeContextTests.cs b/tests/ComputeSharp.Tests/ComputeContextTests.cs index 0820dfd8..78ce0ab5 100644 --- a/tests/ComputeSharp.Tests/ComputeContextTests.cs +++ b/tests/ComputeSharp.Tests/ComputeContextTests.cs @@ -1302,7 +1302,7 @@ public partial class ComputeContextTests /// public void Execute() { - buffer[offset + ThreadIds.X] *= 2; + this.buffer[this.offset + ThreadIds.X] *= 2; } } @@ -1324,7 +1324,7 @@ public partial class ComputeContextTests /// public float4 Execute() { - return color; + return this.color; } } @@ -1336,7 +1336,7 @@ public partial class ComputeContextTests /// public float4 Execute() { - return source.Sample(ThreadIds.Normalized.XY); + return this.source.Sample(ThreadIds.Normalized.XY); } } @@ -1354,7 +1354,7 @@ public partial class ComputeContextTests // The source has a depth of 3, but the destination has a depth of 2 xyz.Z = Hlsl.Lerp(0, 0.5f, xyz.Z); - destination[ThreadIds.XYZ] = source.Sample(xyz); + this.destination[ThreadIds.XYZ] = this.source.Sample(xyz); } } @@ -1366,7 +1366,7 @@ public partial class ComputeContextTests /// public float4 Execute() { - return source.Sample(ThreadIds.Normalized.XY); + return this.source.Sample(ThreadIds.Normalized.XY); } } @@ -1378,7 +1378,7 @@ public partial class ComputeContextTests /// public float4 Execute() { - return source[ThreadIds.XY]; + return this.source[ThreadIds.XY]; } } @@ -1390,7 +1390,7 @@ public partial class ComputeContextTests /// public float4 Execute() { - return new(1.0f - source[ThreadIds.XY].XYZ, source[ThreadIds.XY].W); + return new(1.0f - this.source[ThreadIds.XY].XYZ, this.source[ThreadIds.XY].W); } } @@ -1408,7 +1408,7 @@ public partial class ComputeContextTests // See comment in LinearSampling3DComputeShader xyz.Z = Hlsl.Lerp(0, 0.5f, xyz.Z); - destination[ThreadIds.XYZ] = source.Sample(xyz); + this.destination[ThreadIds.XYZ] = this.source.Sample(xyz); } } @@ -1430,11 +1430,11 @@ public partial class ComputeContextTests (ThreadIds.Normalized.X > 0.5f && ThreadIds.Normalized.Y > 0.5)) { - source[ThreadIds.XY] = float4.UnitW; + this.source[ThreadIds.XY] = float4.UnitW; } else { - source[ThreadIds.XY] = float4.Zero; + this.source[ThreadIds.XY] = float4.Zero; } } } @@ -1458,11 +1458,11 @@ public partial class ComputeContextTests (ThreadIds.Normalized.X > 0.5f && ThreadIds.Normalized.Y > 0.5)) { - source[ThreadIds.XYZ] = float4.UnitW; + this.source[ThreadIds.XYZ] = float4.UnitW; } else { - source[ThreadIds.XYZ] = float4.Zero; + this.source[ThreadIds.XYZ] = float4.Zero; } } } @@ -1477,7 +1477,7 @@ public partial class ComputeContextTests /// public void Execute() { - destination[ThreadIds.XY] = source[ThreadIds.XY]; + this.destination[ThreadIds.XY] = this.source[ThreadIds.XY]; } } } \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/DispatchTests.cs b/tests/ComputeSharp.Tests/DispatchTests.cs index db787199..7e93e0a4 100644 --- a/tests/ComputeSharp.Tests/DispatchTests.cs +++ b/tests/ComputeSharp.Tests/DispatchTests.cs @@ -63,7 +63,7 @@ public partial class DispatchTests public void Execute() { - buffer[ThreadIds.XYZ].XYZ = ThreadIds.XYZ; + this.buffer[ThreadIds.XYZ].XYZ = ThreadIds.XYZ; } } @@ -117,9 +117,9 @@ public partial class DispatchTests public void Execute() { - buffer[ThreadIds.XYZ].XYZ = ThreadIds.Normalized.XYZ; - buffer[ThreadIds.XYZ].XY = ThreadIds.Normalized.XY; - buffer[ThreadIds.XYZ].W = ThreadIds.Normalized.X; + this.buffer[ThreadIds.XYZ].XYZ = ThreadIds.Normalized.XYZ; + this.buffer[ThreadIds.XYZ].XY = ThreadIds.Normalized.XY; + this.buffer[ThreadIds.XYZ].W = ThreadIds.Normalized.X; } } @@ -178,8 +178,8 @@ public partial class DispatchTests public void Execute() { - buffer[ThreadIds.XYZ].XYZ = GroupIds.XYZ; - buffer[ThreadIds.XYZ].W = GroupIds.Index; + this.buffer[ThreadIds.XYZ].XYZ = GroupIds.XYZ; + this.buffer[ThreadIds.XYZ].W = GroupIds.Index; } } @@ -208,12 +208,12 @@ public partial class DispatchTests public void Execute() { - buffer[0] = GroupSize.X; - buffer[1] = GroupSize.Y; - buffer[2] = GroupSize.Z; - buffer[3] = GroupSize.Count; - buffer[4] = (int)Hlsl.Dot(GroupSize.XY, float2.One); - buffer[5] = (int)Hlsl.Dot(GroupSize.XYZ, float3.One); + this.buffer[0] = GroupSize.X; + this.buffer[1] = GroupSize.Y; + this.buffer[2] = GroupSize.Z; + this.buffer[3] = GroupSize.Count; + this.buffer[4] = (int)Hlsl.Dot(GroupSize.XY, float2.One); + this.buffer[5] = (int)Hlsl.Dot(GroupSize.XYZ, float3.One); } } @@ -240,7 +240,7 @@ public partial class DispatchTests public void Execute() { - buffer[ThreadIds.X] = GridIds.X; + this.buffer[ThreadIds.X] = GridIds.X; } } @@ -271,12 +271,12 @@ public partial class DispatchTests public void Execute() { - buffer[0] = DispatchSize.Count; - buffer[1] = DispatchSize.X; - buffer[2] = DispatchSize.Y; - buffer[3] = DispatchSize.Z; - buffer[4] = (int)Hlsl.Dot(DispatchSize.XY, float2.One); - buffer[5] = (int)Hlsl.Dot(DispatchSize.XYZ, float3.One); + this.buffer[0] = DispatchSize.Count; + this.buffer[1] = DispatchSize.X; + this.buffer[2] = DispatchSize.Y; + this.buffer[3] = DispatchSize.Z; + this.buffer[4] = (int)Hlsl.Dot(DispatchSize.XY, float2.One); + this.buffer[5] = (int)Hlsl.Dot(DispatchSize.XYZ, float3.One); } } @@ -354,7 +354,7 @@ public partial class DispatchTests if (!isWritingToGroupShared) { - buffer[index] = cache[index]; + this.buffer[index] = cache[index]; } } } @@ -397,7 +397,7 @@ public partial class DispatchTests if (!isWritingToGroupShared) { - buffer[index] = cache[index]; + this.buffer[index] = cache[index]; } } } diff --git a/tests/ComputeSharp.Tests/Helpers/TolerantImageComparer.cs b/tests/ComputeSharp.Tests/Helpers/TolerantImageComparer.cs index fcbba1ef..97ed11aa 100644 --- a/tests/ComputeSharp.Tests/Helpers/TolerantImageComparer.cs +++ b/tests/ComputeSharp.Tests/Helpers/TolerantImageComparer.cs @@ -138,7 +138,7 @@ internal static class TolerantImageComparer /// public override string ToString() { - return $"[delta({RedDifference},{GreenDifference},{BlueDifference},{AlphaDifference}) @ ({Position.X},{Position.Y})]"; + return $"[delta({this.RedDifference},{this.GreenDifference},{this.BlueDifference},{this.AlphaDifference}) @ ({this.Position.X},{this.Position.Y})]"; } } } \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/InitializationTests.cs b/tests/ComputeSharp.Tests/InitializationTests.cs index c0407c13..5e3332dc 100644 --- a/tests/ComputeSharp.Tests/InitializationTests.cs +++ b/tests/ComputeSharp.Tests/InitializationTests.cs @@ -79,7 +79,7 @@ public partial class InitializationTests public void Execute() { - buffer[ThreadIds.X] = ThreadIds.X; + this.buffer[ThreadIds.X] = ThreadIds.X; } } } \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/MetaprogrammingTests.cs b/tests/ComputeSharp.Tests/MetaprogrammingTests.cs index 99d72ae7..91bad97b 100644 --- a/tests/ComputeSharp.Tests/MetaprogrammingTests.cs +++ b/tests/ComputeSharp.Tests/MetaprogrammingTests.cs @@ -19,7 +19,7 @@ public partial class MetaprogrammingTests public void Execute() { - buffer[ThreadIds.X] = activation(ThreadIds.X); + this.buffer[ThreadIds.X] = this.activation(ThreadIds.X); } } @@ -135,7 +135,7 @@ public partial class MetaprogrammingTests public void Execute() { - buffer[ThreadIds.X] = f2(f1(ThreadIds.X)); + this.buffer[ThreadIds.X] = this.f2(this.f1(ThreadIds.X)); } } @@ -166,7 +166,7 @@ public partial class MetaprogrammingTests public void Execute() { - buffer[ThreadIds.X] = MagicNumber + activation(ThreadIds.X); + this.buffer[ThreadIds.X] = MagicNumber + this.activation(ThreadIds.X); } } @@ -200,7 +200,7 @@ public partial class MetaprogrammingTests public void Execute() { - buffer[ThreadIds.X] = activation(ThreadIds.X); + this.buffer[ThreadIds.X] = this.activation(ThreadIds.X); } } @@ -229,7 +229,7 @@ public partial class MetaprogrammingTests public void Execute() { - buffer[ThreadIds.X] = Activations.AddOne(ThreadIds.X) + activation(ThreadIds.X); + this.buffer[ThreadIds.X] = Activations.AddOne(ThreadIds.X) + this.activation(ThreadIds.X); } } diff --git a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs index 22dc4179..867795b7 100644 --- a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs +++ b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs @@ -3,7 +3,7 @@ using ComputeSharp.Interop; using ComputeSharp.Tests.Misc; using Microsoft.VisualStudio.TestTools.UnitTesting; -#pragma warning disable IDE0008, IDE0022 +#pragma warning disable IDE0008, IDE0022, IDE0009 namespace ComputeSharp.Tests { diff --git a/tests/ComputeSharp.Tests/ShaderMembersTests.cs b/tests/ComputeSharp.Tests/ShaderMembersTests.cs index 110056ec..17708f73 100644 --- a/tests/ComputeSharp.Tests/ShaderMembersTests.cs +++ b/tests/ComputeSharp.Tests/ShaderMembersTests.cs @@ -3,6 +3,8 @@ using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; using Microsoft.VisualStudio.TestTools.UnitTesting; +#pragma warning disable IDE0009 + namespace ComputeSharp.Tests; [TestClass] diff --git a/tests/ComputeSharp.Tests/ShaderRewriterTests.cs b/tests/ComputeSharp.Tests/ShaderRewriterTests.cs index ce10ef54..cf9791de 100644 --- a/tests/ComputeSharp.Tests/ShaderRewriterTests.cs +++ b/tests/ComputeSharp.Tests/ShaderRewriterTests.cs @@ -4,7 +4,7 @@ using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; using Microsoft.VisualStudio.TestTools.UnitTesting; -#pragma warning disable IDE0008 +#pragma warning disable IDE0007, IDE0008, IDE0009 namespace ComputeSharp.Tests; diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/ColorfulInfinity.cs b/tests/ComputeSharp.Tests/Shaders/Compute/ColorfulInfinity.cs index dd3d5182..74e2c88d 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/ColorfulInfinity.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/ColorfulInfinity.cs @@ -1,4 +1,4 @@ -#pragma warning disable IDE0048 +#pragma warning disable IDE0048, IDE0009 namespace ComputeSharp.SwapChain.Shaders.Compute; diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/ContouredLayers.cs b/tests/ComputeSharp.Tests/Shaders/Compute/ContouredLayers.cs index c6c642c9..230fc637 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/ContouredLayers.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/ContouredLayers.cs @@ -1,4 +1,4 @@ -#pragma warning disable IDE0048, IDE0011, IDE0047 +#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009 namespace ComputeSharp.SwapChain.Shaders.Compute; diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/ExtrudedTruchetPattern.cs b/tests/ComputeSharp.Tests/Shaders/Compute/ExtrudedTruchetPattern.cs index 07ee6ba8..7ef2f2b5 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/ExtrudedTruchetPattern.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/ExtrudedTruchetPattern.cs @@ -1,4 +1,4 @@ -#pragma warning disable IDE0048, IDE0011 +#pragma warning disable IDE0048, IDE0011, IDE0009 namespace ComputeSharp.SwapChain.Shaders.Compute; diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/FourColorGradient.cs b/tests/ComputeSharp.Tests/Shaders/Compute/FourColorGradient.cs index 03901a66..4a88ee95 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/FourColorGradient.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/FourColorGradient.cs @@ -1,4 +1,4 @@ -#pragma warning disable IDE0048 +#pragma warning disable IDE0048, IDE0009 namespace ComputeSharp.SwapChain.Shaders.Compute; diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/FractalTiling.cs b/tests/ComputeSharp.Tests/Shaders/Compute/FractalTiling.cs index bbde1bf1..a1a79924 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/FractalTiling.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/FractalTiling.cs @@ -1,4 +1,4 @@ -#pragma warning disable IDE0048 +#pragma warning disable IDE0048, IDE0009 namespace ComputeSharp.SwapChain.Shaders.Compute; diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs b/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs index 4e260610..bd58fde3 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs @@ -1,4 +1,4 @@ -#pragma warning disable IDE0048 +#pragma warning disable IDE0048, IDE0009 namespace ComputeSharp.SwapChain.Shaders.Compute; diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/MengerJourney.cs b/tests/ComputeSharp.Tests/Shaders/Compute/MengerJourney.cs index d5ee7d5e..13d6cc1b 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/MengerJourney.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/MengerJourney.cs @@ -1,4 +1,4 @@ -#pragma warning disable IDE0048, IDE0011, IDE0047 +#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009 namespace ComputeSharp.SwapChain.Shaders.Compute; diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/Octagrams.cs b/tests/ComputeSharp.Tests/Shaders/Compute/Octagrams.cs index 21058894..a2da9f97 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/Octagrams.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/Octagrams.cs @@ -1,4 +1,4 @@ -#pragma warning disable IDE0048 +#pragma warning disable IDE0048, IDE0009 namespace ComputeSharp.SwapChain.Shaders.Compute; diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/ProteanClouds.cs b/tests/ComputeSharp.Tests/Shaders/Compute/ProteanClouds.cs index 741cce84..81091c26 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/ProteanClouds.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/ProteanClouds.cs @@ -1,4 +1,4 @@ -#pragma warning disable IDE0048, IDE0011, IDE0047 +#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009 namespace ComputeSharp.SwapChain.Shaders.Compute; diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/PyramidPattern.cs b/tests/ComputeSharp.Tests/Shaders/Compute/PyramidPattern.cs index e895170d..97b689a7 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/PyramidPattern.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/PyramidPattern.cs @@ -1,4 +1,4 @@ -#pragma warning disable IDE0048, IDE0011, IDE0047 +#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009 namespace ComputeSharp.SwapChain.Shaders.Compute; diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/TriangleGridContouring.cs b/tests/ComputeSharp.Tests/Shaders/Compute/TriangleGridContouring.cs index ed6dd8bf..4ed47840 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/TriangleGridContouring.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/TriangleGridContouring.cs @@ -1,4 +1,4 @@ -#pragma warning disable IDE0048, IDE0011, IDE0047 +#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009 namespace ComputeSharp.SwapChain.Shaders.Compute; diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/TwoTiledTruchet.cs b/tests/ComputeSharp.Tests/Shaders/Compute/TwoTiledTruchet.cs index 04e78e1c..142da84e 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/TwoTiledTruchet.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/TwoTiledTruchet.cs @@ -1,4 +1,4 @@ -#pragma warning disable IDE0048 +#pragma warning disable IDE0048, IDE0009 namespace ComputeSharp.SwapChain.Shaders.Compute; diff --git a/tests/ComputeSharp.Tests/Texture1DTests.Pixels.cs b/tests/ComputeSharp.Tests/Texture1DTests.Pixels.cs index 41a1c2a2..87697508 100644 --- a/tests/ComputeSharp.Tests/Texture1DTests.Pixels.cs +++ b/tests/ComputeSharp.Tests/Texture1DTests.Pixels.cs @@ -96,7 +96,7 @@ partial class Texture1DTests public void Execute() { - destination[ThreadIds.X] = source.Sample(ThreadIds.Normalized.X); + this.destination[ThreadIds.X] = this.source.Sample(ThreadIds.Normalized.X); } } diff --git a/tests/ComputeSharp.Tests/Texture1DTests.cs b/tests/ComputeSharp.Tests/Texture1DTests.cs index 32aa1ea7..21468a7c 100644 --- a/tests/ComputeSharp.Tests/Texture1DTests.cs +++ b/tests/ComputeSharp.Tests/Texture1DTests.cs @@ -370,7 +370,7 @@ public partial class Texture1DTests public void Execute() { - destination[ThreadIds.X] = source[ThreadIds.X]; + this.destination[ThreadIds.X] = this.source[ThreadIds.X]; } } @@ -400,7 +400,7 @@ public partial class Texture1DTests public void Execute() { - destination[ThreadIds.X] = source[ThreadIds.X]; + this.destination[ThreadIds.X] = this.source[ThreadIds.X]; } } } \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs index 2c32d10b..bd9a9e49 100644 --- a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs +++ b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs @@ -79,7 +79,7 @@ partial class Texture2DTests public void Execute() { - destination[ThreadIds.XY] = source.Sample(ThreadIds.Normalized.XY); + this.destination[ThreadIds.XY] = this.source.Sample(ThreadIds.Normalized.XY); } } @@ -111,7 +111,7 @@ partial class Texture2DTests public float4 Execute() { - return texture.Sample(ThreadIds.Normalized.XY); + return this.texture.Sample(ThreadIds.Normalized.XY); } } diff --git a/tests/ComputeSharp.Tests/Texture2DTests.cs b/tests/ComputeSharp.Tests/Texture2DTests.cs index d962c984..a9dec703 100644 --- a/tests/ComputeSharp.Tests/Texture2DTests.cs +++ b/tests/ComputeSharp.Tests/Texture2DTests.cs @@ -435,7 +435,7 @@ public partial class Texture2DTests public void Execute() { - destination[(ThreadIds.Y * 32) + ThreadIds.X] = source[ThreadIds.XY]; + this.destination[(ThreadIds.Y * 32) + ThreadIds.X] = this.source[ThreadIds.XY]; } } @@ -465,7 +465,7 @@ public partial class Texture2DTests public void Execute() { - destination[ThreadIds.XY] = source[ThreadIds.XY]; + this.destination[ThreadIds.XY] = this.source[ThreadIds.XY]; } } } \ No newline at end of file diff --git a/tests/ComputeSharp.Tests/Texture3DTests.cs b/tests/ComputeSharp.Tests/Texture3DTests.cs index 7908274c..62c4f4e7 100644 --- a/tests/ComputeSharp.Tests/Texture3DTests.cs +++ b/tests/ComputeSharp.Tests/Texture3DTests.cs @@ -540,7 +540,7 @@ public partial class Texture3DTests public void Execute() { - destination[(ThreadIds.Z * 32 * 32) + (ThreadIds.Y * 32) + ThreadIds.X] = source[ThreadIds.XYZ]; + this.destination[(ThreadIds.Z * 32 * 32) + (ThreadIds.Y * 32) + ThreadIds.X] = this.source[ThreadIds.XYZ]; } } @@ -570,7 +570,7 @@ public partial class Texture3DTests public void Execute() { - destination[ThreadIds.XYZ] = source[ThreadIds.XYZ]; + this.destination[ThreadIds.XYZ] = this.source[ThreadIds.XYZ]; } } } \ No newline at end of file