diff --git a/samples/ComputeSharp.SwapChain/Program.cs b/samples/ComputeSharp.SwapChain/Program.cs index f34c3b3c..29381a57 100644 --- a/samples/ComputeSharp.SwapChain/Program.cs +++ b/samples/ComputeSharp.SwapChain/Program.cs @@ -1,6 +1,5 @@ using System; using System.IO; -using System.Reflection; using System.Runtime.CompilerServices; using ComputeSharp.SwapChain.Backend; using ComputeSharp.SwapChain.Shaders; @@ -12,25 +11,25 @@ class Program /// /// A texture for \Textures\RustyMetal.png. /// - private static readonly IReadOnlyNormalizedTexture2D RustyMetal = LoadTexture(); + private static readonly Lazy> RustyMetal = new(static () => LoadTexture()); /// /// The mapping of available samples to choose from. /// - private static readonly Win32Application[] Samples = new Win32Application[] + private static readonly (string ShaderName, Win32Application Application)[] Samples = new (string, Win32Application)[] { - new SwapChainApplication(static time => new((float)time.TotalSeconds)), - new SwapChainApplication(static time => new((float)time.TotalSeconds)), - new SwapChainApplication(static time => new((float)time.TotalSeconds)), - new SwapChainApplication(static time => new((float)time.TotalSeconds)), - new SwapChainApplication(static time => new((float)time.TotalSeconds)), - new SwapChainApplication(static time => new((float)time.TotalSeconds)), - new SwapChainApplication(static time => new((float)time.TotalSeconds)), - new SwapChainApplication(static time => new((float)time.TotalSeconds)), - new SwapChainApplication(static time => new((float)time.TotalSeconds)), - new SwapChainApplication(static time => new((float)time.TotalSeconds)), - new SwapChainApplication(static time => new((float)time.TotalSeconds)), - new SwapChainApplication(static time => new((float)time.TotalSeconds, RustyMetal)) + (nameof(HelloWorld), new SwapChainApplication(static time => new((float)time.TotalSeconds))), + (nameof(FourColorGradient), new SwapChainApplication(static time => new((float)time.TotalSeconds))), + (nameof(ColorfulInfinity), new SwapChainApplication(static time => new((float)time.TotalSeconds))), + (nameof(FractalTiling), new SwapChainApplication(static time => new((float)time.TotalSeconds))), + (nameof(TwoTiledTruchet), new SwapChainApplication(static time => new((float)time.TotalSeconds))), + (nameof(MengerJourney), new SwapChainApplication(static time => new((float)time.TotalSeconds))), + (nameof(Octagrams), new SwapChainApplication(static time => new((float)time.TotalSeconds))), + (nameof(ProteanClouds), new SwapChainApplication(static time => new((float)time.TotalSeconds))), + (nameof(ExtrudedTruchetPattern), new SwapChainApplication(static time => new((float)time.TotalSeconds))), + (nameof(PyramidPattern), new SwapChainApplication(static time => new((float)time.TotalSeconds))), + (nameof(TriangleGridContouring), new SwapChainApplication(static time => new((float)time.TotalSeconds))), + (nameof(ContouredLayers), new SwapChainApplication(static time => new((float)time.TotalSeconds, RustyMetal.Value))) }; static void Main() @@ -45,7 +44,7 @@ class Program for (int i = 0; i < Samples.Length; i++) { - Console.WriteLine($"{i}: {Samples[i].GetType().GenericTypeArguments[0].Name}"); + Console.WriteLine($"{i}: {Samples[i].ShaderName}"); } Console.WriteLine($"{Samples.Length}+: Exit (Use Escape, 'Q', or Alt + F4 to exit a sample once chosen)"); @@ -60,9 +59,9 @@ class Program if (index >= 0 && index < Samples.Length) { Console.WriteLine(); - Console.WriteLine($"Starting {Samples[index].GetType().GenericTypeArguments[0].Name}..."); + Console.WriteLine($"Starting {Samples[index].ShaderName}..."); - Win32ApplicationRunner.Run(Samples[index]); + Win32ApplicationRunner.Run(Samples[index].Application); } } while (index >= 0 && index < Samples.Length); @@ -75,7 +74,7 @@ class Program /// A texture with the data from the image at the specified name. private static ReadOnlyTexture2D LoadTexture([CallerMemberName] string name = null!) { - string filename = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Textures", $"{name}.png"); + string filename = Path.Combine(AppContext.BaseDirectory, "Textures", $"{name}.png"); return GraphicsDevice.GetDefault().LoadReadOnlyTexture2D(filename); } diff --git a/src/ComputeSharp.NetStandard/ComputeSharp.NetStandard.projitems b/src/ComputeSharp.NetStandard/ComputeSharp.NetStandard.projitems index f9ab186d..9c229e84 100644 --- a/src/ComputeSharp.NetStandard/ComputeSharp.NetStandard.projitems +++ b/src/ComputeSharp.NetStandard/ComputeSharp.NetStandard.projitems @@ -12,6 +12,7 @@ + diff --git a/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/MemberNotNullAttribute.cs b/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/MemberNotNullAttribute.cs index 5659d922..7c3bade3 100644 --- a/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/MemberNotNullAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/MemberNotNullAttribute.cs @@ -1,4 +1,7 @@ -namespace System.Diagnostics.CodeAnalysis; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Diagnostics.CodeAnalysis; /// /// Specifies that the method or property will ensure that the listed field and property members have not-null values. diff --git a/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/RequiresUnreferencedCodeAttribute.cs b/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/RequiresUnreferencedCodeAttribute.cs new file mode 100644 index 00000000..7009fdd3 --- /dev/null +++ b/src/ComputeSharp.NetStandard/System/Diagnostics.CodeAnalysis/RequiresUnreferencedCodeAttribute.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Diagnostics.CodeAnalysis +{ + /// + /// Indicates that the specified method requires dynamic access to code that is not referenced + /// statically, for example through . + /// + /// + /// This allows tools to understand which methods are unsafe to call when removing unreferenced + /// code from an application. + /// + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class, Inherited = false)] + internal sealed class RequiresUnreferencedCodeAttribute : Attribute + { + /// + /// Initializes a new instance of the class + /// with the specified message. + /// + /// + /// A message that contains information about the usage of unreferenced code. + /// + public RequiresUnreferencedCodeAttribute(string message) + { + Message = message; + } + + /// + /// Gets a message that contains information about the usage of unreferenced code. + /// + public string Message { get; } + + /// + /// Gets or sets an optional URL that contains more information about the method, + /// why it requires unreferenced code, and what options a consumer has to deal with it. + /// + public string? Url { get; set; } + } +} \ No newline at end of file diff --git a/src/ComputeSharp.NetStandard/System/Runtime/CompilerServices/IsExternalInit.cs b/src/ComputeSharp.NetStandard/System/Runtime/CompilerServices/IsExternalInit.cs index a914bf06..775f605a 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/CompilerServices/IsExternalInit.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/CompilerServices/IsExternalInit.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.ComponentModel; namespace System.Runtime.CompilerServices; diff --git a/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs b/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs index c9cbc8f0..b35b322b 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/InteropServices/UnmanagedCallersOnlyAttribute.cs @@ -1,6 +1,9 @@ -using System; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. -namespace ComputeSharp.NetStandard.System.Runtime.InteropServices; +using System; + +namespace ComputeSharp.NetStandard.System.Runtime.InteropServices; // This cannot be in System.Runtime.InteropServices, or Roslyn will recognize it /// /// Any method marked with can be directly called from native code. @@ -9,6 +12,6 @@ namespace ComputeSharp.NetStandard.System.Runtime.InteropServices; /// This polyfill is deliberately in the wrong namespace to avoid the C# compiler failing to build below .NET 5. /// [AttributeUsage(AttributeTargets.Method, Inherited = false)] -public sealed class UnmanagedCallersOnlyAttribute : Attribute +internal sealed class UnmanagedCallersOnlyAttribute : Attribute { } \ No newline at end of file diff --git a/src/ComputeSharp.NetStandard/System/Runtime/Versioning/OSPlatformAttribute.cs b/src/ComputeSharp.NetStandard/System/Runtime/Versioning/OSPlatformAttribute.cs index 2cf0bc16..ad3bf2ff 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/Versioning/OSPlatformAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/Versioning/OSPlatformAttribute.cs @@ -1,4 +1,7 @@ -namespace System.Runtime.Versioning; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Runtime.Versioning; /// /// Base type for all platform-specific API attributes. diff --git a/src/ComputeSharp.NetStandard/System/Runtime/Versioning/SupportedOSVersionAttribute.cs b/src/ComputeSharp.NetStandard/System/Runtime/Versioning/SupportedOSVersionAttribute.cs index 9e829f55..3cc8bf1d 100644 --- a/src/ComputeSharp.NetStandard/System/Runtime/Versioning/SupportedOSVersionAttribute.cs +++ b/src/ComputeSharp.NetStandard/System/Runtime/Versioning/SupportedOSVersionAttribute.cs @@ -1,4 +1,7 @@ -namespace System.Runtime.Versioning; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace System.Runtime.Versioning; /// /// Records the operating system (and minimum version) that supports an API. Multiple @@ -9,19 +12,20 @@ /// or use guards to prevent calls to APIs on unsupported operating systems. /// A given platform should only be specified once. /// -[AttributeUsage(AttributeTargets.Assembly | - AttributeTargets.Class | - AttributeTargets.Constructor | - AttributeTargets.Enum | - AttributeTargets.Event | - AttributeTargets.Field | - AttributeTargets.Interface | - AttributeTargets.Method | - AttributeTargets.Module | - AttributeTargets.Property | - AttributeTargets.Struct, - AllowMultiple = true, - Inherited = false)] +[AttributeUsage( + AttributeTargets.Assembly | + AttributeTargets.Class | + AttributeTargets.Constructor | + AttributeTargets.Enum | + AttributeTargets.Event | + AttributeTargets.Field | + AttributeTargets.Interface | + AttributeTargets.Method | + AttributeTargets.Module | + AttributeTargets.Property | + AttributeTargets.Struct, + AllowMultiple = true, + Inherited = false)] internal sealed class SupportedOSPlatformAttribute : OSPlatformAttribute { public SupportedOSPlatformAttribute(string platformName) diff --git a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs index a434df13..5d3f3172 100644 --- a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs +++ b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.IO; using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Helpers; @@ -17,6 +18,7 @@ partial class GraphicsDeviceExtensions /// The length of the buffer to allocate. /// The allocation mode to use for the new resource. /// A zeroed instance of size . + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { @@ -32,6 +34,7 @@ partial class GraphicsDeviceExtensions /// The instance to use to allocate the buffer. /// The input array with the data to copy on the allocated buffer. /// A constant instance with the contents of the input array. + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, T[] source) where T : unmanaged { @@ -48,6 +51,7 @@ partial class GraphicsDeviceExtensions /// The instance to use to allocate the buffer. /// The input with the data to copy on the allocated buffer. /// A constant instance with the contents of the input . + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, ReadOnlySpan source) where T : unmanaged { @@ -67,6 +71,7 @@ partial class GraphicsDeviceExtensions /// The instance to use to allocate the buffer. /// The input with the data to copy on the allocated buffer. /// A constant instance with the contents of the input . + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, Buffer source) where T : unmanaged { @@ -88,6 +93,7 @@ partial class GraphicsDeviceExtensions /// The length of the buffer to allocate. /// The allocation mode to use for the new resource. /// A zeroed instance of size . + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { @@ -103,6 +109,7 @@ partial class GraphicsDeviceExtensions /// The instance to use to allocate the buffer. /// The input array with the data to copy on the allocated buffer. /// A read write instance with the contents of the input array. + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, T[] source) where T : unmanaged { @@ -119,6 +126,7 @@ partial class GraphicsDeviceExtensions /// The instance to use to allocate the buffer. /// The input with the data to copy on the allocated buffer. /// A read write instance with the contents of the input . + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, ReadOnlySpan source) where T : unmanaged { @@ -138,6 +146,7 @@ partial class GraphicsDeviceExtensions /// The instance to use to allocate the buffer. /// The input with the data to copy on the allocated buffer. /// A read write instance with the contents of the input . + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, Buffer source) where T : unmanaged { @@ -575,6 +584,7 @@ partial class GraphicsDeviceExtensions /// The length of the buffer to allocate. /// The allocation mode to use for the new resource. /// A zeroed instance of size . + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { @@ -590,6 +600,7 @@ partial class GraphicsDeviceExtensions /// The instance to use to allocate the buffer. /// The input array with the data to copy on the allocated buffer. /// A read write instance with the contents of the input array. + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, T[] source) where T : unmanaged { @@ -606,6 +617,7 @@ partial class GraphicsDeviceExtensions /// The instance to use to allocate the buffer. /// The input with the data to copy on the allocated buffer. /// A read write instance with the contents of the input . + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, ReadOnlySpan source) where T : unmanaged { @@ -625,6 +637,7 @@ partial class GraphicsDeviceExtensions /// The instance to use to allocate the buffer. /// The input with the data to copy on the allocated buffer. /// A read write instance with the contents of the input . + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, Buffer source) where T : unmanaged { diff --git a/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs b/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs index 1b0896c6..5f113201 100644 --- a/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs +++ b/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Reflection; namespace ComputeSharp.Graphics.Helpers; @@ -7,6 +8,7 @@ namespace ComputeSharp.Graphics.Helpers; /// A class providing info on specific types. /// /// The input type to extract info for. +[RequiresUnreferencedCode("This method reads type info of all fields of the input type (recursively).")] internal static class TypeInfo where T : unmanaged { @@ -20,6 +22,7 @@ internal static class TypeInfo /// /// The current type to check. /// Whether or not is or contains a field. + [RequiresUnreferencedCode("This method reads type info of all fields of the input type (recursively).")] private static bool ChecksIsDoubleOrContainsDoubles(Type type) { if (type == typeof(double)) return true; diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs index 2d97587d..05fd79ee 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs @@ -1,5 +1,5 @@ -using System; -using System.Buffers; +using System.Buffers; +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using ComputeSharp.Core.Helpers; @@ -63,6 +63,7 @@ public unsafe abstract class Buffer : NativeObject, IGraphicsResource /// The size in bytes of each buffer item (including padding, if any). /// The resource type for the current buffer. /// The allocation mode to use for the new resource. + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] private protected Buffer(GraphicsDevice device, int length, uint elementSizeInBytes, ResourceType resourceType, AllocationMode allocationMode) { if (resourceType == ResourceType.Constant) diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs index 81a977de..5ccda018 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs @@ -1,4 +1,5 @@ -using CommunityToolkit.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Commands; using ComputeSharp.Graphics.Extensions; using ComputeSharp.Graphics.Helpers; @@ -24,6 +25,7 @@ public abstract class StructuredBuffer : Buffer /// The number of items to store in the current buffer. /// The buffer type for the current buffer. /// The allocation mode to use for the new resource. + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] private protected unsafe StructuredBuffer(GraphicsDevice device, int length, ResourceType resourceType, AllocationMode allocationMode) : base(device, length, (uint)sizeof(T), resourceType, allocationMode) { diff --git a/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs index f7002cdc..56f4d842 100644 --- a/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using ComputeSharp.Core.Helpers; @@ -33,6 +34,7 @@ public sealed class ConstantBuffer : Buffer /// The associated with the current instance. /// The number of items to store in the current buffer. /// The allocation mode to use for the new resource. + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] internal ConstantBuffer(GraphicsDevice device, int length, AllocationMode allocationMode) : base(device, length, (uint)GetPaddedSize(), ResourceType.Constant, allocationMode) { diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyBuffer{T}.cs index 46613dae..ffa70ebb 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyBuffer{T}.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; @@ -21,6 +22,7 @@ public sealed class ReadOnlyBuffer : StructuredBuffer /// The associated with the current instance. /// The number of items to store in the current buffer. /// The allocation mode to use for the new resource. + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] internal ReadOnlyBuffer(GraphicsDevice device, int length, AllocationMode allocationMode) : base(device, length, ResourceType.ReadOnly, allocationMode) { diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteBuffer{T}.cs index 469669ff..45e82eed 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteBuffer{T}.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; @@ -21,6 +22,7 @@ public sealed class ReadWriteBuffer : StructuredBuffer /// The associated with the current instance. /// The number of items to store in the current buffer. /// The allocation mode to use for the new resource. + [RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")] internal ReadWriteBuffer(GraphicsDevice device, int length, AllocationMode allocationMode) : base(device, length, ResourceType.ReadWrite, allocationMode) { diff --git a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs index 6b6bc55f..94c85fe2 100644 --- a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs +++ b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs @@ -1,4 +1,5 @@ -using System.Runtime.CompilerServices; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; using CommunityToolkit.Diagnostics; using ComputeSharp.__Internals; using ComputeSharp.Graphics.Helpers;