diff --git a/src/ComputeSharp.Graphics/Buffers/Abstract/GraphicsResource.cs b/src/ComputeSharp.Graphics/Buffers/Abstract/GraphicsResource.cs index 46f42eec..cc32bf05 100644 --- a/src/ComputeSharp.Graphics/Buffers/Abstract/GraphicsResource.cs +++ b/src/ComputeSharp.Graphics/Buffers/Abstract/GraphicsResource.cs @@ -25,7 +25,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract /// /// Gets the associated to the currently mapped resource /// - public IntPtr MappedResource { get; private set; } + internal IntPtr MappedResource { get; private set; } /// /// Gets the object currently mapped @@ -47,7 +47,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract /// /// The index of the target subresource to map /// An for the newly mapped resource - public IntPtr Map(int subresource) + internal IntPtr Map(int subresource) { IntPtr mappedResource = NativeResource?.Map(subresource) ?? throw new InvalidOperationException("Missing resource"); MappedResource = mappedResource; @@ -58,7 +58,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract /// Unmaps a subresource specified by a given index /// /// The index of the subresource to unmap - public void Unmap(int subresource) + internal void Unmap(int subresource) { NativeResource?.Unmap(subresource); MappedResource = IntPtr.Zero; diff --git a/src/ComputeSharp.Graphics/Buffers/Buffer.cs b/src/ComputeSharp.Graphics/Buffers/Buffer.cs index 0a1da014..c928f36c 100644 --- a/src/ComputeSharp.Graphics/Buffers/Buffer.cs +++ b/src/ComputeSharp.Graphics/Buffers/Buffer.cs @@ -21,8 +21,8 @@ namespace ComputeSharp.Graphics.Buffers protected internal Buffer(GraphicsDevice device, int size, int sizeInBytes, HeapType heapType) : base(device) { Size = size; - ElementSizeInBytes = Unsafe.SizeOf(); SizeInBytes = sizeInBytes; // Not necessarily a multiple of the element size, as there could be padding + ElementSizeInBytes = Unsafe.SizeOf(); HeapType = heapType; ResourceFlags flags = heapType == HeapType.Default ? ResourceFlags.AllowUnorderedAccess : ResourceFlags.None; @@ -59,6 +59,11 @@ namespace ComputeSharp.Graphics.Buffers /// protected int ElementSizeInBytes { get; } + /// + /// Gets the heap type being targeted by the current buffer + /// + internal HeapType HeapType { get; } + /// /// Creates the descriptors for a constant buffer /// @@ -101,10 +106,5 @@ namespace ComputeSharp.Graphics.Buffers return (cpuHandle, gpuHandle); } - - /// - /// Gets the heap type being targeted by the current buffer - /// - public HeapType HeapType { get; } } } diff --git a/src/ComputeSharp.Graphics/Buffers/ReadWriteBuffer{T}.cs b/src/ComputeSharp.Graphics/Buffers/ReadWriteBuffer{T}.cs index e93159d4..cd7c9158 100644 --- a/src/ComputeSharp.Graphics/Buffers/ReadWriteBuffer{T}.cs +++ b/src/ComputeSharp.Graphics/Buffers/ReadWriteBuffer{T}.cs @@ -1,5 +1,4 @@ using System; -using System.Buffers; using System.Runtime.CompilerServices; using ComputeSharp.Graphics.Buffers.Abstract; using ComputeSharp.Graphics.Helpers; diff --git a/src/ComputeSharp.Graphics/Commands/PipelineState.cs b/src/ComputeSharp.Graphics/Commands/PipelineState.cs index fbf02571..33bc2e86 100644 --- a/src/ComputeSharp.Graphics/Commands/PipelineState.cs +++ b/src/ComputeSharp.Graphics/Commands/PipelineState.cs @@ -5,7 +5,7 @@ namespace ComputeSharp.Graphics.Commands /// /// A representing a custom pipeline state for a compute operation /// - public sealed class PipelineState : ComputePipelineStateDescription + internal sealed class PipelineState : ComputePipelineStateDescription { /// /// Creates a new instance with the specified parameters diff --git a/src/ComputeSharp.Graphics/GraphicsDevice.cs b/src/ComputeSharp.Graphics/GraphicsDevice.cs index c5c3cffb..a535c16e 100644 --- a/src/ComputeSharp.Graphics/GraphicsDevice.cs +++ b/src/ComputeSharp.Graphics/GraphicsDevice.cs @@ -135,7 +135,7 @@ namespace ComputeSharp.Graphics /// /// A instance with the info for the new object to create /// A new instance to use in a compute shader - public RootSignature CreateRootSignature(RootSignatureDescription rootSignatureDescription) + internal RootSignature CreateRootSignature(RootSignatureDescription rootSignatureDescription) { return NativeDevice.CreateRootSignature(rootSignatureDescription.Serialize()); } diff --git a/src/ComputeSharp.Graphics/Helpers/DeviceHelper.cs b/src/ComputeSharp.Graphics/Helpers/DeviceHelper.cs index 25547e65..4bcd4b67 100644 --- a/src/ComputeSharp.Graphics/Helpers/DeviceHelper.cs +++ b/src/ComputeSharp.Graphics/Helpers/DeviceHelper.cs @@ -8,7 +8,7 @@ namespace ComputeSharp.Graphics.Helpers /// /// A with methods to inspect the available devices on the current machine /// - public static class DeviceHelper + internal static class DeviceHelper { /// /// Gets a collection of all the supported devices on the current machine diff --git a/src/ComputeSharp.Graphics/Helpers/MemoryHelper.cs b/src/ComputeSharp.Graphics/Helpers/MemoryHelper.cs index 6e3a516b..ad79aa4b 100644 --- a/src/ComputeSharp.Graphics/Helpers/MemoryHelper.cs +++ b/src/ComputeSharp.Graphics/Helpers/MemoryHelper.cs @@ -6,7 +6,7 @@ namespace ComputeSharp.Graphics.Helpers /// /// A with some helper methods to copy data between memory areas /// - public static class MemoryHelper + internal static class MemoryHelper { /// /// Copies the content of a to the area pointed by an input value diff --git a/src/ComputeSharp.Graphics/Properties/AssemblyInfo.cs b/src/ComputeSharp.Graphics/Properties/AssemblyInfo.cs index 2ccbb996..c5c53b29 100644 --- a/src/ComputeSharp.Graphics/Properties/AssemblyInfo.cs +++ b/src/ComputeSharp.Graphics/Properties/AssemblyInfo.cs @@ -1,4 +1,5 @@ using System.Runtime.CompilerServices; +[assembly: InternalsVisibleTo("ComputeSharp")] [assembly: InternalsVisibleTo("ComputeSharp.Shaders")] [assembly: InternalsVisibleTo("ComputeSharp.NetCore.Tests")] diff --git a/src/ComputeSharp.Shaders/Extensions/SyntaxNodeExtensions.cs b/src/ComputeSharp.Shaders/Extensions/SyntaxNodeExtensions.cs index d7739008..55a87c5a 100644 --- a/src/ComputeSharp.Shaders/Extensions/SyntaxNodeExtensions.cs +++ b/src/ComputeSharp.Shaders/Extensions/SyntaxNodeExtensions.cs @@ -10,7 +10,7 @@ namespace ComputeSharp.Shaders.Extensions /// /// A with some extension methods for C# syntax nodes /// - public static class SyntaxNodeExtensions + internal static class SyntaxNodeExtensions { /// /// Checks a value and replaces the value type to be HLSL compatible, if needed diff --git a/src/ComputeSharp.Shaders/Properties/AssemblyInfo.cs b/src/ComputeSharp.Shaders/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..6b57bd31 --- /dev/null +++ b/src/ComputeSharp.Shaders/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("ComputeSharp")] diff --git a/src/ComputeSharp.Shaders/Renderer/Models/Fields/Abstract/FieldInfoBase.cs b/src/ComputeSharp.Shaders/Renderer/Models/Fields/Abstract/FieldInfoBase.cs index ff7cc533..93cff5c0 100644 --- a/src/ComputeSharp.Shaders/Renderer/Models/Fields/Abstract/FieldInfoBase.cs +++ b/src/ComputeSharp.Shaders/Renderer/Models/Fields/Abstract/FieldInfoBase.cs @@ -3,7 +3,7 @@ /// /// A that contains info on a shader field /// - public abstract class FieldInfoBase + internal abstract class FieldInfoBase { /// /// Gets or sets the type of the current field diff --git a/src/ComputeSharp.Shaders/Renderer/Models/Fields/ConstantBufferFieldInfo.cs b/src/ComputeSharp.Shaders/Renderer/Models/Fields/ConstantBufferFieldInfo.cs index 4dbeeb51..d79f85c4 100644 --- a/src/ComputeSharp.Shaders/Renderer/Models/Fields/ConstantBufferFieldInfo.cs +++ b/src/ComputeSharp.Shaders/Renderer/Models/Fields/ConstantBufferFieldInfo.cs @@ -5,7 +5,7 @@ namespace ComputeSharp.Shaders.Renderer.Models.Fields /// /// A that contains info on a constant buffer field /// - public sealed class ConstantBufferFieldInfo : FieldInfoBase + internal sealed class ConstantBufferFieldInfo : FieldInfoBase { /// /// Gets whether or not the current instance represents a constant buffer (always ) diff --git a/src/ComputeSharp.Shaders/Renderer/Models/Fields/ReadWriteBufferFieldInfo.cs b/src/ComputeSharp.Shaders/Renderer/Models/Fields/ReadWriteBufferFieldInfo.cs index e7280bc2..e7a9193e 100644 --- a/src/ComputeSharp.Shaders/Renderer/Models/Fields/ReadWriteBufferFieldInfo.cs +++ b/src/ComputeSharp.Shaders/Renderer/Models/Fields/ReadWriteBufferFieldInfo.cs @@ -5,7 +5,7 @@ namespace ComputeSharp.Shaders.Renderer.Models.Fields /// /// A that contains info on a read write buffer field /// - public sealed class ReadWriteBufferFieldInfo : FieldInfoBase + internal sealed class ReadWriteBufferFieldInfo : FieldInfoBase { /// /// Gets whether or not the current instance represents a read write buffer (always ) diff --git a/src/ComputeSharp.Shaders/Renderer/Models/Fields/StaticScalarFieldInfo.cs b/src/ComputeSharp.Shaders/Renderer/Models/Fields/StaticScalarFieldInfo.cs index ab6ca039..e7d079ac 100644 --- a/src/ComputeSharp.Shaders/Renderer/Models/Fields/StaticScalarFieldInfo.cs +++ b/src/ComputeSharp.Shaders/Renderer/Models/Fields/StaticScalarFieldInfo.cs @@ -5,7 +5,7 @@ namespace ComputeSharp.Shaders.Renderer.Models.Fields /// /// A that contains info on a static scalar field /// - public sealed class StaticScalarFieldInfo : FieldInfoBase + internal sealed class StaticScalarFieldInfo : FieldInfoBase { /// /// Gets whether or not the current instance represents a static scalar value (always ) diff --git a/src/ComputeSharp.Shaders/Renderer/Models/ShaderInfo.cs b/src/ComputeSharp.Shaders/Renderer/Models/ShaderInfo.cs index 2a2e09df..f9961bfe 100644 --- a/src/ComputeSharp.Shaders/Renderer/Models/ShaderInfo.cs +++ b/src/ComputeSharp.Shaders/Renderer/Models/ShaderInfo.cs @@ -8,7 +8,7 @@ namespace ComputeSharp.Shaders.Renderer.Models /// /// A that contains info to render a shader source to compile /// - public sealed class ShaderInfo + internal sealed class ShaderInfo { /// /// Gets the list of fields being present in the current shader diff --git a/src/ComputeSharp.Shaders/Renderer/ShaderRenderer.cs b/src/ComputeSharp.Shaders/Renderer/ShaderRenderer.cs index c9161fba..f4ec67b2 100644 --- a/src/ComputeSharp.Shaders/Renderer/ShaderRenderer.cs +++ b/src/ComputeSharp.Shaders/Renderer/ShaderRenderer.cs @@ -10,7 +10,7 @@ namespace ComputeSharp.Shaders.Renderer /// /// A that uses the mustache templating system to render HLSL shaders /// - public sealed class ShaderRenderer + internal sealed class ShaderRenderer { /// /// Gets the singleton instance to use diff --git a/src/ComputeSharp.Shaders/ShaderRunner.cs b/src/ComputeSharp.Shaders/ShaderRunner.cs index 0f7351b0..b9185bc5 100644 --- a/src/ComputeSharp.Shaders/ShaderRunner.cs +++ b/src/ComputeSharp.Shaders/ShaderRunner.cs @@ -15,7 +15,7 @@ namespace ComputeSharp.Shaders /// /// A responsible for performing all the necessary operations to compile and run a compute shader /// - public static class ShaderRunner + internal static class ShaderRunner { /// /// Compiles and runs the input shader on a target instance, with the specified parameters diff --git a/src/ComputeSharp.Shaders/Translation/MethodDecompiler.cs b/src/ComputeSharp.Shaders/Translation/MethodDecompiler.cs index 9a5682c3..eab63a7d 100644 --- a/src/ComputeSharp.Shaders/Translation/MethodDecompiler.cs +++ b/src/ComputeSharp.Shaders/Translation/MethodDecompiler.cs @@ -18,7 +18,7 @@ namespace ComputeSharp.Shaders.Translation /// /// A that is able to decompile arbitrary methods /// - public sealed class MethodDecompiler + internal sealed class MethodDecompiler { /// /// Gets the singleton instance to use diff --git a/src/ComputeSharp.Shaders/Translation/ShaderCompiler.cs b/src/ComputeSharp.Shaders/Translation/ShaderCompiler.cs index 712fbd85..6c7cfe14 100644 --- a/src/ComputeSharp.Shaders/Translation/ShaderCompiler.cs +++ b/src/ComputeSharp.Shaders/Translation/ShaderCompiler.cs @@ -8,7 +8,7 @@ namespace ComputeSharp.Shaders.Translation /// /// A that uses the APIs to compile compute shaders /// - public sealed class ShaderCompiler + internal sealed class ShaderCompiler { /// /// Gets the singleton instance to use diff --git a/src/ComputeSharp.Shaders/Translation/ShaderLoader.cs b/src/ComputeSharp.Shaders/Translation/ShaderLoader.cs index 26bcf29a..ee380182 100644 --- a/src/ComputeSharp.Shaders/Translation/ShaderLoader.cs +++ b/src/ComputeSharp.Shaders/Translation/ShaderLoader.cs @@ -19,7 +19,7 @@ namespace ComputeSharp.Shaders.Translation /// /// A responsible for loading and processing instances /// - public sealed class ShaderLoader + internal sealed class ShaderLoader { /// /// The that represents the shader to load diff --git a/src/ComputeSharp.Shaders/Translation/ShaderSyntaxRewriter.cs b/src/ComputeSharp.Shaders/Translation/ShaderSyntaxRewriter.cs index 63b4a0e9..b2d1e121 100644 --- a/src/ComputeSharp.Shaders/Translation/ShaderSyntaxRewriter.cs +++ b/src/ComputeSharp.Shaders/Translation/ShaderSyntaxRewriter.cs @@ -8,7 +8,7 @@ namespace ComputeSharp.Shaders.Translation /// /// A custom that processes C# methods to convert to HLSL /// - public class ShaderSyntaxRewriter : CSharpSyntaxRewriter + internal class ShaderSyntaxRewriter : CSharpSyntaxRewriter { /// /// The instance to use to rewrite the decompiled code