diff --git a/build/Directory.Build.props b/build/Directory.Build.props index a3173c64..b760c249 100644 --- a/build/Directory.Build.props +++ b/build/Directory.Build.props @@ -46,7 +46,7 @@ This is used eg. to replace Unsafe.SizeOf() calls with just sizeof(T). The warning is not necessary since in order to use these APIs the caller already has to be in an unsafe context. --> - $(NoWarn);CS8500;IDE0301;IDE0302 + $(NoWarn);CS8500;IDE0302 diff --git a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs index 2d4bffd6..cb3686f2 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Immutable; using System.Linq; using ComputeSharp.D2D1.SourceGenerators.Models; @@ -94,7 +93,7 @@ public sealed partial class D2DPixelShaderSourceGenerator : IIncrementalGenerato item.Hierarchy.WriteSyntax( state: item, writer: writer, - baseTypes: ReadOnlySpan.Empty, + baseTypes: [], memberCallbacks: new IndentedTextWriter.Callback[] { Execute.WriteSyntax }); context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.{item.MethodName}.g.cs", writer.ToString()); diff --git a/src/ComputeSharp.D2D1.WinUI/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs b/src/ComputeSharp.D2D1.WinUI/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs index cfd1947b..f801de9a 100644 --- a/src/ComputeSharp.D2D1.WinUI/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs +++ b/src/ComputeSharp.D2D1.WinUI/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs @@ -244,7 +244,7 @@ partial class PixelShaderEffect // Skip the array allocation if there are no resource texture descriptions if (descriptions.IsEmpty) { - return ImmutableArray.Empty; + return []; } int[] indices = new int[descriptions.Length]; diff --git a/src/ComputeSharp.D2D1.WinUI/PixelShaderEffect{T}.Properties.SourceCollection.cs b/src/ComputeSharp.D2D1.WinUI/PixelShaderEffect{T}.Properties.SourceCollection.cs index 688292de..4dd3e49d 100644 --- a/src/ComputeSharp.D2D1.WinUI/PixelShaderEffect{T}.Properties.SourceCollection.cs +++ b/src/ComputeSharp.D2D1.WinUI/PixelShaderEffect{T}.Properties.SourceCollection.cs @@ -213,7 +213,7 @@ partial class PixelShaderEffect if (inputCount == 0) { - return ImmutableArray.Empty; + return []; } int[] indices = new int[inputCount]; diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureManager.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureManager.cs index 4517c4f5..2909a1af 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureManager.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1ResourceTextureManager.cs @@ -140,8 +140,8 @@ public sealed unsafe class D2D1ResourceTextureManager : ICustomQueryInterface channelDepth, filter, extendModes, - ReadOnlySpan.Empty, - ReadOnlySpan.Empty) + [], + []) { } @@ -180,8 +180,8 @@ public sealed unsafe class D2D1ResourceTextureManager : ICustomQueryInterface channelDepth, filter, extendModes, - ReadOnlySpan.Empty, - ReadOnlySpan.Empty) + [], + []) { } diff --git a/src/ComputeSharp.SourceGeneration/Models/HierarchyInfo.cs b/src/ComputeSharp.SourceGeneration/Models/HierarchyInfo.cs index 5127fbcd..82c5d47f 100644 --- a/src/ComputeSharp.SourceGeneration/Models/HierarchyInfo.cs +++ b/src/ComputeSharp.SourceGeneration/Models/HierarchyInfo.cs @@ -143,7 +143,7 @@ internal sealed partial record HierarchyInfo(string FullyQualifiedMetadataName, /// A instance for the current hierarchy. public CompilationUnitSyntax GetSyntax(params MemberDeclarationSyntax[] memberDeclarations) { - return GetSyntax(memberDeclarations, Array.Empty()); + return GetSyntax(memberDeclarations, []); } /// diff --git a/src/ComputeSharp.SourceGenerators/Dxc/DxcShaderCompiler.cs b/src/ComputeSharp.SourceGenerators/Dxc/DxcShaderCompiler.cs index 37636a9e..255b29a5 100644 --- a/src/ComputeSharp.SourceGenerators/Dxc/DxcShaderCompiler.cs +++ b/src/ComputeSharp.SourceGenerators/Dxc/DxcShaderCompiler.cs @@ -121,7 +121,7 @@ internal sealed unsafe class DxcShaderCompiler pEntryPoint: "Execute", pTargetProfile: "cs_6_0", pArguments: arguments.AsSpan(0, 3), - pDefines: ReadOnlySpan.Empty, + pDefines: [], pIncludeHandler: this.dxcIncludeHandler.Get(), ppResult: dxcOperationResult.GetAddressOf()); diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs index 2f2a43ff..f367e736 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs @@ -629,9 +629,7 @@ namespace ComputeSharp.D2D1.Tests { ShaderWithNoCapturedValues shader = default; - byte[] buffer = Array.Empty(); - - int bytesWritten = D2D1PixelShader.GetConstantBuffer(in shader, buffer); + int bytesWritten = D2D1PixelShader.GetConstantBuffer(in shader, []); Assert.AreEqual(bytesWritten, 0); } diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs index b3001bc0..5db7c070 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureManagerTests.cs @@ -158,8 +158,8 @@ public partial class D2D1ResourceTextureManagerTests channelDepth: D2D1ChannelDepth.Four, filter: D2D1Filter.MinMagMipPoint, extendModes: stackalloc[] { D2D1ExtendMode.Clamp, D2D1ExtendMode.Clamp }, - data: ReadOnlySpan.Empty, - strides: ReadOnlySpan.Empty); + data: [], + strides: []); using ComPtr d2D1Effect = default; @@ -596,7 +596,7 @@ public partial class D2D1ResourceTextureManagerTests resourceTextureManager.Update( minimumExtents: stackalloc uint[] { (uint)startOffset }, maximimumExtents: stackalloc uint[] { (uint)(startOffset + updateLength) }, - strides: ReadOnlySpan.Empty, + strides: [], data: data); data.CopyTo(texture.AsSpan(startOffset)); diff --git a/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs b/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs index 58cdee32..a823b59a 100644 --- a/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs +++ b/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs @@ -379,7 +379,7 @@ public sealed partial class BokehBlurEffect filter: D2D1Filter.MinMagMipPoint, extendModes: stackalloc[] { D2D1ExtendMode.Clamp }, data: MemoryMarshal.AsBytes(this.kernels[i].Real.AsSpan()), - strides: ReadOnlySpan.Empty); + strides: []); // Also create the one for the imaginary kernel D2D1ResourceTextureManager kernelImaginary = new( @@ -389,7 +389,7 @@ public sealed partial class BokehBlurEffect filter: D2D1Filter.MinMagMipPoint, extendModes: stackalloc[] { D2D1ExtendMode.Clamp }, data: MemoryMarshal.AsBytes(this.kernels[i].Imaginary.AsSpan()), - strides: ReadOnlySpan.Empty); + strides: []); kernels[i] = (kernelReals, kernelImaginary); } diff --git a/tests/ComputeSharp.Tests/Attributes/CombinatorialTestMethodAttribute.cs b/tests/ComputeSharp.Tests/Attributes/CombinatorialTestMethodAttribute.cs index d883ea96..c878d703 100644 --- a/tests/ComputeSharp.Tests/Attributes/CombinatorialTestMethodAttribute.cs +++ b/tests/ComputeSharp.Tests/Attributes/CombinatorialTestMethodAttribute.cs @@ -33,7 +33,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes } else { - devices = Array.Empty(); + devices = []; } Type[] resources = methodInfo.GetCustomAttributes().Select(static value => value.Type).ToArray(); @@ -272,6 +272,6 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes /// string? ITestDataSource.GetDisplayName(MethodInfo methodInfo, object?[]? data) { - return $"{methodInfo.Name} ({string.Join(", ", data ?? Array.Empty())})"; + return $"{methodInfo.Name} ({string.Join(", ", data ?? [])})"; } } \ No newline at end of file